Josh Davy / Mbed 2 deprecated Flip

Dependencies:   mbed el17jd

Committer:
joshdavy
Date:
Fri Apr 19 17:54:09 2019 +0000
Revision:
8:21b6d4dbce44
Parent:
7:68e06dda79f7
Child:
9:96969b1c6bde
Main menu added.;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
joshdavy 1:37802772843e 1 #include "Game.h"
joshdavy 1:37802772843e 2 // Objects
joshdavy 1:37802772843e 3
joshdavy 2:b62e8be35a5d 4
joshdavy 2:b62e8be35a5d 5
joshdavy 8:21b6d4dbce44 6
joshdavy 8:21b6d4dbce44 7 const int number_of_blocks = 4;
joshdavy 8:21b6d4dbce44 8 Block blocks [number_of_blocks] = {
joshdavy 8:21b6d4dbce44 9 { {5,30},{80,40} },
joshdavy 8:21b6d4dbce44 10 { {5,5},{80,10} },
joshdavy 8:21b6d4dbce44 11 { {10,24},{20,34} },
joshdavy 8:21b6d4dbce44 12 { {40,24},{44,26} }
joshdavy 1:37802772843e 13 };
joshdavy 1:37802772843e 14
joshdavy 8:21b6d4dbce44 15 const int number_of_moving_blocks = 1;
joshdavy 8:21b6d4dbce44 16 MovingBlock moving_blocks [number_of_moving_blocks] = {
joshdavy 8:21b6d4dbce44 17 {2,30,30,1,1,0,0}
joshdavy 8:21b6d4dbce44 18 };
joshdavy 6:2ca1516ec1e2 19
joshdavy 1:37802772843e 20 Game::Game()
joshdavy 1:37802772843e 21 {
joshdavy 1:37802772843e 22
joshdavy 7:68e06dda79f7 23
joshdavy 1:37802772843e 24
joshdavy 1:37802772843e 25
joshdavy 1:37802772843e 26 }
joshdavy 7:68e06dda79f7 27 void Game::init()
joshdavy 7:68e06dda79f7 28 {
joshdavy 7:68e06dda79f7 29 Vector2D pos = {32,10};
joshdavy 8:21b6d4dbce44 30 _player.init(6,6,pos);
joshdavy 8:21b6d4dbce44 31
joshdavy 8:21b6d4dbce44 32 Vector2D goal = {70,19};
joshdavy 8:21b6d4dbce44 33 _level.init(blocks,moving_blocks,number_of_blocks,
joshdavy 8:21b6d4dbce44 34 number_of_moving_blocks,
joshdavy 8:21b6d4dbce44 35 goal);
joshdavy 8:21b6d4dbce44 36
joshdavy 7:68e06dda79f7 37 }
joshdavy 1:37802772843e 38
joshdavy 1:37802772843e 39 Game::~Game()
joshdavy 1:37802772843e 40 {
joshdavy 1:37802772843e 41
joshdavy 1:37802772843e 42 }
joshdavy 1:37802772843e 43
joshdavy 1:37802772843e 44 void Game::read_input(Gamepad &pad)
joshdavy 1:37802772843e 45 {
joshdavy 1:37802772843e 46
joshdavy 1:37802772843e 47 }
joshdavy 1:37802772843e 48
joshdavy 1:37802772843e 49 void Game::update(Gamepad &pad)
joshdavy 1:37802772843e 50 {
joshdavy 8:21b6d4dbce44 51
joshdavy 7:68e06dda79f7 52 _player.update(pad, blocks,number_of_blocks);
joshdavy 1:37802772843e 53 }
joshdavy 1:37802772843e 54
joshdavy 2:b62e8be35a5d 55 void Game::draw(N5110 &lcd)
joshdavy 1:37802772843e 56 {
joshdavy 8:21b6d4dbce44 57
joshdavy 2:b62e8be35a5d 58 lcd.clear();
joshdavy 8:21b6d4dbce44 59 _level.render(lcd);
joshdavy 1:37802772843e 60 _player.render(lcd);
joshdavy 2:b62e8be35a5d 61 lcd.refresh();
joshdavy 2:b62e8be35a5d 62
joshdavy 1:37802772843e 63 }
joshdavy 1:37802772843e 64