GAME PROGRAMMING WK.3

This week we learned how to use Classes and began programing in an object oriented way, but we only scratched the surface of OOP(object oriented programing). Classes are another type of data structures that group data, classes has variables and functions, they are called member functions or methods and member variables.

That’s all for today, I will try to make Tic Tac Toe in SDL and publish some of the progress here so stay tuned!

-Marwan

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

Game programming wk.1

We started learning programming  this week, how exciting is that!?! I have been waiting for this since I started this education. Thankfully I have experience when it come to programing, I studied C++, C# and Java.

Even though, this week covered the very basics to learn programming C++, i have learned a lot. It seems to me that the course is moving at a remarkable speed, it won’t be long until we face the advanced stuff that will make our heads spin in confusion 🙂

What did I learn this week ?

I have previously worked with flow control statements in C++ but never knew for example, when to use for loop over while loop. So I focused on that, It seems to me that the choice depends on  personal preference but sometimes it is more optimal to use one over another. To clarify, it is more preferable to use for simple loops and while for more complicated loops.

Next week, the class will make a Pong game in C++. Stay tuned for more!

-Marwan