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.
Claw/Claw.h@8:c5969685cf02, 2020-04-26 (annotated)
- Committer:
- ZhongYufan
- Date:
- Sun Apr 26 13:17:27 2020 +0000
- Revision:
- 8:c5969685cf02
- Parent:
- 1:9c7bb3db32bc
- Child:
- 16:e3ecfcd2a389
version 1.1(debugging) claw does not go down but can follow the winch
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ZhongYufan | 1:9c7bb3db32bc | 1 | #ifndef CLAW_H |
ZhongYufan | 1:9c7bb3db32bc | 2 | #define CLAW_H |
ZhongYufan | 1:9c7bb3db32bc | 3 | |
ZhongYufan | 1:9c7bb3db32bc | 4 | #include "mbed.h" |
ZhongYufan | 1:9c7bb3db32bc | 5 | #include "N5110.h" |
ZhongYufan | 1:9c7bb3db32bc | 6 | #include "Gamepad.h" |
ZhongYufan | 1:9c7bb3db32bc | 7 | #include "Winch.h" |
ZhongYufan | 1:9c7bb3db32bc | 8 | #include "Monster.h" |
ZhongYufan | 1:9c7bb3db32bc | 9 | |
ZhongYufan | 1:9c7bb3db32bc | 10 | /** Claw Class |
ZhongYufan | 1:9c7bb3db32bc | 11 | @author Dr Craig A. Evans, University of Leeds |
ZhongYufan | 1:9c7bb3db32bc | 12 | @brief Controls the claw in the Pong game |
ZhongYufan | 1:9c7bb3db32bc | 13 | @date Febraury 2017 |
ZhongYufan | 1:9c7bb3db32bc | 14 | */ |
ZhongYufan | 1:9c7bb3db32bc | 15 | class Claw |
ZhongYufan | 1:9c7bb3db32bc | 16 | { |
ZhongYufan | 1:9c7bb3db32bc | 17 | |
ZhongYufan | 1:9c7bb3db32bc | 18 | public: |
ZhongYufan | 1:9c7bb3db32bc | 19 | Claw(); |
ZhongYufan | 1:9c7bb3db32bc | 20 | ~Claw(); |
ZhongYufan | 1:9c7bb3db32bc | 21 | void init(int winch_width); |
ZhongYufan | 1:9c7bb3db32bc | 22 | void draw(N5110 &lcd); |
ZhongYufan | 8:c5969685cf02 | 23 | void update(Direction d,float mag,Vector2D winch_pos); |
ZhongYufan | 1:9c7bb3db32bc | 24 | /// accessors and mutators |
ZhongYufan | 1:9c7bb3db32bc | 25 | void add_now_score(); |
ZhongYufan | 1:9c7bb3db32bc | 26 | int get_now_score(); |
ZhongYufan | 8:c5969685cf02 | 27 | void set_velocity(float v); |
ZhongYufan | 8:c5969685cf02 | 28 | float get_velocity(); |
ZhongYufan | 1:9c7bb3db32bc | 29 | Vector2D get_pos(); |
ZhongYufan | 1:9c7bb3db32bc | 30 | void set_pos(Vector2D p); |
ZhongYufan | 1:9c7bb3db32bc | 31 | |
ZhongYufan | 1:9c7bb3db32bc | 32 | |
ZhongYufan | 1:9c7bb3db32bc | 33 | |
ZhongYufan | 1:9c7bb3db32bc | 34 | private: |
ZhongYufan | 1:9c7bb3db32bc | 35 | int _winch_width; |
ZhongYufan | 1:9c7bb3db32bc | 36 | int _x0; |
ZhongYufan | 1:9c7bb3db32bc | 37 | int _y0; |
ZhongYufan | 1:9c7bb3db32bc | 38 | int _x1; |
ZhongYufan | 1:9c7bb3db32bc | 39 | int _y1; |
ZhongYufan | 8:c5969685cf02 | 40 | float _velocity_y; |
ZhongYufan | 1:9c7bb3db32bc | 41 | int _now_score; |
ZhongYufan | 1:9c7bb3db32bc | 42 | int _speed_x; |
ZhongYufan | 1:9c7bb3db32bc | 43 | |
ZhongYufan | 1:9c7bb3db32bc | 44 | }; |
ZhongYufan | 1:9c7bb3db32bc | 45 | #endif |