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 MotionSensor
Entity/Bullets/Bullets.cpp@13:d04a6caba40d, 2019-04-24 (annotated)
- Committer:
- el17sm
- Date:
- Wed Apr 24 02:33:33 2019 +0000
- Revision:
- 13:d04a6caba40d
- Parent:
- 11:63e54f6e7939
- Child:
- 14:3361879490b2
Added bullets (error)
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el17sm | 13:d04a6caba40d | 1 | #include "Bullets.h" |
| el17sm | 13:d04a6caba40d | 2 | |
| el17sm | 13:d04a6caba40d | 3 | Bullets::Bullets(float pos_x, float pos_y, int dir){ |
| el17sm | 13:d04a6caba40d | 4 | moving = true; |
| el17sm | 13:d04a6caba40d | 5 | face = 0; |
| el17sm | 13:d04a6caba40d | 6 | hp = 1; |
| el17sm | 13:d04a6caba40d | 7 | hitbox.width = 2; |
| el17sm | 13:d04a6caba40d | 8 | hitbox.height = 2; |
| el17sm | 13:d04a6caba40d | 9 | position.x = pos_x; |
| el17sm | 13:d04a6caba40d | 10 | position.y = pos_y; |
| el17sm | 13:d04a6caba40d | 11 | sprite_size.width = 2; |
| el17sm | 13:d04a6caba40d | 12 | sprite_size.height = 2; |
| el17sm | 13:d04a6caba40d | 13 | sprite_size.offset_x = 0; |
| el17sm | 13:d04a6caba40d | 14 | sprite_size.offset_y = 0; |
| el17sm | 13:d04a6caba40d | 15 | direction = dir; |
| el17sm | 13:d04a6caba40d | 16 | } |
| el17sm | 13:d04a6caba40d | 17 | |
| el17sm | 13:d04a6caba40d | 18 | void Bullets::move(float speed, float unused){ |
| el17sm | 13:d04a6caba40d | 19 | position.x += (direction < 2)*speed; |
| el17sm | 13:d04a6caba40d | 20 | position.y += (direction < 2)*speed; |
| el17sm | 13:d04a6caba40d | 21 | } |
| el17sm | 13:d04a6caba40d | 22 | |
| el17sm | 13:d04a6caba40d | 23 | int * Bullets::get_frame(){ |
| el17sm | 13:d04a6caba40d | 24 | return (int *) bullets_sprite; |
| el17sm | 13:d04a6caba40d | 25 | } |