Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 22 Mar 2013
Offline Last Active Nov 19 2014 03:22 AM

#5066822 Code Review - Pong clone..

Posted by on 02 June 2013 - 12:47 AM

Wow.. thats.. quite a lot :) I will definitely keep your advices in mind when creating next project. There were some problems, that I couldn't solve other way than doing things such as

if(score.AddPoint(ball.Logic(deltaT.asSeconds(), paddle1, paddle2))) Reset();

I admit that it is not the best way, but at this point I couldn't make up any other, working solution. You can probably see that I am not the best in creating object oriented code :) I'm still learning what to make public/private, how to change the private fields etc.. As for putting C in the class names. Well.. it helps me :) I don't think it confuses other people, and if it does just tell me :) Thanks for advices! :)

#5066697 Code Review - Pong clone..

Posted by on 01 June 2013 - 11:23 AM


For the past few days I have been working on the Pong clone. I have made it before, but I wasn't satisfied with the quality of the code, so I decided to rewrite it. I guess you all are bored, because of the Pong Clones attacking you from every side, but here it is:


Well.. I think that it may be too big for such a simple game, but I am just starting to learn :)

#5056359 C++ - freeing dynamic memory

Posted by on 24 April 2013 - 08:09 AM

Hello, I was wondering about freeing the dynamic memory, when the pointer is returned by the function. Let's say I have some piece of code:

int* allocate()
     int* ptr=new int[10];
     return ptr;

int main()
     int* myPointer=allocate();
     delete [] myPointer;
     return 0;

Is this ok? I mean, is freeing the memory outside the function ok? It doesn't return exactly the same pointer, but when using "return" it creates a copy of the object, and the returns the copy.. am I correct? So myPointer points on the same place in the memory, even if it isn't "ptr".


Another example:

int* ptr1=NULL, ptr2=NULL, ptr3=NULL, ptr4=NULL;
ptr1=new int;
delete ptr4;

Am I freeing ptr1-3, when freeing ptr4?

#5050073 First breakout game

Posted by on 04 April 2013 - 02:05 PM


This my first breakout game.. I need suggestions on what to improve, what is wrong, what is totally incorrect. There are 2 levels, menu titles are awful :/ Controls: mouse.


Thanks in advance

Attached Files

#5048279 SDL - waste of time?

Posted by on 30 March 2013 - 06:05 AM


I am using SDL to learn basics of the game industry, however I will want to move to 3D games in the future. I think, that in this case, SDL is a waste of time. Won't it be better to use OpenGL or DirectX to learn the 2D games? Moving to 3D wouldn't be so hard because I would already know the library. On the other side, I am afraid that they may be too hard for the beginner. Should I keep using SDL and then learn DirectX or OpenGL from the very beginning or learn one of them right now?

#5047786 Some basic questions from beginner

Posted by on 28 March 2013 - 04:05 PM

First of all, hello everyone.

I have already made some super-basic 2D games like TicTacToe, snake and pong. I think I am starting to understand how simple games work. Collision detection in pong is simple, because there is only one ball and 2 objects that it can hit. But when I think about some simple 2D shooter game i feel confused.. Let's say I have my character, some enemies and some platforms, on which I can jump.. How am I supposed to check the collision  of every object ( me, all bullets flying, all enemies and all platforms ). When I have 1 enemy and many bullets I can store the bullets in the array and then use loop to check the collision between the enemy and every element of the array. When I have many enemies and many bullets I can use double loop.. this is the way I see it, I have no idea if it is correct. But what if I have many elements of different types? Enemies, trees, fences, cars etc.. This topic really confuses me.. I hope everything is clear.


Second question, programming side:

In my poorly written code I am mostly using numbers instead of const variables.. 

// this is my code
enemy array[10];

// this is the experienced programmers code
const int MAX_ENEMIES=10;
enemy array[MAX_ENEMIES];


what is the point of doing it?