ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18s2a_2

Dependencies:   mbed

Committer:
Psy1990
Date:
Fri Jun 05 19:42:34 2020 +0000
Revision:
11:ba20e1b516a1
Parent:
10:3e37b58e8600
Child:
15:15577b650c2e
The x and y position of the snake can no longer leave the game area. Next to do is make the game end when it touches the edge!

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Psy1990 8:32825d724856 1 #ifndef APPLE_H
Psy1990 8:32825d724856 2 #define APPLE_H
Psy1990 8:32825d724856 3
Psy1990 8:32825d724856 4 #include "mbed.h"
Psy1990 8:32825d724856 5 #include "N5110.h"
Psy1990 8:32825d724856 6 #include "Gamepad.h"
Psy1990 11:ba20e1b516a1 7 /** Apple Class File
Psy1990 11:ba20e1b516a1 8 * @brief Class containing the apple that the snake uses to get score and increase in size.
Psy1990 11:ba20e1b516a1 9 * @author Simon Atkinson
Psy1990 11:ba20e1b516a1 10 * @date June 2020
Psy1990 11:ba20e1b516a1 11 */
Psy1990 8:32825d724856 12
Psy1990 8:32825d724856 13
Psy1990 8:32825d724856 14 class Apple
Psy1990 8:32825d724856 15
Psy1990 8:32825d724856 16 {
Psy1990 8:32825d724856 17 public:
Psy1990 8:32825d724856 18
Psy1990 8:32825d724856 19 Apple();
Psy1990 8:32825d724856 20 ~Apple();
Psy1990 10:3e37b58e8600 21 void init(int size); // Inital setup
Psy1990 10:3e37b58e8600 22 void draw(N5110 &lcd); // Draws the Apple on the LCD
Psy1990 10:3e37b58e8600 23 Vector2D get_pos(); // Needed for Poistioning
Psy1990 10:3e37b58e8600 24 void set_pos(Vector2D a); // Needed for Poistioning
Psy1990 8:32825d724856 25
Psy1990 8:32825d724856 26 private:
Psy1990 8:32825d724856 27
Psy1990 10:3e37b58e8600 28 int _x; // X Value of Apple
Psy1990 10:3e37b58e8600 29 int _y; // Y Value of Apple
Psy1990 10:3e37b58e8600 30 int _size; //Size set in main.cpp
Psy1990 8:32825d724856 31
Psy1990 8:32825d724856 32 };
Psy1990 8:32825d724856 33 #endif