Made some more progress on my DS coding. Po_Ng now has two bats and a ball. The ball bounces around the screen using this absurdly simple bit of code:
if (xpos < 0 || xpos >= 256) xv *= -1; if (ypos < 0 || ypos >= 192) yv *= -1; xpos += xv; ypos += yv;
Yeah, making stuff bounce around the screen is that simple
So simple I had to use Google to find out how…
Tomorrow I make it bounce off the bats too.
That is a very simple algorithm
– once you get the other bits of the game done you might consider having a small percentage of being able to put “french” on the ball if the bat is moving up or down so the bounce is a little more unpredictable..