Defining some constants in the beginning will help us to easily tweek the game if needed.
MAXH hold the game resolution,
MAXVX is the maximum ball velocity. I will be using
j5g3, my game engine.
This is where we define the Spritesheet. A neat trick is to include assets using data URLs. This should probably only be done with smalls images since the strings can get pretty long.
We also cut our spritesheet and setup the game sprites and text.
Here we extend the
j5g3.Map to define our
This will render the game background.
update function will take care of updating the ball position and
This is our AI function. It will basically follow the ball, and move the paddle using an accelaration factor.