User File #53667213534231635

Upload All User Files

#53667213534231635 - Tobu Tobu Girl - speed display v1.1

Tobu speed v1.1.lua
493 downloads
Uploaded 3/5/2019 9:37 PM by ThunderAxe31 (see all 111)
Script that calculates and displays the absolute vertical speed.
Also displays X position of helping in adjusting routes.
And energy left, just in case.
-- GB Tobu Tobu Girl - speed display v1.1 by ThunderAxe31

local addr_tobu_relative_x = 0xC0BB
local addr_tobu_relative_y = 0xC0BC
local addr_enemy_speed     = 0xC0BA
local addr_fly_energy      = 0xC1A2

local tobu_y_new = 0
local tobu_y_old = 0
local tobu_y_relative_speed = 0

local speed = 0

local framecount = -1

while true do
	tobu_y_new = memory.read_u8(addr_tobu_relative_y)
	tobu_y_relative_speed = tobu_y_old -tobu_y_new
	tobu_y_old = tobu_y_new
	
	speed = tobu_y_relative_speed +memory.read_u8(addr_enemy_speed)
	
	if framecount == emu.framecount()-1 then
		gui.pixelText(143, 123, string.format("S%+3i", speed), 0xFFFFFFFF, 0xFF000000 ) -- tells the speed
	end
	framecount = emu.framecount()
	
	gui.pixelText(143, 130, string.format("X%3i", memory.read_u8(addr_tobu_relative_x)), 0xFFFFFFFF, 0xFF000000 ) -- tells the X position
	gui.pixelText(143, 137, string.format("E%3i", memory.read_u8(addr_fly_energy)), 0xFFFFFFFF, 0xFF000000 )  -- tells the energy left
	
	emu.frameadvance()
end