Log In  

Cart #21415 | 2016-05-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

Today I was watching Roland Garros on the TV when I figured I would waste less my time playing with PICO-8 and so I did ... another pong.

The code is quite simple and should help beginners starting with PICO-8 programming

It supports different bouncing angles - I store them in a table for each pixel of the paddle (8 pixels high) :


At first, player2 (p2) was always following the ball and was unbeatable... so I modified it to only follow the ball when it is in the right half of the screen - I found this solution giving a good difficulty level - you can raise it if you increase the area where it "sees" the ball :

  -- p2 follows the ball, only if the ball is on the right side of the screen
  if (b.x>64 and p2y+4>b.y ) p2y-=1
  if (b.x>64 and p2y+4<b.y ) p2y+=1

Enjoy !

P#21421 2016-05-26 18:47 ( Edited 2016-05-30 22:56)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-06-02 14:36 | 0.014s | 2097k | Q:23