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.
Diff: Game/Game.cpp
- Revision:
- 7:68e06dda79f7
- Parent:
- 6:2ca1516ec1e2
- Child:
- 8:21b6d4dbce44
diff -r 2ca1516ec1e2 -r 68e06dda79f7 Game/Game.cpp --- a/Game/Game.cpp Wed Apr 10 11:03:07 2019 +0000 +++ b/Game/Game.cpp Wed Apr 17 12:39:46 2019 +0000 @@ -12,23 +12,26 @@ {0,1,0,1,0,0} }; - -Vector2D blocks[2][2] = { - { {30,6},{35,10} }, - { {5,10},{2,6} } +const int number_of_blocks = 1; +Block blocks [number_of_blocks] = { + { {5,30},{80,40} } + }; Game::Game() { - Vector2D pos = {20,20}; - _player.init(6,6,(int *)player_bitmap,pos); - //_player.flip(); - - _level.init(blocks,2); + } +void Game::init() +{ + Vector2D pos = {32,10}; + _player.init(6,6,(int *)player_bitmap,pos); + //_player.flip(); + _level.init(blocks,1); +} Game::~Game() { @@ -42,12 +45,13 @@ void Game::update(Gamepad &pad) { - _player.update(pad); + _player.update(pad, blocks,number_of_blocks); } void Game::draw(N5110 &lcd) { - + //_level.init(blocks,2); + lcd.clear(); _player.render(lcd); _level.render(lcd);