Log In  
Follow
btco
[ :: Read More :: ]

Working on a simple desktop-based PICO-8 IDE for Windows/Linux/MacOS. Features: syntax highlighting, code overview, reads/writes the P8 file format, copy/paste sprites directly to system clipboard for easy interop, large map editor.

What other features would you enjoy in a desktop IDE?

P#53698 2018-06-22 09:09 ( Edited 2018-06-22 16:28)

[ :: Read More :: ]

Cart #53250 | 2018-06-04 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

This is a short snippet showing how the water reflection effect is implemented in Pilot8.

Here is the code:

local g_rnd=nil
local g_clk=0

function _init()
 init_rnd()
end

function init_rnd()
 g_rnd={}
 for i=1,64 do
  add(g_rnd,flr(rnd(32)))
 end
end

function _update()
 g_clk+=1
end

function render_water(water_y)
 local addr_w=0x6000+64*water_y
 local addr_r=addr_w
 local rip_c=0x11
 memset(addr_w,rip_c,64)
 for y=water_y+1,127 do
  addr_w+=64
  addr_r-=(y%2)*64
  local offset=1+(flr(g_clk/4)+y)%#g_rnd
  local prand=g_rnd[offset]
  if 0~=band(prand,30) then
   memcpy(addr_w,addr_r+prand%2*64,64)
  else
   memset(addr_w,rip_c,64)
  end
 end
end

function _draw()
 cls(0)
 map(0,0)
 print("pilot8 water effect",
   band(g_clk,127),88,7)
 render_water(96)
end

Quick summary: I pre-generate some pseudo-random numbers on _init() because I want to use the same sequence every frame, shifted by the clock (to give continuity to the water animation, rather than make it random at every frame). Then, in render_water(), it's just a matter of starting at the water horizon line (water_y) and copying rows from above water to the area below the water line, one by one. Except that I move the "read" position only once every 2 frames to make the reflection "stretched", and use the pseudo-random number to vary the read position to get the "wavy" effect. Also, once in while, instead of drawing the reflection I draw a solid blue ripple line.

Feel free to reuse this code in any way you like!

P#53251 2018-06-03 22:04 ( Edited 2018-06-04 02:04)

[ :: Read More :: ]

Cart #53240 | 2018-06-03 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
18

UPDATE: Version 1.1:

  • faster ship
  • constant enemy spawns (no delays)
  • muzzle flash effect and better explosions
  • other gameplay tweaks

STORY: Welcome, Pilot 8. You are our top choice for this mission. I mean, 8th choice. Nothing suspicious at all happened to the other 7 pilots that came before you. They... uh... retired. Anyway, here is your comprehensive battle training: use the arrows to move, press [Z] to shoot. End of comprehensive training. Off to war you go. Good luck, Pilot 8.... Ok, that pilot is hopeless, let's start training Pilot 9. Oh, what? It's still on? How do I turn this off <click>

This is a simple space shooter.

  • 18 levels across 6 worlds (Flood City, Oasis, Marshes, Coast, Canals, Fortress)
  • Different weapons and powerups (shield, weapons, etc).
  • Collect chips dropped by enemies to upgrade your ship. 14 upgrades available:
    • extra speed
    • rapid fire (3 levels)
    • ammo capacity (3 levels)
    • shield (3 levels)
    • starting laser
    • powerup frequency
  • World map

Tech aspects:

  • Dynamic lighting (via framebuffer post-processing).
  • Screen-space reflection (water effect, lightning, etc).
  • Particle effects, rain, etc.
P#52927 2018-05-22 13:07 ( Edited 2018-06-27 23:35)