User File #47002414143643441

Upload All User Files

#47002414143643441 -

Klonoa_RAM.lua
779 downloads
Uploaded 5/9/2018 5:59 PM by lapogne36 (see all 25)
local SPD1 = 0
local SPD2 = 0
local SPD3 = 0
local SPD
local X
local X1 = 0
local Y
local GROUND
local YSPD

--55295 (D7FF)
--max = 54271 (D3FF)
-- 53270

--15:15 15:41 15:60
--20:73 21:16 21:40
--39:85 40:30 40:45

while true do

	X = memory.read_s32_le( 0x0BF060 )
	Y = - memory.read_s32_le( 0x0BF018 )
	SPD2 = memory.read_s32_le( 0x0BF068 )
	GROUND = memory.read_u8( 0x0BF071 )
	YSPD = memory.read_s32_le( 0x10675C )
	
	if (SPD1==0 or SPD2==0)
		then 	SPD = SPD2
		else 	SPD = math.floor((SPD1+SPD2)/2)
	end
	
	SPD3 = X - X1
	
	gui.text(1, 80, "X SPEED : " .. SPD,"white")
	gui.text(1, 100, "Y SPEED : " .. YSPD,"white")
	
	gui.text(1,120,"X : " .. string.format("%6X", X), "white")
	if (Y >= 0) 
		then gui.text(1, 140, "Y : " .. string.format("%6X", Y), "white")
		else gui.text(1, 140, "Y : -" .. string.format("%6X", -Y), "white")
	end
	
	gui.text(1,160, "GROUND : " .. GROUND, "white")
	gui.text(1,180, "MAX SPD : 54271", "white")
	gui.text(1,200, SPD3, "white")
	emu.frameadvance()
	SPD1 = SPD2
	X1 = X
end