Lewis Cheadle 201245660
Dependencies: mbed
Diff: Ball/Ball.cpp
- Revision:
- 3:4494e6928194
- Parent:
- 2:823dea76ff2e
- Child:
- 4:a9d5fca3b7ba
--- a/Ball/Ball.cpp Sat May 16 13:06:29 2020 +0000 +++ b/Ball/Ball.cpp Sat May 16 15:51:02 2020 +0000 @@ -1,4 +1,5 @@ #include "Ball.h" +#include "Gamepad.h" Ball::Ball() { @@ -28,40 +29,40 @@ lcd.drawSprite(ball_x_pos,ball_y_pos,2,2,(int *)ball); } -void Ball::update() +void Ball::update(Direction d) { - if (pad.get_direction == N){ + if (d == N){ ball_y_pos ++; }; - if (pad.get_direction == S){ + if (d == S){ ball_x_pos --; }; - if (pad.get_direction == E){ + if (d == E){ ball_x_pos ++; }; - if (pad.get_direction == W){ + if (d == W){ ball_x_pos --; }; - if (pad.get_direction == NE){ + if (d == NE){ ball_x_pos ++; ball_y_pos ++; }; - if (pad.get_direction == SE){ + if (d == SE){ ball_x_pos ++; ball_y_pos --; }; - if (pad.get_direction == SW){ + if (d == SW){ ball_x_pos --; ball_y_pos --; }; - if (pad.get_direction == NW){ + if (d == NW){ ball_x_pos ++; ball_y_pos --; };