User File #638328100328567940

Upload All User Files

#638328100328567940 - NES Flappy Bird

flappy-bird-nes.lua
Game: Flappy Bird ( NES, see all files )
42 downloads
Uploaded 10/13/2023 4:07 PM by TASVideoAgent (see all 129)
local sRAM=0x0037 -- game glitches around 680, 1360, 2048, 2731, 3414, 4096, 4780, 5460, 6xxx, 6826, 7502
local yRAM=0x003F
local pRAM=0x003B
local r = {0, 0, 0}
local w = {0, 0}
local s, y, p, h
while true do
	s = memory.readbyte(sRAM)
	y = memory.readbyte(yRAM)
	p = memory.readbyte(pRAM)
	t = joypad.get(1)
	if w[1] > 0 then
		w[1] = w[1]-1
	end
	if w[2] > 0 then
		w[2] = w[2]-1
	end
	if p ~= r[1] then
		w[1] = 110
		r[1] = p
	end
	if w[1] == 0 and r[2] ~= r[1] then
		r[2] = r[1]
		w[2] = 20
	end
	if w[2] == 0 and r[3] ~= r[2] then
		r[3] = r[2]
	end
	h = 85+15*r[3]
	if y > h and s ~= 255 then
		t["A"] = true
		joypad.set(1, t)
	end
	gui.text(10,9, "Pipe height: " .. h)
	emu.frameadvance()
end