User File #45485586057924693

Upload All User Files

#45485586057924693 - Asterix SfD - lua

Asterix - SfD ennemi loader.lua
965 downloads
Uploaded 3/2/2018 10:31 AM by ViGadeomes (see all 9)
Originally made by zoboner and updated by me : useful to understand the cam advantage trick. Very basic, can be improved.
local function NMI_1()
local Sprite_1 = mainmemory.read_u8
local D_load_1 = mainmemory.read_u8
local X_position = mainmemory.read_u8
local Y_position = mainmemory.read_u8
local sp1 = Sprite_1 (0x0220)
local dl1 = D_load_1 (0x0221)
local x1 = X_position (0x0222)
local y1 = Y_position (0x0223)
local red = 0xFFFF0000
local no = 0x00FF0000

if sp1 > 0 and dl1 > 0
   or sp1 > 0 and dl1 == 0 then
y1 = y1 -30 ; x1 = x1 -20   
gui.drawRectangle (x1,y1,2,2,red)
elseif sp1 == 0 then 
gui.drawRectangle (x1,y1,2,2,no)
end
   end 

local function NMI_2()
local Sprite_2 = mainmemory.read_u8
local D_load_2 = mainmemory.read_u8
local X2_position = mainmemory.read_u8
local Y2_position = mainmemory.read_u8
local sp2 = Sprite_2 (0x0240)
local dl2 = D_load_2 (0x0241)
local x2 = X2_position (0x0242)
local y2 = Y2_position (0x0243)
local ora = 0xFFFF9900
local no = 0x00FF0000

if sp2 > 0 and dl2 > 0
   or sp2 > 0 and dl2 == 0 then
y2 = y2 -30 ; x2 = x2 -20      
gui.drawRectangle (x2,y2,2,2,ora)
elseif sp2 == 0 then 
gui.drawRectangle (x2,y2,2,2,no)
end
   end

local function NMI_3()
local Sprite_3 = mainmemory.read_u8
local D_load_3 = mainmemory.read_u8
local X3_position = mainmemory.read_u8
local Y3_position = mainmemory.read_u8
local sp3 = Sprite_3 (0x0260)
local dl3 = D_load_3 (0x0261)
local x3 = X3_position (0x0262)
local y3 = Y3_position (0x0263)
local pur = 0xFF990099
local no = 0x00FF0000

if sp3 > 0 and dl3 > 0
   or sp3 > 0 and dl3 == 0 then
y3 = y3 -30 ; x3 = x3 -20     
gui.drawRectangle (x3,y3,2,2,pur)
end
if sp3 == 0 then 
gui.drawRectangle (x3,y3,2,2,no)
end
   end
   
local function NMI_4()
local Sprite_4 = mainmemory.read_u8
local D_load_4= mainmemory.read_u8
local X4_position = mainmemory.read_u8
local Y4_position = mainmemory.read_u8
local sp4 = Sprite_4 (0x0280)
local dl4 = D_load_4 (0x0281)
local x4 = X4_position (0x0282)
local y4 = Y4_position (0x0283)
local blu = 0xFF3333FF
local no = 0x00FF0000

if sp4 > 0 and dl4 > 0
   or sp4 > 0 and dl4 == 0 then
y4 = y4 -30 ; x4 = x4 -20     
gui.drawRectangle (x4,y4,2,2,blu)
elseif sp4 == 0 then 
gui.drawRectangle (x4,y4,2,2,no)
end
   end

local function NMI_5()
local Sprite_5 = mainmemory.read_u8
local D_load_5 = mainmemory.read_u8
local X5_position = mainmemory.read_u8
local Y5_position = mainmemory.read_u8
local sp5 = Sprite_5 (0x02E0)
local dl5 = D_load_5 (0x02E1)
local x5 = X5_position (0x02E2)
local y5 = Y5_position (0x02E3)
local green = 0xFF00CC00
local no = 0x00FF0000

if sp5 > 0 and dl5 > 0
   or sp5 > 0 and dl5 == 0 then
y5 = y5 -30 ; x5 = x5 -20     
gui.drawRectangle (x5,y5,2,2,green)
elseif sp5 == 0 then 
gui.drawRectangle (x5,y5,2,2,no)
end
    end

local function NMI_6()
local Sprite_6 = mainmemory.read_u8
local D_load_6= mainmemory.read_u8
local X6_position = mainmemory.read_u8
local Y6_position = mainmemory.read_u8
local sp6 = Sprite_6 (0x02A0)
local dl6 = D_load_6 (0x02A1)
local x6 = X6_position (0x02A2)
local y6 = Y6_position (0x02A3)
local green = 0xFF00CC00
local no = 0x00FF0000

if sp6 > 0 and dl6 > 0
   or sp6 > 0 and dl6 == 0 then
y6 = y6 -30 ; x6 = x6 -20     
gui.drawRectangle (x6,y6,2,2,green)
elseif sp6 == 0 then 
gui.drawRectangle (x6,y6,2,2,no)
end
    end

local function NMI_7()
local Sprite_7 = mainmemory.read_u8
local D_load_7 = mainmemory.read_u8
local X7_position = mainmemory.read_u8
local Y7_position = mainmemory.read_u8
local sp7 = Sprite_7 (0x02C0)
local dl7 = D_load_7 (0x02C1)
local x7 = X7_position (0x02C2)
local y7 = Y7_position (0x02C3)
local green = 0xFF00CC00
local no = 0x00FF0000

if sp7 > 0 and dl7 > 0
   or sp7 > 0 and dl7 == 0 then
y7 = y7 -30 ; x7 = x7 -20     
gui.drawRectangle (x7,y7,2,2,green)
elseif sp7 == 0 then 
gui.drawRectangle (x7,y7,2,2,no)
end
    end	

local function NMI_8()
local Sprite_8 = mainmemory.read_u8
local D_load_8= mainmemory.read_u8
local X8_position = mainmemory.read_u8
local Y8_position = mainmemory.read_u8
local sp8 = Sprite_8 (0x0300)
local dl8 = D_load_8 (0x301)
local x8 = X8_position (0x0302)
local y8 = Y8_position (0x0303)
local green = 0xFF00CC00
local no = 0x00FF0000

if sp8 > 0 and dl8 > 0
   or sp8 > 0 and dl8 == 0 then
y8 = y8 -30 ; x8 = x8 -20     
gui.drawRectangle (x8,y8,2,2,green)
elseif sp8 == 0 then 
gui.drawRectangle (x8,y8,2,2,no)
end
    end

local function NMI_9()
local Sprite_9 = mainmemory.read_u8
local D_load_9= mainmemory.read_u8
local X9_position = mainmemory.read_u8
local Y9_position = mainmemory.read_u8
local sp9 = Sprite_9 (0x0320)
local dl9 = D_load_9 (0x0321)
local x9 = X9_position (0x0322)
local y9 = Y9_position (0x0323)
local green = 0xFF00CC00
local no = 0x00FF0000

if sp9 > 0 and dl9 > 0
   or sp9 > 0 and dl9 == 0 then
y9 = y9 -30 ; x9 = x9 -20     
gui.drawRectangle (x9,y9,2,2,green)
elseif sp9 == 0 then 
gui.drawRectangle (x9,y9,2,2,no)
end
    end	

local function NMI_10()
local Sprite_10 = mainmemory.read_u8
local D_load_10= mainmemory.read_u8
local X10_position = mainmemory.read_u8
local Y10_position = mainmemory.read_u8
local sp10 = Sprite_10 (0x0340)
local dl10 = D_load_10 (0x0341)
local x10 = X10_position (0x0342)
local y10 = Y10_position (0x0343)
local green = 0xFF00CC00
local no = 0x00FF0000

if sp10 > 0 and dl10 > 0
   or sp10 > 0 and dl10 == 0 then
y10 = y10 -30 ; x10 = x10 -20     
gui.drawRectangle (x10,y10,2,2,green)
elseif sp10 == 0 then 
gui.drawRectangle (x10,y10,2,2,no)
end
    end

local function NMI_11()
local Sprite_11 = mainmemory.read_u8
local D_load_11= mainmemory.read_u8
local X11_position = mainmemory.read_u8
local Y11_position = mainmemory.read_u8
local sp11 = Sprite_11 (0x0360)
local dl11 = D_load_11 (0x0361)
local x11 = X11_position (0x0362)
local y11 = Y11_position (0x0363)
local green = 0xFF00CC00
local no = 0x00FF0000

if sp11 > 0 and dl11 > 0
   or sp11 > 0 and dl11 == 0 then
y11 = y11 -30 ; x11 = x11 -20     
gui.drawRectangle (x11,y11,2,2,green)
elseif sp11 == 0 then 
gui.drawRectangle (x11,y11,2,2,no)
end
    end	

local function NMI_12()
local Sprite_12 = mainmemory.read_u8
local D_load_12= mainmemory.read_u8
local X12_position = mainmemory.read_u8
local Y12_position = mainmemory.read_u8
local sp12 = Sprite_12 (0x0380)
local dl12 = D_load_12 (0x0381)
local x12 = X12_position (0x0382)
local y12 = Y12_position (0x0383)
local green = 0xFF00CC00
local no = 0x00FF0000

if sp12 > 0 and dl12 > 0
   or sp12 > 0 and dl12 == 0 then
y12 = y12 -30 ; x12 = x12 -20     
gui.drawRectangle (x12,y12,2,2,green)
elseif sp12 == 0 then 
gui.drawRectangle (x12,y12,2,2,no)
end
    end

local function NMI_13()
local Sprite_13 = mainmemory.read_u8
local D_load_13= mainmemory.read_u8
local X13_position = mainmemory.read_u8
local Y13_position = mainmemory.read_u8
local sp13 = Sprite_13 (0x03A0)
local dl13 = D_load_13 (0x03A1)
local x13 = X13_position (0x03A2)
local y13 = Y13_position (0x03A3)
local green = 0xFF00CC00
local no = 0x00FF0000

if sp13 > 0 and dl13 > 0
   or sp13 > 0 and dl13 == 0 then
y13 = y13 -30 ; x13 = x13 -20     
gui.drawRectangle (x13,y13,2,2,green)
elseif sp13 == 0 then 
gui.drawRectangle (x13,y13,2,2,no)
end
    end

local function NMI_14()
local Sprite_14 = mainmemory.read_u8
local D_load_14= mainmemory.read_u8
local X14_position = mainmemory.read_u8
local Y14_position = mainmemory.read_u8
local sp14 = Sprite_14 (0x03C0)
local dl14 = D_load_14 (0x03C1)
local x14 = X14_position (0x03C2)
local y14 = Y14_position (0x03C3)
local green = 0xFF00CC00
local no = 0x00FF0000

if sp14 > 0 and dl14 > 0
   or sp14 > 0 and dl14 == 0 then
y14 = y14 -30 ; x14 = x14 -20     
gui.drawRectangle (x14,y14,2,2,green)
elseif sp14 == 0 then 
gui.drawRectangle (x14,y14,2,2,no)
end
    end
	
while true do
NMI_1()
NMI_2()
NMI_3()
NMI_4()
NMI_5()
NMI_6()
NMI_7()
NMI_8()
NMI_9()
NMI_10()
NMI_11()
NMI_12()
NMI_13()
NMI_14()
	emu.frameadvance();
end