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
Eng.cpp
- Committer:
- el18jgb
- Date:
- 2020-05-17
- Revision:
- 5:c37f4ed2cad3
- Parent:
- 4:6f898b000797
- Child:
- 6:d560ecc21ae6
File content as of revision 5:c37f4ed2cad3:
#include "Eng.h" Eng::Eng() { } Eng::~Eng() { } // objects //Gamepad pad; //N5110 lcd; Aim aim; Heston heston; void Eng::init() { aim.init(); heston.init(); } //void Eng::read_input(Gamepad &pad); void Eng::update(Gamepad &pad) { check_hit(pad); heston.update(pad); aim.update(pad); } void Eng::draw(N5110 &lcd) { heston.draw(lcd); aim.draw(lcd); } void Eng::check_hit(Gamepad &pad) { Vector2D aim_pos = aim.get_pos(); Vector2D h1_pos = heston.get_pos(); if ( (aim_pos.y >= h1_pos.y) && //top (aim_pos.y <= h1_pos.y + 12) && //bottom (aim_pos.x >= h1_pos.x) && //left (aim_pos.x <= h1_pos.x + 11) //right ) { heston.hit(pad); } }