Permalink
Browse files

Day 204

  • Loading branch information...
James Kahng James Kahng
James Kahng authored and James Kahng committed Dec 13, 2017
1 parent 5cef3a3 commit e7f54b1f7682e7b2299956c198543661e8aa2696
Showing with 17 additions and 7 deletions.
  1. +17 −7 pico8/toytrain/toytrain.p8
@@ -10,11 +10,14 @@ function _init()
gear=0
max_gear=2
frame_count=0
chug_count=0
shift_frames=2
printstuff=false
chug_frames={16,9,2}
acc=0.2
offset=8
train={{64,8,56},{72,8,64},{80,8,72}}
end
end
function move_segment(s,dir)
@@ -82,15 +85,22 @@ function adv_switch(pressed)
elseif switch_state < -1
then
switch_state=1
elseif switch_state==0
then
sfx(-1,1)
else
sfx(2,1)
end
end
function ceil(num)
return flr(num+0x0.ffff)
end
function move_train()
chug_count+=1
shift=abs(gear)
if (gear!=0 and chug_count>chug_frames[ceil(shift)])
then
chug_count=0
sfx(2)
end
frame_count+=1
if frame_count>shift_frames
then
@@ -480,7 +490,7 @@ __map__
__sfx__
000400002e5502e400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000001b050100000f0000d00016050010000f0000d00013050011000110001400180501a0001a0001a0501a00018000180501700017050170500d100180001510017000190000000013000110001300013000
01100004116501a600056500460005650216000565002600056000d50005600085000560003500056000560005600000000560000000056000000005600000000560000000056000000005600056000560000000
011000000565002600056000d50005600085000560003500056000560005600000000560000000056000000005600000000560000000056000000005600056000560000000000000000000000000000000000000
010600002200017000120000c000080000700007000010000f0000000015000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
011000002405025050260502705028050290502a0502b0502c0502d0502e0502f0503005018050190501a0501b0501c0501d0501e0501f0502005021050220502305000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

0 comments on commit e7f54b1

Please sign in to comment.