ok merci, j'avais surement la tete ailleur, lorsque j'ai tester sonic 1, mais as tu remarquer que sa fonctionne correctement pour tails?
J'ai fait une version sonic 3 aussi, qui montre le velocity de 2 façons différentes, je trouve sa mieux.
Language: Lua
-- simple sonic 3 & knuckles speedometer display and jumpometer+
-- demonstrates reading memory and writing text,
-- as well as predicting future frames and reading memory from them
-- create space in memory for a savestate
state = savestate.create()
-- register a function to run when the screen gets updated
gui.register( function ()
-- get the X and Y velocity of the player
xvel = memory.readwordsigned(0xffb018) -- sonic the hedgehog 2
bxvel = memory.readbytesigned(0xffb018)
yvel = memory.readwordsigned(0xffb01a)
byvel = memory.readbytesigned(0xfb01a)
-- get the X and Y velocity of the player 2
txvel = memory.readwordsigned(0xffb062) -- tails (miles) prower
btxvel = memory.readbytesigned(0xffb062)
tyvel = memory.readwordsigned(0xffb064)
btyvel = memory.readbytesigned(0xffb064)
-- look 2 frames into the future, pretending the B button is held,
-- and get what the X and Y velocity of the player 2 will be
savestate.save(state)
for n=1,2 do
joypad.set(1, {B = true})
gens.emulateframeinvisible()
end
jumpxvel = memory.readwordsigned(0xffb010)
jumpyvel = memory.readwordsigned(0xffb012)
savestate.load(state)
jumpxvel2 = memory.readwordsigned(0xffb050)
jumpyvel2 = memory.readwordsigned(0xffb052)
savestate.load(state)
message = string.format("velocity: %d, %d", xvel, yvel)
gui.text(10, 60, message, "#0080FFFF", "black")
message = string.format("jump vel: %d, %d", bxvel, byvel)
gui.text(10, 70, message, "#0080FFFF", "black")
message = string.format("speed: %d", memory.readwordsigned(0xffb014))
gui.text(10, 80, message, "#0080FFFF", "black")
message = string.format("velocity: %d, %d", txvel, tyvel)
gui.text(210, 60, message, "#FFA500FF", "black")
message = string.format("velocity: %d, %d", btxvel, btxvel)
gui.text(210, 70, message, "#FFA500FF", "black")
message = string.format("speed: %d", memory.readwordsigned(0xffb054))
gui.text(210, 80, message, "#FFA500FF", "black")
message = string.format("tails jump vel: %d, %d", jumpxvel2, jumpyvel2)
gui.text(180, 30, message, "#FFFFFFFF", "black")
message = string.format("sonic jump vel: %d, %d", jumpxvel, jumpyvel)
gui.text(180, 20, message, "#FFFFFFFF", "black")
end)