Im doing a game that is a spin on the pong game, now Im doing the computer controlled bat, what I want is that the computer 'will return the ball much of the time', what I thought I could do that is by having the computer bat when the ball is in the second half of the screen, ie its side to follow the balls position, so it moves up and down to the position of the balls height.
That's what I've come up with, perhaps there are better ways, but its just what I came up with of the top of my head, how can I do this, Im learning as I go along, so I pick easy games to learn by, If one adds interesting extra features and adds some nice graphics, one can still make a nice game and learn MMF2s features as one goes along.
I was thinking more of the computer bat is set to randomly move up and down, it can miss the ball because it may be too far away to make it to the ball in time, that gives it some skill to aim at places far from the computer bat.
But I still need to know, how do I make the computer move up or down to be inline with the ball. It needs to follow the ball on the virticle, but I dont know how to do that.
Perhaps its like, if ball is in this area, if ball is above the bat move up, if ball is below the bat move down, but Im not sure how it can do a check for if the ball is above or below it.
Assault Andy Administrator
I make other people create vaporware
19th September, 2007 at 21:39:56 -
I have too much free time so I decided to make the engine, it doesn't take long.
In this example the ball is moving relatively fast so the paddle doesn't hit it back very often. Play around with the ball speed to see it return the ball more often.