Game programming wk.2

I thought that week one was intensive until we started week two. In five days we managed to learn functions, pointers and then jump straight in SDL() and make Pong.

While doing that we got to learn a new data structure called struct, struct is a group of data elements, these elements called members. Using struct increased efficiency when creating similar instances of a class or a struct.


struct Paddle

{

float x,y; //The X and Y coordinates of the paddle

//An array that has two elements [0] and [1], 

each element is assigned to a keyboard key to execute movement

bool input[2]; 

};


But you might ask there is on paddle while in original game there are two paddles, left and right. Instead of creating a new struct with the name Paddle_2, we create a struct called game that contains all the important data in the game.


struct Game

{

int game_width = 1024;

int game_height = 600;

Paddle left;

Paddle right;

};

We create the right paddle In struct Game or in programming language, we create and instance of type Paddle called right. Tune in next week for more C++.

-Marwan

Dragons and oscilloscopes

Hello again..

I have realized something during the past four weeks, I forgot to blog. While it’s not my favorite thing, I will try my best to post as frequently as possible.

For the next five weeks I’ll be working on a project with five people on designing a space shooter. In my opinion, it should be the best part of the course.   Two words were given to us to determine the theme and we got dragons and oscilloscopes. Yes, this is going to be fun.

While being sick the past week, I was trying out Game maker and I must say It’S AWESOME! Here is what I got so far, it not much but it is a start 🙂

 

img_2

img_1