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
Gameengine.cpp
- Committer:
- el17arm
- Date:
- 2019-04-01
- Revision:
- 17:b4079bd0e551
- Parent:
- 16:8384e9a480ef
- Child:
- 18:ff0a53dcb862
File content as of revision 17:b4079bd0e551:
#include "Gameengine.h"
Gameengine::Gameengine()
{
}
Gameengine::~Gameengine()
{
}
void Gameengine::game_init()
{
_level_select = 1;
_miner.miner_init(3, 33);
}
void Gameengine::read_direction(Gamepad &pad)
{
_d = pad.get_direction();
}
void Gameengine::update(N5110 &lcd, Gamepad &pad)
{
_miner.miner_move(_d);
_miner.miner_gravity(lcd);
_miner.miner_jump(lcd, pad);
_miner.miner_land(lcd);
}
void Gameengine::draw(N5110 &lcd)
{
if (_level_select == 1){
_miner.miner_draw(lcd);
_level.level_one(lcd);
_level.soft_blocks(46, 8, lcd);
_level.soft_blocks(52, 8, lcd);
_level.soft_blocks(55, 36, lcd);
_level.soft_blocks(33, 8, lcd);
_level.soft_blocks(27, 8, lcd);
_level.soft_blocks(59, 36, lcd);
_level.draw_solid_block(49,37, lcd);
_level.draw_solid_block(52,37, lcd);
_level.draw_solid_block(45,22, lcd);
_level.draw_solid_block(42,22, lcd);
_miner.level_one_collision(lcd);
//level keys
_level.draw_key1(79, 12, lcd);
_level.draw_key2(25, 0, lcd);
_level.draw_key3(40, 4, lcd);
_level.draw_key4(56, 6, lcd);
_level.draw_key5(75, 0, lcd);
_level.keys_collected();
printf("game keys = %i \n ", _level.keys_collected());
}
}