summaryrefslogtreecommitdiffstats
path: root/labb4/Robot.cpp
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2020-11-09 22:12:41 +0100
committerGustav Sörnäs <gustav@sornas.net>2020-11-09 22:12:41 +0100
commit6a72f2f15c9f39b2a851b955b9b87abede8d0257 (patch)
tree53afef7ae52433d170fafd070941a5e57e6b44dc /labb4/Robot.cpp
parent209bc7540a97bb238e70b9f9e248a0a0c756a4c0 (diff)
downloadtddd86-6a72f2f15c9f39b2a851b955b9b87abede8d0257.tar.gz
initial work
Diffstat (limited to 'labb4/Robot.cpp')
-rw-r--r--labb4/Robot.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/labb4/Robot.cpp b/labb4/Robot.cpp
new file mode 100644
index 0000000..f7d96e0
--- /dev/null
+++ b/labb4/Robot.cpp
@@ -0,0 +1,19 @@
+/**
+ * Copyright (C) David Wolfe, 1999. All rights reserved.
+ * Ported to Qt and adapted for TDDD86, 2015.
+ */
+
+#include "Robot.h"
+#include "constants.h"
+
+Robot::Robot() : Unit() {}
+
+void Robot::draw(QGraphicsScene *scene) const {
+ Point corner = asPoint();
+ scene->addEllipse(QRectF(corner.x * UNIT_WIDTH, corner.y * UNIT_HEIGHT,
+ JUNK_RADIUS, JUNK_RADIUS), QPen(), QBrush(ROBOT_COLOR));
+}
+
+unsigned int Robot::getCollisionCount() const {
+ return 1;
+};