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:
- 12:be491ab6e742
- Parent:
- 11:c174d84e4866
- Child:
- 14:e88bcf5c0887
File content as of revision 12:be491ab6e742:
#include "SpaceInvaderEngine.h" // N5110 lcd1; SpaceInvaderEngine::SpaceInvaderEngine() { } SpaceInvaderEngine::~SpaceInvaderEngine() { } void SpaceInvaderEngine::init(int ship_height, int ship_width, int alien_size, int no_aliens, int column_size, int row_size) { S1_height = ship_height; S1_width = ship_width; A1_size = alien_size; Vector2D ship_pos = S1.get_position(); BS1x = ship_pos.x; BS1y = ship_pos.y; N = no_aliens; CS = column_size; RS = row_size; A1.init(N,A1_size,CS,RS); 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, lcd, BS1x, BS1y); } void SpaceInvaderEngine::get_ship_pos() { Vector2D ship_pos = S1.get_position(); BS1x = ship_pos.x + 4; BS1y = ship_pos.y; }