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
SpaceInvaderEngine/SpaceInvaderEngine.cpp@7:06a2558155f0, 2020-03-24 (annotated)
- Committer:
- josh_ohara
- Date:
- Tue Mar 24 16:44:48 2020 +0000
- Revision:
- 7:06a2558155f0
- Child:
- 8:86cb9a9f8a73
Need to stop trying to write whole game at once. Going to get each object working first, starting with the ship.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
josh_ohara | 7:06a2558155f0 | 1 | |
josh_ohara | 7:06a2558155f0 | 2 | #include "SpaceInvaderEngine.h" |
josh_ohara | 7:06a2558155f0 | 3 | |
josh_ohara | 7:06a2558155f0 | 4 | SpaceInvaderEngine::SpaceInvaderEngine() |
josh_ohara | 7:06a2558155f0 | 5 | { |
josh_ohara | 7:06a2558155f0 | 6 | |
josh_ohara | 7:06a2558155f0 | 7 | } |
josh_ohara | 7:06a2558155f0 | 8 | |
josh_ohara | 7:06a2558155f0 | 9 | void SpaceInvaderEngine::init(int ship_height, int ship_width, int ship_bullet_size, int alien_size) { |
josh_ohara | 7:06a2558155f0 | 10 | |
josh_ohara | 7:06a2558155f0 | 11 | S1_height = ship_height; |
josh_ohara | 7:06a2558155f0 | 12 | S1_width = ship_width; |
josh_ohara | 7:06a2558155f0 | 13 | A1_size = alien_size; |
josh_ohara | 7:06a2558155f0 | 14 | BS1_size = ship_bullet_size; |
josh_ohara | 7:06a2558155f0 | 15 | |
josh_ohara | 7:06a2558155f0 | 16 | A1y = BORDER + 5; |
josh_ohara | 7:06a2558155f0 | 17 | Vector2D ship_pos = S1.get_position; |
josh_ohara | 7:06a2558155f0 | 18 | BS1x = ship_pos.x; |
josh_ohara | 7:06a2558155f0 | 19 | |
josh_ohara | 7:06a2558155f0 | 20 | A1.init(A1y,A1_size); |
josh_ohara | 7:06a2558155f0 | 21 | S1.init(S1_height,S1_width); |
josh_ohara | 7:06a2558155f0 | 22 | BS1.init(BS1_size,BS1x); |
josh_ohara | 7:06a2558155f0 | 23 | |
josh_ohara | 7:06a2558155f0 | 24 | } |
josh_ohara | 7:06a2558155f0 | 25 | |
josh_ohara | 7:06a2558155f0 | 26 | void SpaceInvaderEngine::read_input(Gamepad &pad) |
josh_ohara | 7:06a2558155f0 | 27 | { |
josh_ohara | 7:06a2558155f0 | 28 | D = pad.get_direction(); |
josh_ohara | 7:06a2558155f0 | 29 | Mag = pad.get_mag(); |
josh_ohara | 7:06a2558155f0 | 30 | } |
josh_ohara | 7:06a2558155f0 | 31 |