Fromethius
Nov 10th, 2006, 04:01 PM
Alright.. I definaltly do not like this code. I like making games, and I often can finish a game exactly to my liking without asking anyone how to do something. Although I can do it, I don't like HOW I do it.
Basically, let's use Pong as an example. I use a Timer to make the ball move, and that is ok, but then I need an if statement to run every 5 milliseconds about whether or not the ball hit player one's bar. Then another for player two's bar, then another about whether or not the ball went through to bottom, another one for if it went through the top, another for changing direction. Hell, the program is running like 10 if statements every 5 milliseconds.
Let's use Snake as an example, I run an if statement every 5 milliseconds about whether or not the snake hit a piece of food, another for if it went outside the borderline, and so many others... So I am doing another 5 if statements every 5 milliseconds
I mean.. is there another way to do this? I hate the way I am coding this.. It just feels.. so.. wrong..
Also, while I'm at it, I might as well ask this, how do you make it so something cannot go through something? Like.. if I want pacman to not go through the borders of the game, the walls, etc. I prefer not to use if statements as well.. Just make it so.. it cannot go through the walls and border. i dunno if it is possible with like a property or something.. but that would be GREAT.
THANKS!!!!!!!!!!!!!!!!!!!
Basically, let's use Pong as an example. I use a Timer to make the ball move, and that is ok, but then I need an if statement to run every 5 milliseconds about whether or not the ball hit player one's bar. Then another for player two's bar, then another about whether or not the ball went through to bottom, another one for if it went through the top, another for changing direction. Hell, the program is running like 10 if statements every 5 milliseconds.
Let's use Snake as an example, I run an if statement every 5 milliseconds about whether or not the snake hit a piece of food, another for if it went outside the borderline, and so many others... So I am doing another 5 if statements every 5 milliseconds
I mean.. is there another way to do this? I hate the way I am coding this.. It just feels.. so.. wrong..
Also, while I'm at it, I might as well ask this, how do you make it so something cannot go through something? Like.. if I want pacman to not go through the borders of the game, the walls, etc. I prefer not to use if statements as well.. Just make it so.. it cannot go through the walls and border. i dunno if it is possible with like a property or something.. but that would be GREAT.
THANKS!!!!!!!!!!!!!!!!!!!