11

Cart [#36160#] | Copy | Code | 2017-01-20 | Link
11

I wrote Brick Breaker as a full-featured, polished PICO-8 sample program. It was an opportunity for me to learn the PICO-8 Lua variant and now stands as a good example program for other programmers new to PICO-8.

It demonstrates (commented) use of:

• loops
• create & destroy objects
• local vars
• text
• multiple levels
• sprite animation
• powerups
• particles
• map usage
• title screen & game over
• sound effects
• music
• sprite packing
• basic physics
• assertions

as well as some techniques for reducing token count, a limited resource on PICO-8.

I did most of this work in parallel with the 2017 Global Game Jam. The PICO-8 version of Brick Breaker is based on my JavaScript Brick Breaker sample program, which you can play here.

P#36161 2017-01-20 21:58 ( Edited 2017-07-05 21:43)

### :: daikaiju_erin

This is extremely great, thanks so much for sharing!

P#41626 2017-06-14 22:07

### :: sax3

thanks for this!

P#41695 2017-06-16 15:19

### :: phiber

Great game! Just an observation: my score goes negative pretty easily. You should consider splitting the score into two 16-bit values, high-order and low-order.

P#41993 2017-06-29 03:06

### :: arashi256

@phiber - Is this to cope with the number limit for variables? Can you explain how to do this?

P#41998 2017-06-29 05:55

### :: ianh

You could also use more bits by adding 2^-15 for each point (instead of 1), then multiplying the score value by 2^15 for display.

P#42006 2017-06-29 10:23

### :: ianh

I guess you still need to handle overflow on that multiplication, though, hmm!

P#42007 2017-06-29 10:24

### :: phiber

For starters, the score is a multiple of ten. Which means one only needs to count the score without the ones place. Internally, the "tens place" is in the ones place, and so on. When you display the score value, just draw a zero next to it. That will at least make the score not overflow until 327670, instead of 32767, which happens pretty quickly. Essentially, 10 game points equals 1 on the internal score variable, so you can represent a score 10-times larger.

P#42217 2017-07-05 21:43