Skip to content

Instantly share code, notes, and snippets.

@infval
Last active January 3, 2020 20:31
Show Gist options
  • Save infval/8b6898c1c703ebf764aa7854e3d8e8f4 to your computer and use it in GitHub Desktop.
Save infval/8b6898c1c703ebf764aa7854e3d8e8f4 to your computer and use it in GitHub Desktop.
[SMD] Toejam & Earl in Panic on Funkotron - Moving Characters [BizHawk/Lua]
local player1_x = 0x8DDC
local player1_y = 0x8DE4
local player2_x = 0x8E5C
local player2_y = 0x8E64
local player_x = player1_x
local player_y = player1_y
local step = 1
local prev_keys = {}
while true do
local x = mainmemory.read_u16_be(player_x)
local y = mainmemory.read_u16_be(player_y)
local keys = input.get()
if keys["Delete"] then
mainmemory.write_u16_be(player_x, x - step)
elseif keys["PageDown"] then
mainmemory.write_u16_be(player_x, x + step)
end
if keys["Home"] then
mainmemory.write_u16_be(player_y, y - step)
elseif keys["End"] then
mainmemory.write_u16_be(player_y, y + step)
end
if keys["Insert"] and prev_keys["Insert"] == nil then
if step > 1 then step = step - 1 end
elseif keys["PageUp"] and prev_keys["PageUp"] == nil then
if step < 32 then step = step + 1 end
end
prev_keys = keys
emu.frameadvance()
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment