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
- Committer:
- josh_ohara
- Date:
- 2020-04-01
- Revision:
- 11:c174d84e4866
- Parent:
- 10:9189419fda68
- Child:
- 12:be491ab6e742
File content as of revision 11:c174d84e4866:
#include "SpaceInvaderEngine.h" // N5110 lcd1; SpaceInvaderEngine::SpaceInvaderEngine() { } SpaceInvaderEngine::~SpaceInvaderEngine() { } void SpaceInvaderEngine::init(int ship_height, int ship_width, int alien_size) { S1_height = ship_height; S1_width = ship_width; A1_size = alien_size; A1y = BORDER + 5; Vector2D ship_pos = S1.get_position(); BS1x = ship_pos.x; BS1y = ship_pos.y; A1.init(A1y,A1_size); S1.init(S1_height,S1_width); BS1.init(); } void SpaceInvaderEngine::read_input(Gamepad &pad) { D = pad.get_direction(); Mag = pad.get_mag(); } void SpaceInvaderEngine::render(N5110 &lcd) { S1.render(lcd); A1.render(lcd); BS1.render(lcd); } void SpaceInvaderEngine::update(Gamepad &pad, N5110 &lcd) { S1.update(D,Mag); A1.update(lcd); get_ship_pos(); BS1.update(pad, BS1x, BS1y); } void SpaceInvaderEngine::get_ship_pos() { Vector2D ship_pos = S1.get_position(); BS1x = ship_pos.x + 4; BS1y = ship_pos.y; }