You need to change the velocity when you detect the wall, not the position!
Try this....
Code: Select all
Removed due to request from author who doesn't want anyone to pirate his game!
To be honest with you, I don't think there will be many programmers in the world who has not written a pong/breakout game. Everytime I have learned a new language the first thig I usually do is code a Pong/Breakout game.
And believe me when I say that no programmer is going to pirate/purloin/copy your code unless they are an absolute beginner!
If you do manage to write an original piece of software which uses techniques that are currently unknown then you should not post it in a forum for everyone to see!
Good Luck with your game
