Arturs Kozlovskis / Mbed 2 deprecated ELEC2645_Project_el18ak

Dependencies:   mbed

Committer:
thestudent
Date:
Wed Apr 01 11:20:24 2020 +0000
Revision:
6:33bdb54c2c88
Child:
9:4b11ee1155ad
Creating a ball object and working on its movement across the screen. Got the ball going in a linear and parabolic way. For the functioning of the objects created a new class called functions. ;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thestudent 6:33bdb54c2c88 1 #ifndef OBJECTS_H
thestudent 6:33bdb54c2c88 2 #define OBJECTS_H
thestudent 6:33bdb54c2c88 3
thestudent 6:33bdb54c2c88 4 #include "mbed.h"
thestudent 6:33bdb54c2c88 5 #include "N5110.h"
thestudent 6:33bdb54c2c88 6 #include "Gamepad.h"
thestudent 6:33bdb54c2c88 7 #include <vector>
thestudent 6:33bdb54c2c88 8
thestudent 6:33bdb54c2c88 9
thestudent 6:33bdb54c2c88 10
thestudent 6:33bdb54c2c88 11 class Objects{
thestudent 6:33bdb54c2c88 12 public:
thestudent 6:33bdb54c2c88 13
thestudent 6:33bdb54c2c88 14 Objects();//initialises variables
thestudent 6:33bdb54c2c88 15 void draw_base(N5110 &lcd);// draws the base
thestudent 6:33bdb54c2c88 16 void cannon_position(Gamepad &pad);// changes the cannon position depending of the joystick
thestudent 6:33bdb54c2c88 17 void draw_cannon(N5110 &lcd);//draws the cannon
thestudent 6:33bdb54c2c88 18 void draw_shots(N5110 &lcd);// makes the shoting on the screen
thestudent 6:33bdb54c2c88 19 //ball_x: balls x position; ball_y: balls y position; delta_r: added to the inital radiuss to make the ball bigger
thestudent 6:33bdb54c2c88 20 void draw_ball(N5110 &lcd, int ball_x, int ball_y, int delta_r);//draws the ball
thestudent 6:33bdb54c2c88 21
thestudent 6:33bdb54c2c88 22 vector <int> _shot_y_pos; //holds the shots y positions
thestudent 6:33bdb54c2c88 23 vector <int> _shot_x_pos;//holds the shots x positons
thestudent 6:33bdb54c2c88 24
thestudent 6:33bdb54c2c88 25
thestudent 6:33bdb54c2c88 26 private:
thestudent 6:33bdb54c2c88 27 int _cannon_pos; //stores the positon of the cannon
thestudent 6:33bdb54c2c88 28 int _initial_shot_pos;//stroes the initial vertical position of the shot
thestudent 6:33bdb54c2c88 29 int _shot_incrementer;//increments the shot on the lcd by 2
thestudent 6:33bdb54c2c88 30 int _radiuss;// the initiak radiuss of the ball
thestudent 6:33bdb54c2c88 31
thestudent 6:33bdb54c2c88 32 };
thestudent 6:33bdb54c2c88 33 #endif