Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Ball/Ball.h@3:5edefa83f8f0, 2019-04-16 (annotated)
- Committer:
- el17cr
- Date:
- Tue Apr 16 07:43:34 2019 +0000
- Revision:
- 3:5edefa83f8f0
- Parent:
- 2:7f91a86b4dc0
- Child:
- 5:1a9d84df7207
Ball movement indicated, initial collision checking
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el17cr | 2:7f91a86b4dc0 | 1 | #ifndef BALL_H |
el17cr | 2:7f91a86b4dc0 | 2 | #define BALL_H |
el17cr | 2:7f91a86b4dc0 | 3 | |
el17cr | 2:7f91a86b4dc0 | 4 | #include "mbed.h" |
el17cr | 2:7f91a86b4dc0 | 5 | #include "N5110.h" |
el17cr | 2:7f91a86b4dc0 | 6 | #include "Gamepad.h" |
el17cr | 2:7f91a86b4dc0 | 7 | |
el17cr | 2:7f91a86b4dc0 | 8 | |
el17cr | 2:7f91a86b4dc0 | 9 | class Ball |
el17cr | 2:7f91a86b4dc0 | 10 | { |
el17cr | 2:7f91a86b4dc0 | 11 | |
el17cr | 2:7f91a86b4dc0 | 12 | public: |
el17cr | 2:7f91a86b4dc0 | 13 | Ball(); |
el17cr | 2:7f91a86b4dc0 | 14 | ~Ball(); |
el17cr | 3:5edefa83f8f0 | 15 | void init(int y,int size); |
el17cr | 2:7f91a86b4dc0 | 16 | void draw(N5110 &lcd); |
el17cr | 3:5edefa83f8f0 | 17 | void update(); |
el17cr | 3:5edefa83f8f0 | 18 | //acessor and mutator methods |
el17cr | 3:5edefa83f8f0 | 19 | void set_velocity(Vector2D v); |
el17cr | 3:5edefa83f8f0 | 20 | Vector2D get_velocity(); |
el17cr | 2:7f91a86b4dc0 | 21 | Vector2D get_pos(); |
el17cr | 3:5edefa83f8f0 | 22 | void set_pos(Vector2D p); |
el17cr | 3:5edefa83f8f0 | 23 | void updateX(Direction d,float mag); |
el17cr | 3:5edefa83f8f0 | 24 | |
el17cr | 2:7f91a86b4dc0 | 25 | |
el17cr | 2:7f91a86b4dc0 | 26 | |
el17cr | 2:7f91a86b4dc0 | 27 | private: |
el17cr | 2:7f91a86b4dc0 | 28 | |
el17cr | 3:5edefa83f8f0 | 29 | Vector2D _velocity; |
el17cr | 3:5edefa83f8f0 | 30 | int _size; |
el17cr | 2:7f91a86b4dc0 | 31 | int _x; |
el17cr | 2:7f91a86b4dc0 | 32 | int _y; |
el17cr | 2:7f91a86b4dc0 | 33 | int _speed; |
el17cr | 3:5edefa83f8f0 | 34 | |
el17cr | 2:7f91a86b4dc0 | 35 | }; |
el17cr | 2:7f91a86b4dc0 | 36 | #endif |
el17cr | 2:7f91a86b4dc0 | 37 | |
el17cr | 2:7f91a86b4dc0 | 38 | |
el17cr | 2:7f91a86b4dc0 | 39 |