ror
local obstacle = 1
function advance()
joypad.set({Down=false, A=false})
for i = 1, 14 do
emu.frameadvance()
end
end
while true do
if mainmemory.readbyte(0x1602) < 60 or mainmemory.readbyte(0x1622) < 60 then
joypad.set({Down=false})
joypad.set({A=true})
emu.frameadvance()
if mainmemory.readbyte(0x1602) < 255 and obstacle == 1 then
advance()
for i = 1, 10 do
joypad.set({Down=true})
emu.frameadvance()
end
elseif mainmemory.readbyte(0x1622) < 255 and obstacle == 2 then
advance()
for i = 1, 10 do
joypad.set({Down=true})
emu.frameadvance()
end
end
else
emu.frameadvance()
end
if obstacle == 1 then
obstacle = obstacle + 1
else
obstacle = obstacle - 1
end
end