Mochu Yao explorer game

Dependencies:   mbed

Gameengine/Gameengine.h

Committer:
el17my
Date:
2020-04-27
Revision:
9:e11bb7cef050
Child:
10:559487aac60e

File content as of revision 9:e11bb7cef050:

#ifndef GAMEENGINE_H
#define GAMEENGINE_H

//* @the enginee file has these functions
//  1 make the whole explorer game run and set the score the reset process
//  2 cheak the collision and the reset or fall flag
//  3 draw on the lcd screen and load the gamepad controll
//* @date April 24th 2020
//* @author Yaomochu
#include "N5110.h"
#include "mbed.h"
#include "Gamepad.h"
#include "item.h"
#include "explorer.h"
#include "surface.h"
#include <cstdlib>
#include <ctime>

struct Coordinate {
  Vector2D coord; /**< Vector 2D for joystick coords */ 
  };
  
class Gameengine {
 // Constructor and destructor.
public:
Gameengine();
~Gameengine();
//first init all the parameter
    void init();
    void reset_game_engine();
    void read_input(Gamepad &pad);
    void check_reset(N5110 &lcd, Gamepad &gamepad);
    void check_collision(Gamepad &gamepad);
    void check_start(N5110 &lcd, Gamepad &gamepad);
    void set_fall_flag();
    bool get_start_flag();
    void generate_lines();
    int  get_score();
    void get_explorer_direction();
    void get_sprite();
    void get_explorer_y(Gamepad &gamepad);
    void get_explorer_x();
    void update_lcd(N5110 &lcd);
    void run_engine(N5110 &lcd, Gamepad &gamepad);


private:
Coordinate _coordinate;
item _item;
Explorer _player;
Surface _surface;
    bool X_flag;
    int _player_x;
    int _player_y;
    bool _collision_flag;
    bool _f_flag;
    bool _r_flag;
    bool _start_flag;
    int  _speed;
    int _jump_height;
    int _player_score;
Line set_line_1;
Line set_line_2;
Line set_line_3;
Line line_1_value;
Line line_2_value;
Line line_3_value;
Line line_4_value;
Line line_5_value;
Line line_6_value;
Player_direction _player_direction;
Explorer_sprite _explorer_sprite; 
};
#endif