ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el19tb

Dependencies:   mbed

Committer:
el19tb
Date:
Mon May 18 02:36:44 2020 +0000
Revision:
40:8cc82e3fce06
Parent:
39:8b09540724b3
Child:
43:2cd1cfe07770
created a collision function for the frog, and different frog interactions when it is in the water or road, and reset function

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el19tb 31:70521f37e004 1 #include "Frog.h"
el19tb 5:6e3afee7eac3 2
el19tb 40:8cc82e3fce06 3 //every chicken object will accept x, y, and width (square)
el19tb 31:70521f37e004 4 Frog::Frog(int x, int y, int width){
el19tb 5:6e3afee7eac3 5 this->x = x;
el19tb 5:6e3afee7eac3 6 this->y = y;
el19tb 5:6e3afee7eac3 7 this->width = width;
el19tb 5:6e3afee7eac3 8
el19tb 5:6e3afee7eac3 9 left_side = x;
el19tb 5:6e3afee7eac3 10 right_side = width + x;
el19tb 5:6e3afee7eac3 11 up = y;
el19tb 5:6e3afee7eac3 12 down = width + y;
el19tb 5:6e3afee7eac3 13 }
el19tb 5:6e3afee7eac3 14
el19tb 39:8b09540724b3 15 // reset back to start position
el19tb 40:8cc82e3fce06 16 void Frog::reset()
el19tb 39:8b09540724b3 17 {
el19tb 40:8cc82e3fce06 18 x = (84/2)-4/2;
el19tb 39:8b09540724b3 19 y = 48-4;
el19tb 40:8cc82e3fce06 20 width = 4;
el19tb 39:8b09540724b3 21
el19tb 39:8b09540724b3 22 left_side = x;
el19tb 39:8b09540724b3 23 right_side = width + x;
el19tb 39:8b09540724b3 24 up = y;
el19tb 39:8b09540724b3 25 down = width + y;
el19tb 39:8b09540724b3 26 }
el19tb 39:8b09540724b3 27
el19tb 40:8cc82e3fce06 28