Skip to content

Instantly share code, notes, and snippets.

@pschwede
Last active June 4, 2019 21:30
Show Gist options
  • Save pschwede/617e8312d72f1914639a7ef73e0e34b6 to your computer and use it in GitHub Desktop.
Save pschwede/617e8312d72f1914639a7ef73e0e34b6 to your computer and use it in GitHub Desktop.
#nanojam Nuclear Pilot
if ¬t
// World init
player = {pos: xy(32,32), vel: xy(0,0), acc: 0.01}
landing = {pos: xy(32, 32)}
// Player
sprayOn = 0
// Upd Player
player.vel.x -= player.acc * joy.x
player.vel.y -= player.acc * joy.y
if joy.c
player.vel.x *= player.acc * 90
player.vel.y *= player.acc * 90
player.pos.x += player.vel.x
player.pos.y += player.vel.y
if player.pos.x < 0
player.pos.x += 1024
if player.pos.y < 0
player.pos.y += 1024
// Draw
clr = 23
for i < 64
pset((64*hash(i) + player.pos.x) % 64, (i + player.pos.y) % 64, 22)
pal(6)
draw(95,player.pos.x-landing.pos.x,player.pos.y-landing.pos.y,1212)
pal(2911121008001307)
draw(32,32,32,4321,0,atan(player.vel.y, player.vel.x)-½p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment