User File #43805306411011384

Upload All User Files

#43805306411011384 - LUA Master of Darkness sms

Master of Darkness (E)hitbox watcher.lua
934 downloads
Uploaded 12/16/2017 6:24 PM by zoboner (see all 35)
Watch all hitbox, Fast walk after hit visual assist, RNG breaker (only for first phase true last boss),time watcher (levels end).
Not finish to set hitbox, I doing this a later when I have a time!
local function boss_hitbox()

local State_fb= mainmemory.read_u8    --Invulnerability state
local leftORright= mainmemory.read_u8 --Verify LEFT or RIGHT position
local level= mainmemory.read_u8       --Verify LEVEL to choose BOSS fight
local round= mainmemory.read_u8       --Verify ROUND to choose BOSS fight
local Y= mainmemory.read_u8           --X coordinate
local X= mainmemory.read_u8           --Y coordinate       
local TIM = mainmemory.read_u8        --TIMER invulnerability
local Hp_boss = mainmemory.read_u8    --HEALTH points
local Pat_B = mainmemory.read_u8      --Pattern BOSS
local IOB = mainmemory.read_u8        --check if boss is at screen
local W = 25
local H = 50
local Sfb = State_fb(0x0B4D)
local LR = leftORright(0x0B30)
local L = level(0x1FC1)
local R = round(0x1FC0)
local X_pos = X(0x0B24)
local Y_pos = Y(0x0B22)
local Xx = X_pos                  
local Yy = Y_pos       
local timer = TIM(0x0B3C)
local Hp = Hp_boss(0x0B3A)
local patB = Pat_B(0x0B27)
local IoB = IOB(0x0B60)
local white = 0xFFFFFFFF
local red = 0xFFFF0000
local nob = 0x00FFFFFF


if L == 2 and R == 0 and LR == 0 and patB > 100 then                     --boss1
Xx = X_pos-2 ;Yy = Y_pos-21;W = W-3;H = H-4 
elseif L == 2 and R == 0 and LR == 1 and patB > 100 then                 --boss1
Xx = X_pos-4 ;Yy = Y_pos-19;W = W-3;H = H-4  

elseif L == 2 and R == 1 and LR == 1 and patB > 100 then                 --boss2
Xx = X_pos-2 ;Yy = Y_pos-18;W = W+2 ;H = H-12

elseif L == 2 and R == 2 and LR == 0 and patB > 100 then                 --boss3
Xx = X_pos-3;Yy = Y_pos-17;W = W-1;H = H-1  
elseif L == 2 and R == 2 and LR == 1 and patB > 100 then                 --boss3
Xx = X_pos-6 ;Yy = Y_pos-17;W = W-1 ;H = H-1 

 elseif L == 2 and R == 3 and LR == 0 and patB > 100 then                --boss4
Xx = X_pos+4  ;Yy = Y_pos-16;W = W-1;H = H-2

elseif L == 0 and R == 4 and LR == 0 and Sfb <= 113 and patB > 100 then  --boss5
Xx = X_pos+6;Yy = Y_pos-16;W = W-1;H = H-1  
elseif L == 0 and R == 4 and LR == 1 and Sfb <= 113 and patB > 100 then  --boss5
Xx = X_pos-5 ;Yy = Y_pos-15;W = W-1 ;H = H-3

elseif emu.framecount() >= 63279 then                                    --boss6
Xx = X_pos+1 ;Yy = Y_pos-18 ;W = W+2 ;H = H+15                           --boss6


end
if timer > 0 and patB > 100 and IoB == 255 then     --verify timer after hit
gui.drawRectangle(Xx,Yy,W,H,red)


elseif timer == 0 and patB > 100 and IoB == 255 then --verify state of invulnerability
gui.drawRectangle(Xx,Yy,W,H,white)

elseif Hp == 0 and IoB == 0 then 
gui.drawRectangle(Xx,Yy,W,H,nob)
end
end


local function Player_Hitbox()
local Start_Load = mainmemory.read_u8       --loading zone
local Pp = mainmemory.read_u8               --pattern
local Pxpos = mainmemory.read_u8            --X position player
local Pypos = mainmemory.read_u8            --Y position player
local LRp = mainmemory.read_u8              --check direction left or right
local Gravity_P = mainmemory.read_u8        --check the value of Gravity player
local JUMP_tim = mainmemory.read_u8         --check jump timer
local DJW_P = mainmemory.read_u8            --check the value of pattern player value 1
local DJW_P2 = mainmemory.read_u8           --check the value of pattern player value 2
local FAST_WP = mainmemory.read_u8          --check the value of pattern hit timer
local Pat_Move_P = mainmemory.read_u8       --check the value of pattern move
local SWD_sel = mainmemory.read_u8          --check sword use
local SSWD_sel = mainmemory.read_u8         --check secondary weapon use
local SLoadT = Start_Load(0x03F8) 
local SLoadF = Start_Load(0x03F8)
local Pp1 = Pp(0x0A3A)
local Pxp = Pxpos(0x0A24)
local Pyp = Pypos(0x0A22)
local LRp1 = LRp(0x0A30)
local GVT = Gravity_P(0x0A31)
local jtm = JUMP_tim(0x0A2B)
local Dp1 = DJW_P(0x0A38)
local Dp2 = DJW_P2(0x0A36)
local FWP = FAST_WP(0x0A2C)
local PMP = Pat_Move_P(0x0805)
local swd = SWD_sel(0x1FB7)
local Sswd = SSWD_sel(0x1FB8)
local red = 0xFFF11111
local green = 0xFF00FF00
local no = 0x00FFFFFF


if Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP == 0 and PMP == 0 then       --No walk
Pxp = Pxp -1 ; Pyp = Pyp - 32
gui.drawRectangle(Pxp,Pyp,19,39,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP == 0 and PMP == 0 then   --No walk
Pxp = Pxp -3 ; Pyp = Pyp - 32
gui.drawRectangle(Pxp,Pyp,19,39,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP == 0 and PMP == 2 then   --Walk
Pxp = Pxp -1 ; Pyp = Pyp - 33
gui.drawRectangle(Pxp,Pyp,17,40,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP == 0 and PMP == 2 then   --Walk
Pxp = Pxp -1 ; Pyp = Pyp - 33
gui.drawRectangle(Pxp,Pyp,17,40,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 2 and FWP >= 0 and PMP == 20 and swd == 0 then --No walk Attack 1/2 knife
Pxp = Pxp   ; Pyp = Pyp - 31
gui.drawRectangle(Pxp,Pyp,19,39,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 2 and FWP >= 0 and PMP == 20 and swd == 0 then --No walk Attack 1/2 knife
Pxp = Pxp -4  ; Pyp = Pyp - 31
gui.drawRectangle(Pxp,Pyp,19,39,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 6 and FWP >= 3 and PMP == 20 and swd == 0 then --No walk Attack 2/2 knife
Pxp = Pxp +18  ; Pyp = Pyp - 30 ; Pxp2 = Pxp ; Pyp2 = Pyp +37 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +37 ; Pxp2 = Pxp -17 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -17 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -22 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -22 ; Pxp2 = Pxp -14 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -14 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -6 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -6 ; Pxp2 = Pxp +17 ; Pyp2 = Pyp -10 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +17 ; Pyp = Pyp -10 ; Pxp2 = Pxp +14 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 6 and FWP >= 3 and PMP == 20 and swd == 0 then --No walk Attack 2/2 knife
Pxp = Pxp -2  ; Pyp = Pyp - 30 ; Pxp2 = Pxp ; Pyp2 = Pyp +37 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +37 ; Pxp2 = Pxp +17 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +17 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -22 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -22 ; Pxp2 = Pxp +14 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +14 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -6 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -6 ; Pxp2 = Pxp -17 ; Pyp2 = Pyp -10 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -17 ; Pyp = Pyp -10 ; Pxp2 = Pxp -14 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP >= 0 and FWP <= 1 and PMP == 24 and swd == 1 then --No walk Attack 1/3 hook
Pxp = Pxp +13  ; Pyp = Pyp - 32 ; Pxp2 = Pxp +5 ; Pyp2 = Pyp +39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +5 ; Pyp = Pyp +39 ; Pxp2 = Pxp -21 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -21 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -39 ; Pxp2 = Pxp +15 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP >= 0 and FWP <= 1 and PMP == 24 and swd == 1 then --No walk Attack 1/3 hook
Pxp = Pxp +2  ; Pyp = Pyp - 32 ; Pxp2 = Pxp -5 ; Pyp2 = Pyp +39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -5 ; Pyp = Pyp +39 ; Pxp2 = Pxp +21 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +21 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -39 ; Pxp2 = Pxp -15 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP > 1 and FWP < 6 and PMP == 24 and swd == 1 then --No walk Attack 2/3 hook
Pxp = Pxp +13  ; Pyp = Pyp - 32 ; Pxp2 = Pxp +5 ; Pyp2 = Pyp +39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +5 ; Pyp = Pyp +39 ; Pxp2 = Pxp -18 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -18 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -18 ; Pxp2 = Pxp -22 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -22 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -10 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -10 ; Pxp2 = Pxp +27 ; Pyp2 = Pyp -11 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +27 ; Pyp = Pyp -11 ; Pxp2 = Pxp +8 ; Pyp2 = Pyp
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red) 
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP > 1 and FWP < 6 and PMP == 24 and swd == 1 then --No walk Attack 2/3 hook
Pxp = Pxp +2  ; Pyp = Pyp - 32 ; Pxp2 = Pxp -5 ; Pyp2 = Pyp +39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -5 ; Pyp = Pyp +39 ; Pxp2 = Pxp +18 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -18 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -18 ; Pxp2 = Pxp +22 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +22 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -10 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -10 ; Pxp2 = Pxp -27 ; Pyp2 = Pyp -11 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -27 ; Pyp = Pyp -11 ; Pxp2 = Pxp -8 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP == 6 and PMP == 24 and swd == 1 then --No walk Attack 3/3 hook
Pxp = Pxp +20  ; Pyp = Pyp - 35 ; Pxp2 = Pxp ; Pyp2 = Pyp +42
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +42 ; Pxp2 = Pxp -23 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -23 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -23 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -23 ; Pxp2 = Pxp +7 ; Pyp2 = Pyp -19
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +7 ; Pyp = Pyp -19 ; Pxp2 = Pxp +15 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP == 6 and PMP == 24 and swd == 1 then --No walk Attack 3/3 hook
Pxp = Pxp -5  ; Pyp = Pyp -35 ; Pxp2 = Pxp ; Pyp2 = Pyp +42
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +42 ; Pxp2 = Pxp +23 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +23 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -23 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -23 ; Pxp2 = Pxp -7 ; Pyp2 = Pyp -19
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -7 ; Pyp = Pyp -19 ; Pxp2 = Pxp -15 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 2 and FWP >= 0 and PMP == 36 and swd == 3 then --No walk Attack 1/3 axe
Pxp = Pxp +11 ; Pyp = Pyp -29 ; Pxp2 = Pxp +8 ; Pyp2 = Pyp +36
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +8 ; Pyp = Pyp +36 ; Pxp2 = Pxp -19   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -19 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -15
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -15 ; Pxp2 = Pxp -13 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -13 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -6
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -6 ; Pxp2 = Pxp +15 ; Pyp2 = Pyp -16 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +15 ; Pyp = Pyp -16 ; Pxp2 = Pxp +9 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 2 and FWP >= 0 and PMP == 36 and swd == 3 then --No walk Attack 1/3 axe
Pxp = Pxp +4 ; Pyp = Pyp -29 ; Pxp2 = Pxp -8 ; Pyp2 = Pyp +36
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8 ; Pyp = Pyp +36 ; Pxp2 = Pxp +19   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +19 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -15
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -15 ; Pxp2 = Pxp +13 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +13 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -6
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -6 ; Pxp2 = Pxp -15 ; Pyp2 = Pyp -16 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -15 ; Pyp = Pyp -16 ; Pxp2 = Pxp -9 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP >= 3 and FWP <= 4 and PMP == 36 and swd == 3 then --No walk Attack 2/3 axe
Pxp = Pxp +27  ; Pyp = Pyp -31 ; Pxp2 = Pxp   ; Pyp2 = Pyp +6
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +6 ; Pxp2 = Pxp -8   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp +32
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +32 ; Pxp2 = Pxp -18 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp -39 ; Pxp2 = Pxp +26 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP >= 3 and FWP <= 4 and PMP == 36 and swd == 3 then --No walk Attack 2/3 axe
Pxp = Pxp -11  ; Pyp = Pyp -31 ; Pxp2 = Pxp   ; Pyp2 = Pyp +6
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +6 ; Pxp2 = Pxp +8   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +8 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp +32
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +32 ; Pxp2 = Pxp +18 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp -39 ; Pxp2 = Pxp -26 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 6 and FWP >= 5 and PMP == 36 and swd == 3 then --No walk Attack 3/3 axe
Pxp = Pxp +27  ; Pyp = Pyp -29 ; Pxp2 = Pxp   ; Pyp2 = Pyp +12
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +12 ; Pxp2 = Pxp -8   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp +24
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +24 ; Pxp2 = Pxp -18 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -37
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp -37 ; Pxp2 = Pxp +26 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 6 and FWP >= 5 and PMP == 36 and swd == 3 then --No walk Attack 3/3 axe
Pxp = Pxp -11  ; Pyp = Pyp - 29 ; Pxp2 = Pxp   ; Pyp2 = Pyp +12
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +12 ; Pxp2 = Pxp +8   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp+8 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp +24
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +24 ; Pxp2 = Pxp +18 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -37
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp -37 ; Pxp2 = Pxp -26 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 2 and FWP >= 0 and PMP == 50 and Sswd == 3 then --No walk Attack 1/4 bomb
Pxp = Pxp ; Pyp = Pyp - 31
gui.drawRectangle(Pxp,Pyp,19,38,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 2 and FWP >= 0 and PMP == 50 and Sswd == 3 then --No walk Attack 1/4 bomb
Pxp = Pxp -4 ; Pyp = Pyp - 31
gui.drawRectangle(Pxp,Pyp,19,38,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 6 and FWP >= 3 and PMP == 50 and Sswd == 3 then --No walk Attack 2/4 bomb
Pxp = Pxp -7 ; Pyp = Pyp - 31
gui.drawRectangle(Pxp,Pyp,26,38,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 6 and FWP >= 3 and PMP == 50 and Sswd == 3 then --No walk Attack 2/4 bomb
Pxp = Pxp -4 ; Pyp = Pyp - 31
gui.drawRectangle(Pxp,Pyp,26,38,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP >= 7 and FWP <= 10 and PMP == 50 and Sswd == 3 then --No walk Attack 3/4 bomb
Pxp = Pxp ; Pyp = Pyp -32
gui.drawRectangle(Pxp,Pyp,18,39,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP >= 7 and FWP <= 10 and PMP == 50 and Sswd == 3 then --No walk Attack 3/4 bomb
Pxp = Pxp -3 ; Pyp = Pyp - 32
gui.drawRectangle(Pxp,Pyp,18,39,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 14 and FWP >= 11 and PMP == 50 and Sswd == 3 then --No walk Attack 4/4 bomb
Pxp = Pxp -2 ; Pyp = Pyp - 31
gui.drawRectangle(Pxp,Pyp,22,38,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 0 and Dp1 == 40 and Dp2 == 0 and FWP <= 14 and FWP >= 11 and PMP == 50 and Sswd == 3 then --No walk Attack 4/4 bomb
Pxp = Pxp -5 ; Pyp = Pyp - 31
gui.drawRectangle(Pxp,Pyp,22,38,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 1 and Dp1 == 24 and Dp2 == 16 and FWP == 0 and PMP == 10 then --DOWN player
Pxp = Pxp -1  ; Pyp = Pyp - 19
gui.drawRectangle(Pxp,Pyp,19,26,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 1 and Dp1 == 24 and Dp2 == 16 and FWP == 0 and PMP == 10 then --DOWN player
Pxp = Pxp -4  ; Pyp = Pyp - 19
gui.drawRectangle(Pxp,Pyp,19,26,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 1 and Dp1 == 24 and Dp2 == 16 and FWP <= 2 and FWP >= 0 and PMP == 58 and swd == 0 then --DOWN player attack 1/2 knife
Pxp = Pxp -1  ; Pyp = Pyp - 18
gui.drawRectangle(Pxp,Pyp,20,25,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 1 and Dp1 == 24 and Dp2 == 16 and FWP <= 2 and FWP >= 0 and PMP == 58 and swd == 0 then --DOWN player attack 1/2 knife
Pxp = Pxp -4  ; Pyp = Pyp - 18
gui.drawRectangle(Pxp,Pyp,20,25,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 1 and Dp1 == 24 and Dp2 == 16 and FWP <= 6 and FWP >= 3 and PMP == 58 and swd == 0 then --DOWN player attack 2/2 knife
Pxp = Pxp +18  ; Pyp = Pyp - 18 ; Pxp2 = Pxp ; Pyp2 = Pyp +25 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp +25 ; Pxp2 = Pxp -18 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -5 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -5 ; Pxp2 = Pxp -14 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -14 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp - 6 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -6 ; Pxp2 = Pxp +19 ; Pyp2 = Pyp -15
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +19 ; Pyp = Pyp -15 ; Pxp2 = Pxp +13 ; Pyp2 = Pyp
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 1 and Dp1 == 24 and Dp2 == 16 and FWP <= 6 and FWP >= 3 and PMP == 58 and swd == 0 then --DOWN player attack 2/2 knife
Pxp = Pxp -3  ; Pyp = Pyp - 18 ; Pxp2 = Pxp ; Pyp2 = Pyp +25 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp +25 ; Pxp2 = Pxp +18 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -5 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -5 ; Pxp2 = Pxp +14 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +14 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp - 6 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -6 ; Pxp2 = Pxp -19 ; Pyp2 = Pyp -15
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -19 ; Pyp = Pyp -15 ; Pxp2 = Pxp -13 ; Pyp2 = Pyp
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 0 and GVT <= 1 and Dp1 == 24 and Dp2 == 16 and FWP >= 0 and FWP <= 1 and PMP == 62 and swd == 1 then --DOWN player attack 1/3 hook
Pxp = Pxp +7 ; Pyp = Pyp -19 ; Pxp2 = Pxp +12 ; Pyp2 = Pyp +21 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +12 ; Pyp = Pyp +21 ; Pxp2 = Pxp ; Pyp2 = Pyp +5
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +5 ; Pxp2 = Pxp -23 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -23 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -26
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -26 ; Pxp2 = Pxp +11 ; Pyp2 = Pyp
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 0 and GVT <= 1 and Dp1 == 24 and Dp2 == 16 and FWP >= 0 and FWP <= 1 and PMP == 62 and swd == 1 then --DOWN player attack 1/3 hook
Pxp = Pxp +8 ; Pyp = Pyp -19 ; Pxp2 = Pxp -12 ; Pyp2 = Pyp +21 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -12 ; Pyp = Pyp +21 ; Pxp2 = Pxp ; Pyp2 = Pyp +5
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +5 ; Pxp2 = Pxp +23 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +23 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -26
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -26 ; Pxp2 = Pxp -11 ; Pyp2 = Pyp
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 0 and GVT <= 1 and Dp1 == 24 and Dp2 == 16 and FWP > 1 and FWP < 6 and PMP == 62 and swd == 1 then --DOWN player attack 2/3 hook
Pxp = Pxp +7 ; Pyp = Pyp -19 ; Pxp2 = Pxp +12 ; Pyp2 = Pyp +21 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +12 ; Pyp = Pyp +21 ; Pxp2 = Pxp ; Pyp2 = Pyp +5
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +5 ; Pxp2 = Pxp -19 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -19 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -6
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -6 ; Pxp2 = Pxp -22 ; Pyp2 = Pyp
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -22 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -9
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -9 ; Pxp2 = Pxp +28 ; Pyp2 = Pyp -11
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 0 and GVT <= 1 and Dp1 == 24 and Dp2 == 16 and FWP > 1 and FWP < 6 and PMP == 62 and swd == 1 then --DOWN player attack 2/3 hook
Pxp = Pxp +8 ; Pyp = Pyp -19 ; Pxp2 = Pxp -12 ; Pyp2 = Pyp +21 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -12 ; Pyp = Pyp +21 ; Pxp2 = Pxp ; Pyp2 = Pyp +5
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +5 ; Pxp2 = Pxp +19 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +19 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -6
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -6 ; Pxp2 = Pxp +22 ; Pyp2 = Pyp
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +22 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -9
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -9 ; Pxp2 = Pxp -28 ; Pyp2 = Pyp -11
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 0 and GVT <= 1 and Dp1 == 24 and Dp2 == 16 and FWP == 6 and PMP == 62 and swd == 1 then --DOWN player attack 3/3 hook
Pxp = Pxp +24  ; Pyp = Pyp - 24 ; Pxp2 = Pxp -5 ; Pyp2 = Pyp +31 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -5 ; Pyp = Pyp +31 ; Pxp2 = Pxp -21 ; Pyp2 = Pyp
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -21 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -13 ; Pxp2 = Pxp +8 ; Pyp2 = Pyp -15
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +8 ; Pyp = Pyp -15 ; Pxp2 = Pxp +17 ; Pyp2 = Pyp -3
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 0 and GVT <= 1 and Dp1 == 24 and Dp2 == 16 and FWP == 6 and PMP == 62 and swd == 1 then --DOWN player attack 3/3 hook
Pxp = Pxp -9  ; Pyp = Pyp - 24 ; Pxp2 = Pxp +5 ; Pyp2 = Pyp +31 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +5 ; Pyp = Pyp +31 ; Pxp2 = Pxp +21 ; Pyp2 = Pyp
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +21 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -13 ; Pxp2 = Pxp -8 ; Pyp2 = Pyp -15
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8 ; Pyp = Pyp -15 ; Pxp2 = Pxp -17 ; Pyp2 = Pyp -3
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 0 and GVT <= 1 and Dp1 == 24 and Dp2 == 16 and FWP <= 2 and FWP >= 0 and PMP == 74 and swd == 3 then --DOWN player attack 1/3 axe
Pxp = Pxp +12  ; Pyp = Pyp - 17 ; Pxp2 = Pxp +6 ; Pyp2 = Pyp +19
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +6 ; Pyp = Pyp +19 ; Pxp2 = Pxp ; Pyp2 = Pyp +5
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +5 ; Pxp2 = Pxp -17 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -17 ; Pyp = Pyp ; Pxp2 = Pxp -14 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -14 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -9  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -9 ; Pxp2 = Pxp +16 ; Pyp2 = Pyp -16   
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +16 ; Pyp = Pyp -16 ; Pxp2 = Pxp +9 ; Pyp2 = Pyp    
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 0 and GVT <= 1 and Dp1 == 24 and Dp2 == 16 and FWP <= 2 and FWP >= 0 and PMP == 74 and swd == 3 then --DOWN player attack 1/3 axe
Pxp = Pxp +3  ; Pyp = Pyp - 17 ; Pxp2 = Pxp -6 ; Pyp2 = Pyp +19
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -6 ; Pyp = Pyp +19 ; Pxp2 = Pxp ; Pyp2 = Pyp +5
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +5 ; Pxp2 = Pxp +17 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +17 ; Pyp = Pyp ; Pxp2 = Pxp +14 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +14 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -9  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -9 ; Pxp2 = Pxp -16 ; Pyp2 = Pyp -16   
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -16 ; Pyp = Pyp -16 ; Pxp2 = Pxp -9 ; Pyp2 = Pyp    
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 0 and GVT <= 1 and Dp1 == 24 and Dp2 == 16 and FWP <= 4 and FWP >= 3 and PMP == 74 and swd == 3 then --DOWN player attack 2/3 axe
Pxp = Pxp +25  ; Pyp = Pyp - 22 ; Pxp2 = Pxp ; Pyp2 = Pyp +7
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +7 ; Pxp2 = Pxp -7 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -7 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp +22 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +22 ; Pxp2 = Pxp -18 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -30  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -30 ; Pxp2 = Pxp +25 ; Pyp2 = Pyp   
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 0 and GVT <= 1 and Dp1 == 24 and Dp2 == 16 and FWP <= 4 and FWP >= 3 and PMP == 74 and swd == 3 then --DOWN player attack 2/3 axe
Pxp = Pxp -10  ; Pyp = Pyp - 22 ; Pxp2 = Pxp ; Pyp2 = Pyp +7
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +7 ; Pxp2 = Pxp +7 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +7 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp +22 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +22 ; Pxp2 = Pxp +18 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -30  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -30 ; Pxp2 = Pxp -25 ; Pyp2 = Pyp   
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 0 and GVT <= 1 and Dp1 == 24 and Dp2 == 16 and FWP <= 6 and FWP >= 5 and PMP == 74 and swd == 3 then --DOWN player attack 3/3 axe
Pxp = Pxp +27  ; Pyp = Pyp - 20 ; Pxp2 = Pxp ; Pyp2 = Pyp +13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +13 ; Pxp2 = Pxp -8 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp +14 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +14 ; Pxp2 = Pxp -21 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -21 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -27  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -27 ; Pxp2 = Pxp +29 ; Pyp2 = Pyp   
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 0 and GVT <= 1 and Dp1 == 24 and Dp2 == 16 and FWP <= 6 and FWP >= 5 and PMP == 74 and swd == 3 then --DOWN player attack 3/3 axe
Pxp = Pxp -12  ; Pyp = Pyp - 20 ; Pxp2 = Pxp ; Pyp2 = Pyp +13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +13 ; Pxp2 = Pxp +8 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +8 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp +14 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +14 ; Pxp2 = Pxp +21 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +21 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -27  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -27 ; Pxp2 = Pxp -29 ; Pyp2 = Pyp   
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 1 and Dp1 == 24 and Dp2 == 16 and FWP == 0 and PMP == 12 then --DOWN player walk
Pxp = Pxp -2  ; Pyp = Pyp - 19
gui.drawRectangle(Pxp,Pyp,19,26,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 1 and Dp1 == 24 and Dp2 == 16 and FWP == 0 and PMP == 12 then --DOWN player walk
Pxp = Pxp -2  ; Pyp = Pyp - 19
gui.drawRectangle(Pxp,Pyp,19,26,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 2 and Dp1 == 32 and Dp2 == 0 and FWP == 0 and PMP == 80 and jtm >= 10 and jtm <= 12 then   --JUMP 
Pxp = Pxp +15 ; Pyp = Pyp -35  ; Pxp2 = Pxp ; Pyp2 = Pyp +33
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp +33  ; Pxp2 = Pxp -7 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8  ; Pyp = Pyp   ; Pxp2 = Pxp -6 ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -7  ; Pyp = Pyp -13  ; Pxp2 = Pxp ; Pyp2 = Pyp -21
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +15  ; Pyp = Pyp -21 ; Pxp2 = Pxp -14 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 2 and Dp1 == 32 and Dp2 == 0 and FWP == 0 and PMP == 80 and jtm >= 10 and jtm <= 12 then   --JUMP
Pxp = Pxp ; Pyp = Pyp -35  ; Pxp2 = Pxp   ; Pyp2 = Pyp +33
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp +33  ; Pxp2 = Pxp +7   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +8  ; Pyp = Pyp  ; Pxp2 = Pxp +6   ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +7  ; Pyp = Pyp -13  ; Pxp2 = Pxp    ; Pyp2 = Pyp -21
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -15  ; Pyp = Pyp -21 ; Pxp2 = Pxp +14    ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 2 and Dp1 == 32 and Dp2 == 0 and FWP == 0 and PMP == 80 and jtm >= 0 and jtm <= 10 then   --JUMP 
Pxp = Pxp +15 ; Pyp = Pyp -33  ; Pxp2 = Pxp ; Pyp2 = Pyp +33
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp   ; Pyp = Pyp +33  ; Pxp2 = Pxp -7 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8  ; Pyp = Pyp   ; Pxp2 = Pxp -6 ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -7  ; Pyp = Pyp -13  ; Pxp2 = Pxp ; Pyp2 = Pyp -21
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +15  ; Pyp = Pyp -21 ; Pxp2 = Pxp -14 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 2 and Dp1 == 32 and Dp2 == 0 and FWP == 0 and PMP == 80 and jtm >= 0 and jtm <= 10 then   --JUMP
Pxp = Pxp ; Pyp = Pyp -33 ; Pxp2 = Pxp   ; Pyp2 = Pyp +33
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp +33  ; Pxp2 = Pxp +7   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +8  ; Pyp = Pyp  ; Pxp2 = Pxp +6   ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +7  ; Pyp = Pyp -13  ; Pxp2 = Pxp    ; Pyp2 = Pyp -21
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -15  ; Pyp = Pyp -21 ; Pxp2 = Pxp +14    ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 3 and Dp1 == 32 and Dp2 == 0 and FWP == 0 and PMP == 80 and jtm >= 7 and jtm <= 11 then   --JUMP 
Pxp = Pxp +15 ; Pyp = Pyp -32  ; Pxp2 = Pxp ; Pyp2 = Pyp +33
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp   ; Pyp = Pyp +33  ; Pxp2 = Pxp -7 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8  ; Pyp = Pyp   ; Pxp2 = Pxp -6 ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -7  ; Pyp = Pyp -13  ; Pxp2 = Pxp ; Pyp2 = Pyp -21
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +15  ; Pyp = Pyp -21 ; Pxp2 = Pxp -14 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 3 and Dp1 == 32 and Dp2 == 0 and FWP == 0 and PMP == 80 and jtm >= 7 and jtm <= 11 then   --JUMP
Pxp = Pxp ; Pyp = Pyp -32  ; Pxp2 = Pxp   ; Pyp2 = Pyp +33
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp +33  ; Pxp2 = Pxp +7   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +8  ; Pyp = Pyp  ; Pxp2 = Pxp +6   ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +7  ; Pyp = Pyp -13  ; Pxp2 = Pxp    ; Pyp2 = Pyp -21
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -15  ; Pyp = Pyp -21 ; Pxp2 = Pxp +14    ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT == 3 and Dp1 == 32 and Dp2 == 0 and FWP == 0 and PMP == 80 and jtm >= 0 and jtm <= 2 then   --JUMP 
Pxp = Pxp +15 ; Pyp = Pyp -29  ; Pxp2 = Pxp ; Pyp2 = Pyp +33
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp   ; Pyp = Pyp +33  ; Pxp2 = Pxp -7 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8  ; Pyp = Pyp   ; Pxp2 = Pxp -6 ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -7  ; Pyp = Pyp -13  ; Pxp2 = Pxp ; Pyp2 = Pyp -21
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +15  ; Pyp = Pyp -21 ; Pxp2 = Pxp -14 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT == 3 and Dp1 == 32 and Dp2 == 0 and FWP == 0 and PMP == 80 and jtm >= 0 and jtm <= 2 then   --JUMP
Pxp = Pxp ; Pyp = Pyp -29  ; Pxp2 = Pxp   ; Pyp2 = Pyp +33
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp +33  ; Pxp2 = Pxp +7   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +8  ; Pyp = Pyp  ; Pxp2 = Pxp +6   ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +7  ; Pyp = Pyp -13  ; Pxp2 = Pxp    ; Pyp2 = Pyp -21
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -15  ; Pyp = Pyp -21 ; Pxp2 = Pxp +14    ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 == 32 and Dp2 == 0 and FWP == 0 and PMP == 80 then   --JUMP 
Pxp = Pxp +15 ; Pyp = Pyp -30  ; Pxp2 = Pxp ; Pyp2 = Pyp +33
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp   ; Pyp = Pyp +33  ; Pxp2 = Pxp -7 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8  ; Pyp = Pyp   ; Pxp2 = Pxp -6 ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -7  ; Pyp = Pyp -13  ; Pxp2 = Pxp ; Pyp2 = Pyp -21
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +15  ; Pyp = Pyp -21 ; Pxp2 = Pxp -14 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 == 32 and Dp2 == 0 and FWP == 0 and PMP == 80 then   --JUMP
Pxp = Pxp ; Pyp = Pyp -30  ; Pxp2 = Pxp   ; Pyp2 = Pyp +33
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp +33  ; Pxp2 = Pxp +7   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +8  ; Pyp = Pyp  ; Pxp2 = Pxp +6   ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +7  ; Pyp = Pyp -13  ; Pxp2 = Pxp    ; Pyp2 = Pyp -21
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -15  ; Pyp = Pyp -21 ; Pxp2 = Pxp +14    ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 <= 40 and Dp1 >= 32 and Dp2 == 0 and FWP >= 0 and FWP <= 2 and PMP == 82 and swd == 0 then --JUMP attack 1/2 knife
Pxp = Pxp +15 ; Pyp = Pyp -30  ; Pxp2 = Pxp ; Pyp2 = Pyp +33
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp   ; Pyp = Pyp +33  ; Pxp2 = Pxp -7 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8  ; Pyp = Pyp   ; Pxp2 = Pxp -6 ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -7  ; Pyp = Pyp -13  ; Pxp2 = Pxp ; Pyp2 = Pyp -21
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +15  ; Pyp = Pyp -21 ; Pxp2 = Pxp -14 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 <= 40 and Dp1 >= 32 and Dp2 == 0 and FWP >= 0 and FWP <= 2 and PMP == 82 and swd == 0 then --JUMP attack 1/2 knife
Pxp = Pxp  ; Pyp = Pyp -30  ; Pxp2 = Pxp   ; Pyp2 = Pyp +33
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp +33  ; Pxp2 = Pxp +7   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +8  ; Pyp = Pyp  ; Pxp2 = Pxp +6   ; Pyp2 = Pyp -13
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +7  ; Pyp = Pyp -13  ; Pxp2 = Pxp    ; Pyp2 = Pyp -21
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -15  ; Pyp = Pyp -21 ; Pxp2 = Pxp +14    ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 6 and FWP >= 3 and PMP == 82 and swd == 0 then --JUMP attack 2/2 knife
Pxp = Pxp +18  ; Pyp = Pyp - 25 ; Pxp2 = Pxp ; Pyp2 = Pyp +37 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +37 ; Pxp2 = Pxp -17 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -17 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -22 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -22 ; Pxp2 = Pxp -14 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -14 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -6 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -6 ; Pxp2 = Pxp +17 ; Pyp2 = Pyp -10 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +17 ; Pyp = Pyp -10 ; Pxp2 = Pxp +14 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 6 and FWP >= 3 and PMP == 82 and swd == 0 then --JUMP attack 2/2 knife
Pxp = Pxp -2  ; Pyp = Pyp - 25 ; Pxp2 = Pxp ; Pyp2 = Pyp +37 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +37 ; Pxp2 = Pxp +17 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +17 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -22 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -22 ; Pxp2 = Pxp +14 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +14 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -6 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -6 ; Pxp2 = Pxp -17 ; Pyp2 = Pyp -10 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -17 ; Pyp = Pyp -10 ; Pxp2 = Pxp -14 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP >= 0 and FWP <= 1 and PMP == 86 and swd == 1 then --JUMP attack 1/3 hook
Pxp = Pxp +13  ; Pyp = Pyp - 30 ; Pxp2 = Pxp +5 ; Pyp2 = Pyp +39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +5 ; Pyp = Pyp +39 ; Pxp2 = Pxp -21 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -21 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -39 ; Pxp2 = Pxp +15 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP >= 0 and FWP <= 1 and PMP == 86 and swd == 1 then --JUMP attack 1/3 hook
Pxp = Pxp +2  ; Pyp = Pyp - 30 ; Pxp2 = Pxp -5 ; Pyp2 = Pyp +39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -5 ; Pyp = Pyp +39 ; Pxp2 = Pxp +21 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +21 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -39 ; Pxp2 = Pxp -15 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP > 1 and FWP < 6 and PMP == 86 and swd == 1 then --JUMP attack 2/3 hook
Pxp = Pxp +13  ; Pyp = Pyp - 28 ; Pxp2 = Pxp +5 ; Pyp2 = Pyp +39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +5 ; Pyp = Pyp +39 ; Pxp2 = Pxp -18 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -18 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -18 ; Pxp2 = Pxp -22 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -22 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -10 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -10 ; Pxp2 = Pxp +27 ; Pyp2 = Pyp -11 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +27 ; Pyp = Pyp -11 ; Pxp2 = Pxp +8 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP > 1 and FWP < 6 and PMP == 86 and swd == 1 then --JUMP attack 2/3 hook
Pxp = Pxp +2  ; Pyp = Pyp - 30 ; Pxp2 = Pxp -5 ; Pyp2 = Pyp +39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -5 ; Pyp = Pyp +39 ; Pxp2 = Pxp +18 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -18 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -18 ; Pxp2 = Pxp +22 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +22 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -10 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -10 ; Pxp2 = Pxp -27 ; Pyp2 = Pyp -11 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -27 ; Pyp = Pyp -11 ; Pxp2 = Pxp -8 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP == 6 and PMP == 86 and swd == 1 then --JUMP attack 3/3 hook
Pxp = Pxp +20  ; Pyp = Pyp - 31 ; Pxp2 = Pxp ; Pyp2 = Pyp +42
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +42 ; Pxp2 = Pxp -23 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -23 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -23 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -23 ; Pxp2 = Pxp +7 ; Pyp2 = Pyp -19
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +7 ; Pyp = Pyp -19 ; Pxp2 = Pxp +15 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP == 6 and PMP == 86 and swd == 1 then --JUMP attack 3/3 hook
Pxp = Pxp -5  ; Pyp = Pyp - 31 ; Pxp2 = Pxp ; Pyp2 = Pyp +42
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +42 ; Pxp2 = Pxp +23 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +23 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -23 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -23 ; Pxp2 = Pxp -7 ; Pyp2 = Pyp -19
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -7 ; Pyp = Pyp -19 ; Pxp2 = Pxp -15 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 2 and FWP >= 0 and PMP == 98 and swd == 3 then --JUMP attack 1/3 axe
Pxp = Pxp +11 ; Pyp = Pyp -33 ; Pxp2 = Pxp +8 ; Pyp2 = Pyp +36
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +8 ; Pyp = Pyp +36 ; Pxp2 = Pxp -19   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -19 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -15
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -15 ; Pxp2 = Pxp -13 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -13 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -6
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -6 ; Pxp2 = Pxp +15 ; Pyp2 = Pyp -16 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +15 ; Pyp = Pyp -16 ; Pxp2 = Pxp +9 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 2 and FWP >= 0 and PMP == 98 and swd == 3 then --JUMP attack 1/3 axe
Pxp = Pxp +4 ; Pyp = Pyp -33 ; Pxp2 = Pxp -8 ; Pyp2 = Pyp +36
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8 ; Pyp = Pyp +36 ; Pxp2 = Pxp +19   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +19 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -15
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp -15 ; Pxp2 = Pxp +13 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp +13 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -6
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp ; Pyp = Pyp -6 ; Pxp2 = Pxp -15 ; Pyp2 = Pyp -16 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,green)
Pxp = Pxp -15 ; Pyp = Pyp -16 ; Pxp2 = Pxp -9 ; Pyp2 = Pyp  
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 4 and FWP >= 3 and PMP == 98 and swd == 3 then --JUMP attack 2/3 axe
Pxp = Pxp +27  ; Pyp = Pyp -33 ; Pxp2 = Pxp   ; Pyp2 = Pyp +6
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +6 ; Pxp2 = Pxp -8   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp +32
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +32 ; Pxp2 = Pxp -18 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp -39 ; Pxp2 = Pxp +26 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 4 and FWP >= 3 and PMP == 98 and swd == 3 then --JUMP attack 2/3 axe
Pxp = Pxp -11  ; Pyp = Pyp -33 ; Pxp2 = Pxp   ; Pyp2 = Pyp +6
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +6 ; Pxp2 = Pxp +8   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +8 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp +32
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +32 ; Pxp2 = Pxp +18 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -39
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp -39 ; Pxp2 = Pxp -26 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 6 and FWP >= 5 and PMP == 98 and swd == 3 then --JUMP attack 3/3 axe
Pxp = Pxp +27  ; Pyp = Pyp -31 ; Pxp2 = Pxp   ; Pyp2 = Pyp +12
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +12 ; Pxp2 = Pxp -8   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -8 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp +24
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +24 ; Pxp2 = Pxp -18 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp -18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -37
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp -37 ; Pxp2 = Pxp +26 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 6 and FWP >= 5 and PMP == 98 and swd == 3 then --JUMP attack 3/3 axe
Pxp = Pxp -11  ; Pyp = Pyp - 31 ; Pxp2 = Pxp   ; Pyp2 = Pyp +12
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +12 ; Pxp2 = Pxp +8   ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp+8 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp +24
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp ; Pyp = Pyp +24 ; Pxp2 = Pxp +18 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp +18 ; Pyp = Pyp ; Pxp2 = Pxp ; Pyp2 = Pyp -37
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
Pxp = Pxp  ; Pyp = Pyp -37 ; Pxp2 = Pxp -26 ; Pyp2 = Pyp 
gui.drawLine(Pxp,Pyp,Pxp2,Pyp2,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 2 and FWP >= 0 and PMP == 112 and Sswd == 3 then --JUMP attack 1/4 bomb
Pxp = Pxp ; Pyp = Pyp - 31
gui.drawRectangle(Pxp,Pyp,19,38,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 2 and FWP >= 0 and PMP == 112 and Sswd == 3 then --JUMP attack 1/4 bomb
Pxp = Pxp -4 ; Pyp = Pyp - 31
gui.drawRectangle(Pxp,Pyp,19,38,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 6 and FWP >= 3 and PMP == 112 and Sswd == 3 then --JUMP attack 2/4 bomb
Pxp = Pxp -7 ; Pyp = Pyp - 31
gui.drawRectangle(Pxp,Pyp,26,38,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 6 and FWP >= 3 and PMP == 112 and Sswd == 3 then --JUMP attack 2/4 bomb
Pxp = Pxp -4 ; Pyp = Pyp - 31
gui.drawRectangle(Pxp,Pyp,26,38,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP >= 7 and FWP <= 10 and PMP == 112 and Sswd == 3 then --JUMP attack 3/4 bomb
Pxp = Pxp ; Pyp = Pyp -30
gui.drawRectangle(Pxp,Pyp,18,39,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP >= 7 and FWP <= 10 and PMP == 112 and Sswd == 3 then --JUMP attack 3/4 bomb
Pxp = Pxp -3 ; Pyp = Pyp - 30
gui.drawRectangle(Pxp,Pyp,18,39,red)
elseif Pp1 > 0 and LRp1 == 1 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 14 and FWP >= 11 and PMP == 112 and Sswd == 3 then --JUMP attack 4/4 bomb
Pxp = Pxp -2 ; Pyp = Pyp - 27
gui.drawRectangle(Pxp,Pyp,22,38,red)
elseif Pp1 > 0 and LRp1 == 0 and GVT >= 2 and Dp1 == 40 and Dp2 == 0 and FWP <= 14 and FWP >= 11 and PMP == 112 and Sswd == 3 then --JUMP attack 4/4 bomb
Pxp = Pxp -6 ; Pyp = Pyp - 27
gui.drawRectangle(Pxp,Pyp,22,38,red)
elseif  Pp1 > 0 and LRp1 == 1 and GVT >= 4 and GVT <= 5 and PMP == 124 
  or Pp1 > 0 and LRp1 == 1 and GVT >= 4 and GVT <= 5 and PMP == 130 then -- up down stair
Pxp = Pxp -2  ; Pyp = Pyp - 32
gui.drawRectangle(Pxp,Pyp,18,40,red)
elseif  Pp1 > 0 and LRp1 == 0 and GVT >= 4 and GVT <= 5 and PMP == 124 
  or Pp1 > 0 and LRp1 == 0 and GVT >= 4 and GVT <= 5 and PMP == 130 then -- up down stair
Pxp = Pxp -1  ; Pyp = Pyp - 32
gui.drawRectangle(Pxp,Pyp,18,40,red)
elseif  Pp1 > 0 and LRp1 == 1 and GVT >= 4 and GVT <= 5 and PMP == 120 
  or Pp1 > 0 and LRp1 == 1 and GVT >= 4 and GVT <= 5 and PMP == 122 then -- stop on stair
Pxp = Pxp -2  ; Pyp = Pyp - 32
gui.drawRectangle(Pxp,Pyp,18,40,red)
elseif  Pp1 > 0 and LRp1 == 0 and GVT >= 4 and GVT <= 5 and PMP == 120 
  or Pp1 > 0 and LRp1 == 0 and GVT >= 4 and GVT <= 5 and PMP == 122 then -- stop on stair
Pxp = Pxp -1  ; Pyp = Pyp - 32
gui.drawRectangle(Pxp,Pyp,18,40,red)


end


if Pp1 < 1 then
gui.drawRectangle(Pxp,Pyp,18,40,no)
elseif SLoadT == 0  then 
gui.clearGraphics()



end
end


local function Enemy1_hitbox()

local score_ONoff = mainmemory.read_u8     --check if score (on/off) 
local XX = mainmemory.read_u8              --X coordinate
local YY = mainmemory.read_u8              --Y coordinate
local enemy1_hp = mainmemory.read_u8       --Health Points enemy 1
local stat1_E1 = mainmemory.read_u8        --state1
local stat2_E1 = mainmemory.read_u8        --state2
local stat3_E1 = mainmemory.read_u8        --state3
local stat4_E1 = mainmemory.read_u8        --state4
local pat_E1 = mainmemory.read_u8          --pattern select
local pat_count_E1 = mainmemory.read_u8    --pattern start count
local RES_pat_E1 = mainmemory.read_u8      --result pattern
local LR_E1 = mainmemory.read_u8           --Check if pattern is LEFT , RIGHT position
local OI_E1 = mainmemory.read_u8           --check if enemy is loaded
local Scon = score_ONoff(0x00FD)
local Ehp1 = enemy1_hp(0x0B41)
local st1E1 = stat1_E1(0x0B58)
local st2E1 = stat2_E1(0x0B59)
local st3E1 = stat3_E1(0x0B5A) 
local st4E1 = stat4_E1(0x0B5B)
local patE1 = pat_E1(0x0B47)
local PATcE1 = pat_count_E1(0x0B5F)
local RPatE1 = RES_pat_E1(0x0B5E)
local LRE1 = LR_E1(0x0B50)
local OIe1 = OI_E1(0x0B40)
local X_pos_E1 = XX(0x0B44)
local Y_pos_E1 = YY(0x0B42)
local Wgt = 10
local Hgt = 10
local blue = 0xFF006BEE
local NO = 0x000FFFFF

if Scon > 16 then
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,NO)

elseif OIe1 == 255 and Ehp1 == 1 and LRE1 == 1 and patE1 == 50 and st3E1 == 1 then                                  --Bat                                        
X_pos_E1 = X_pos_E1-1 ; Y_pos_E1 = Y_pos_E1-16 ; Wgt = Wgt+8 ; Hgt = Hgt+4   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                            
elseif OIe1 == 255 and Ehp1 == 1 and LRE1 == 0 and patE1 == 50 and st3E1 == 1 then                                  --Bat                             
X_pos_E1 = X_pos_E1-2 ; Y_pos_E1 = Y_pos_E1-16 ; Wgt = Wgt+8 ; Hgt = Hgt+4   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)
                                                   
elseif OIe1 == 255 and Ehp1 == 2 and LRE1 == 1 and st1E1 == 16 and st2E1 == 32 and st3E1 == 2 and st4E1 == 2 
  or OIe1 == 255 and Ehp1 == 2 and LRE1 == 1 and st1E1 == 16 and st2E1 == 0 and st3E1 == 2 and st4E1 == 2 then      --Dog                           
X_pos_E1 = X_pos_E1+1 ; Y_pos_E1 = Y_pos_E1-17 ; Wgt = Wgt+20 ; Hgt = Hgt+7  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                                  
elseif OIe1 == 255 and Ehp1 == 2 and LRE1 == 0 and st1E1 == 16 and st2E1 == 32 and st3E1 == 2 and st4E1 == 2 
  or OIe1 == 255 and Ehp1 == 2 and LRE1 == 0 and st1E1 == 16 and st2E1 == 0 and st3E1 == 2 and st4E1 == 2 then      --Dog                             
X_pos_E1 = X_pos_E1+1 ; Y_pos_E1 = Y_pos_E1-17 ; Wgt = Wgt+20 ; Hgt = Hgt+7  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                                  
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 1 and st1E1 == 16 and st2E1 == 32 and st3E1 == 3 and st4E1 == 3 then   --super dog       
X_pos_E1 = X_pos_E1 ; Y_pos_E1 = Y_pos_E1-17 ; Wgt = Wgt+20 ; Hgt = Hgt+7  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 0 and st1E1 == 16 and st2E1 == 32 and st3E1 == 3 and st4E1 == 3 then   --super dog       
X_pos_E1 = X_pos_E1 ; Y_pos_E1 = Y_pos_E1-17 ; Wgt = Wgt+20 ; Hgt = Hgt+7  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)
                                       
elseif OIe1 == 255 and Ehp1 == 2 and LRE1 == 1 and patE1 >= 52 and st3E1 == 2 then                                  --ghost girl                             
X_pos_E1 = X_pos_E1-4 ; Y_pos_E1 = Y_pos_E1-17 ; Wgt = Wgt+12 ; Hgt = Hgt+23  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                                  
elseif OIe1 == 255 and Ehp1 == 2 and LRE1 == 0 and patE1 == 52 and st3E1 == 2 then                                  --ghost girl             
X_pos_E1 = X_pos_E1-3 ; Y_pos_E1 = Y_pos_E1-17 ; Wgt = Wgt+12 ; Hgt = Hgt+23  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 1 and patE1 >= 52 
and st1E1 == 32 and st2E1 == 16 and st3E1 == 3 and st4E1 == 3 then                                                  --Super ghost girl                             
X_pos_E1 = X_pos_E1-4 ; Y_pos_E1 = Y_pos_E1-17 ; Wgt = Wgt+12 ; Hgt = Hgt+23  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                                 
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 0 and patE1 == 52
and st1E1 == 32 and st2E1 == 16 and st3E1 == 3 and st4E1 == 3 then                                                  --Super ghost girl             
X_pos_E1 = X_pos_E1-3 ; Y_pos_E1 = Y_pos_E1-17 ; Wgt = Wgt+12 ; Hgt = Hgt+23  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue) 
                
elseif OIe1 == 255 and Ehp1 >= 2 and LRE1 == 1 and patE1 == 53 and st3E1 >= 3 then                                  --Goblin , super goblin                            
X_pos_E1 = X_pos_E1-4 ; Y_pos_E1 = Y_pos_E1-17 ; Wgt = Wgt+10 ; Hgt = Hgt+23  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                                  
elseif OIe1 == 255 and Ehp1 >= 2 and LRE1 == 0 and patE1 == 53 and st3E1 >= 3 then                                  --Goblin , super goblin            
X_pos_E1 = X_pos_E1 ; Y_pos_E1 = Y_pos_E1-17 ; Wgt = Wgt+10 ; Hgt = Hgt+23  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                     
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 1 and patE1 <= 52 and st3E1 == 3 
and st1E1 == 40 and st2E1 == 16 and st3E1 == 3 and st4E1 == 2 
   or OIe1 == 255 and Ehp1 == 3 and LRE1 == 1 and patE1 <= 52 and st3E1 == 3 
and st1E1 == 40 and st2E1 == 0 and st3E1 == 3 and st4E1 == 2 then                                                   --Strange man                              
X_pos_E1 = X_pos_E1 ; Y_pos_E1 = Y_pos_E1-16 ; Wgt = Wgt+7 ; Hgt = Hgt+30 
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                            
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 0 and patE1 == 51 and st3E1 == 3 
and st1E1 == 40 and st2E1 == 16 and st3E1 == 3 and st4E1 == 2 
 or OIe1 == 255 and Ehp1 == 3 and LRE1 == 0 and patE1 <= 52 and st3E1 == 3 
and st1E1 == 40 and st2E1 == 0 and st3E1 == 3 and st4E1 == 2 then                                                   --Strange man                             
X_pos_E1 = X_pos_E1-1 ; Y_pos_E1 = Y_pos_E1-16 ; Wgt = Wgt+7 ; Hgt = Hgt+30 
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                           
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 1 and patE1 == 55 and st3E1 == 4 then                                  --Skeleton                              
X_pos_E1 = X_pos_E1-8 ; Y_pos_E1 = Y_pos_E1-17 ; Wgt = Wgt+15 ; Hgt = Hgt+30 
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                            
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 0 and patE1 == 55 and st3E1 == 4 then                                  --Skeleton                              
X_pos_E1 = X_pos_E1-1 ; Y_pos_E1 = Y_pos_E1-17 ; Wgt = Wgt+15 ; Hgt = Hgt+30 
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 1 and patE1 == 54 and st3E1 == 3 then                                  --Wax dolls                           
X_pos_E1 = X_pos_E1-2 ; Y_pos_E1 = Y_pos_E1-14 ; Wgt = Wgt+11 ; Hgt = Hgt+28 
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                            
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 0 and patE1 == 54 and st3E1 == 3 then                                  --Wax dolls                           
X_pos_E1 = X_pos_E1-2 ; Y_pos_E1 = Y_pos_E1-14 ; Wgt = Wgt+11 ; Hgt = Hgt+28  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 1 and patE1 >= 55 and patE1 <= 56 and st3E1 == 3 
 and st1E1 == 32 and st2E1 == 16 and st3E1 == 3 and st4E1 == 2 
  or OIe1 == 255 and Ehp1 == 3 and LRE1 == 1 and patE1 >= 55 and patE1 <= 56 and st3E1 == 3 
 and st1E1 == 32 and st2E1 == 0 and st3E1 == 3 and st4E1 == 2  then                                                 --Magician                                       
X_pos_E1 = X_pos_E1-1 ; Y_pos_E1 = Y_pos_E1-16 ; Wgt = Wgt+7 ; Hgt = Hgt+22   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                            
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 0 and patE1 >= 55 and patE1 <= 56 and st3E1 == 3 
 and st1E1 == 32 and st2E1 == 16 and st3E1 == 3 and st4E1 == 2 
  or OIe1 == 255 and Ehp1 == 3 and LRE1 == 0 and patE1 >= 55 and patE1 <= 56 and st3E1 == 3 
 and st1E1 == 32 and st2E1 == 0 and st3E1 == 3 and st4E1 == 2  then                                                 --Magician                             
X_pos_E1 = X_pos_E1-3 ; Y_pos_E1 = Y_pos_E1-16 ; Wgt = Wgt+7 ; Hgt = Hgt+22  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue) 
elseif OIe1 == 255 and Ehp1 == 1 and LRE1 == 1 and patE1 == 57 and st3E1 == 1 then                                  --Knife                                        
X_pos_E1 = X_pos_E1-2 ; Y_pos_E1 = Y_pos_E1-16 ; Wgt = Wgt ; Hgt = Hgt   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                            
elseif OIe1 == 255 and Ehp1 == 1 and LRE1 == 0 and patE1 == 57 and st3E1 == 1 then                                  --Knife                            
X_pos_E1 = X_pos_E1-2 ; Y_pos_E1 = Y_pos_E1-16 ; Wgt = Wgt ; Hgt = Hgt   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue) 
elseif OIe1 == 255 and Ehp1 == 2 and LRE1 == 1 and patE1 == 57 and st3E1 == 3 then                                  --Chair                                       
X_pos_E1 = X_pos_E1-1 ; Y_pos_E1 = Y_pos_E1-14 ; Wgt = Wgt+9 ; Hgt = Hgt+20   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                            
elseif OIe1 == 255 and Ehp1 == 2 and LRE1 == 0 and patE1 == 57 and st3E1 == 3 then                                  --Chair                            
X_pos_E1 = X_pos_E1-2 ; Y_pos_E1 = Y_pos_E1-14 ; Wgt = Wgt+9 ; Hgt = Hgt+20   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 1 and patE1 == 57 and st3E1 == 4
  or OIe1 == 255 and Ehp1 == 3 and LRE1 == 1 and patE1 == 56 and st3E1 == 4 then                                    --falcon                                       
X_pos_E1 = X_pos_E1-1 ; Y_pos_E1 = Y_pos_E1-16 ; Wgt = Wgt+24 ; Hgt = Hgt+16   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                            
elseif OIe1 == 255 and Ehp1 == 3 and LRE1 == 0 and patE1 == 57 and st3E1 == 4 
  or OIe1 == 255 and Ehp1 == 3 and LRE1 == 0 and patE1 == 56 and st3E1 == 4 then                                    --falcon                             
X_pos_E1 = X_pos_E1-2 ; Y_pos_E1 = Y_pos_E1-16 ; Wgt = Wgt+24 ; Hgt = Hgt+16   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)
elseif OIe1 == 255 and Ehp1 == 2 and LRE1 == 1 and patE1 == 58 and st3E1 == 3 then                                  --Painting pictures                                       
X_pos_E1 = X_pos_E1-2 ; Y_pos_E1 = Y_pos_E1-15 ; Wgt = Wgt+12 ; Hgt = Hgt+19  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                            
elseif OIe1 == 255 and Ehp1 == 2 and LRE1 == 0 and patE1 == 58 and st3E1 == 3 then                                  --Painting pictures                            
X_pos_E1 = X_pos_E1 ; Y_pos_E1 = Y_pos_E1-15 ; Wgt = Wgt+12 ; Hgt = Hgt+19   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue) 
elseif OIe1 == 255 and Ehp1 == 2 and LRE1 == 1 and patE1 == 58 and st3E1 == 4 then                                  --Table doomed                                        
X_pos_E1 = X_pos_E1-1 ; Y_pos_E1 = Y_pos_E1-15 ; Wgt = Wgt+20 ; Hgt = Hgt+12  
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                            
elseif OIe1 == 255 and Ehp1 == 2 and LRE1 == 0 and patE1 == 58 and st3E1 == 4 then                                  --Table doomed                           
X_pos_E1 = X_pos_E1-2 ; Y_pos_E1 = Y_pos_E1-15 ; Wgt = Wgt+20 ; Hgt = Hgt+12   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue) 
elseif OIe1 == 255 and Ehp1 == 1 and LRE1 == 1 and patE1 == 58 and st3E1 == 2 then                                  --Candle                                      
X_pos_E1 = X_pos_E1-1 ; Y_pos_E1 = Y_pos_E1-16 ; Wgt = Wgt+8 ; Hgt = Hgt+4   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue)                            
elseif OIe1 == 255 and Ehp1 == 1 and LRE1 == 0 and patE1 == 58 and st3E1 == 2 then                                  --Candle                          
X_pos_E1 = X_pos_E1-2 ; Y_pos_E1 = Y_pos_E1-16 ; Wgt = Wgt+8 ; Hgt = Hgt+4   
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,blue) 

                    
end

if Ehp1 == 0 then                              -- stop hitbox enemy 1
X_pos_E1 = X_pos_E1+1 ; Y_pos_E1 = Y_pos_E1-14       
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,NO)
elseif  Ehp1 > 0 and OIe1 == 0 then     
gui.drawRectangle(X_pos_E1,Y_pos_E1,Wgt,Hgt,NO)

end
end

local function Enemy2_hitbox()

local score_ONoff = mainmemory.read_u8     --check if score (on/off)
local XX2 = mainmemory.read_u8             --X coordinate
local YY2 = mainmemory.read_u8             --Y coordinate
local enemy2_hp = mainmemory.read_u8       --Health Points enemy 2
local stat1_E2 = mainmemory.read_u8        --state1
local stat2_E2 = mainmemory.read_u8        --state2
local stat3_E2 = mainmemory.read_u8        --state3 
local stat4_E2 = mainmemory.read_u8        --state4
local pat_E2 = mainmemory.read_u8          --pattern select
local pat_count_E2 = mainmemory.read_u8    --pattern start count
local RES_pat_E2 = mainmemory.read_u8      --result pattern
local LR_E2 = mainmemory.read_u8           --Check pattern is LEFT , RIGHT position
local OI_E2 = mainmemory.read_u8           --check if enemy is loaded
local Scon = score_ONoff(0x00FD)
local Ehp2 = enemy2_hp(0x0B61)
local st1E2 = stat1_E2(0x0B78)
local st2E2 = stat2_E2(0x0B77)
local st3E2 = stat3_E2(0x0B7A)
local st4E2 = stat4_E2(0x0B7B)
local patE2 = pat_E2(0x0B67)
local PATcE2 = pat_count_E2(0x0B7F)
local RPatE2 = RES_pat_E2(0x0B7E)
local LRE2 = LR_E2(0x0B70)
local OIe2 = OI_E2(0x0B60) 
local X_pos_E2 = XX2(0x0B64)
local Y_pos_E2 = YY2(0x0B62)
local WgtE2 = 10
local HgtE2 = 10
local purp = 0xFFFF0FFF
local NO2 = 0x000FFFFF

if Scon > 16 then
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,NO2)

elseif OIe2 == 255 and Ehp2 == 1 and LRE2 == 1 and patE2 == 50 and st3E2 == 1 then                                  --Bat                                        
X_pos_E2 = X_pos_E2-1 ; Y_pos_E2 = Y_pos_E2-16 ; WgtE2 = WgtE2+8 ; HgtE2 = HgtE2+4   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                            
elseif OIe2 == 255 and Ehp2 == 1 and LRE2 == 0 and patE2 == 50 and st3E2 == 1 then                                  --Bat                             
X_pos_E2 = X_pos_E2-2 ; Y_pos_E2 = Y_pos_E2-16 ; WgtE2 = WgtE2+8 ; HgtE2 = HgtE2+4   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                                                   
elseif OIe2 == 255 and Ehp2 == 2 and LRE2 == 1 and st1E2 == 16 and st2E2 == 32 and st3E2 == 2 and st4E2 == 2
  or OIe2 == 255 and Ehp2 == 2 and LRE2 == 1 and st1E2 == 16 and st2E2 == 0 and st3E2 == 2 and st4E2 == 2 then      --Dog                           
X_pos_E2 = X_pos_E2+1 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+20 ; HgtE2 = HgtE2+7  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                                  
elseif OIe2 == 255 and Ehp2 == 2 and LRE2 == 0 and st1E2 == 16 and st2E2 == 32 and st3E2 == 2 and st4E2 == 2
  or OIe2 == 255 and Ehp2 == 2 and LRE2 == 0 and st1E2 == 16 and st2E2 == 0 and st3E2 == 2 and st4E2 == 2 then      --Dog                             
X_pos_E2 = X_pos_E2+1 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+20 ; HgtE2 = HgtE2+7  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                                  
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 1 and st1E2 == 16 and st2E2 == 32 and st3E2 == 3 and st4E2 == 3 then   --super dog       
X_pos_E2 = X_pos_E2 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+20 ; HgtE2 = HgtE2+7  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 0 and st1E2 == 16 and st2E2 == 32 and st3E2 == 3 and st4E2 == 3 then   --super dog       
X_pos_E2 = X_pos_E2 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+20 ; HgtE2 = HgtE2+7  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)
elseif OIe2 == 255 and Ehp2 == 2 and LRE2 == 1 and patE2 >= 52 and st3E2 == 2 then                                  --ghost girl                             
X_pos_E2 = X_pos_E2-4 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+12 ; HgtE2 = HgtE2+23  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                                  
elseif OIe2 == 255 and Ehp2 == 2 and LRE2 == 0 and patE2 == 52 and st3E2 == 2 then                                  --ghost girl             
X_pos_E2 = X_pos_E2-3 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+12 ; HgtE2 = HgtE2+23  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 1 and patE2 >= 52 
and st1E2 == 32 and st2E2 == 16 and st3E2 == 3 and st4E2 == 3 then                                                  --Super ghost girl                             
X_pos_E2 = X_pos_E2-4 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+12 ; HgtE2 = HgtE2+23  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                                 
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 0 and patE2 == 52 
and st1E2 == 32 and st2E2 == 16 and st3E2 == 3 and st4E2 == 3 then                                                  --Super ghost girl             
X_pos_E2 = X_pos_E2-3 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+12 ; HgtE2 = HgtE2+23  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)            
X_pos_E2 = X_pos_E2-3 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+12 ; HgtE2 = HgtE2+23  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                    
elseif OIe2 == 255 and Ehp2 >= 2 and LRE2 == 1 and patE2 == 53 and st3E2 >= 3 then                                  --Goblin , super goblin                            
X_pos_E2 = X_pos_E2-4 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+10 ; HgtE2 = HgtE2+23  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                                  
elseif OIe2 == 255 and Ehp2 >= 2 and LRE2 == 0 and patE2 == 53 and st3E2 >= 3 then                                  --Goblin , super goblin            
X_pos_E2 = X_pos_E2 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+10 ; HgtE2 = HgtE2+23  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                     
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 1 and patE2 <= 52 and st3E2 == 3 
and st1E2 == 40 and st2E2 == 16 and st3E2 == 3 and st4E2 == 2 
   or OIe2 == 255 and Ehp2 == 3 and LRE2 == 1 and patE2 <= 52 and st3E2 == 3 
and st1E2 == 40 and st2E2 == 0 and st3E2 == 3 and st4E2 == 2 then                                                   --Strange man                                 
X_pos_E2 = X_pos_E2 ; Y_pos_E2 = Y_pos_E2-16 ; WgtE2 = WgtE2+7 ; HgtE2 = HgtE2+30 
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                            
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 0 and patE2 == 51 and st3E2 == 3 
and st1E2 == 40 and st2E2 == 16 and st3E2 == 3 and st4E2 == 2 
  or OIe2 == 255 and Ehp2 == 3 and LRE2 == 0 and patE2 == 51 and st3E2 == 3 
and st1E2 == 40 and st2E2 == 0 and st3E2 == 3 and st4E2 == 2 then                                                   --Strange man                             
X_pos_E2 = X_pos_E2-1 ; Y_pos_E2 = Y_pos_E2-16 ; WgtE2 = WgtE2+7 ; HgtE2 = HgtE2+30 
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                           
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 1 and patE2 == 55 and st3E2 == 4 then                                  --Skeleton                              
X_pos_E2 = X_pos_E2-8 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+15 ; HgtE2 = HgtE2+30 
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                            
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 0 and patE2 == 55 and st3E2 == 4 then                                  --Skeleton                              
X_pos_E2 = X_pos_E2-1 ; Y_pos_E2 = Y_pos_E2-17 ; WgtE2 = WgtE2+15 ; HgtE2 = HgtE2+30 
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 1 and patE2 == 54 and st3E2 == 3 then                                  --Wax dolls                           
X_pos_E2 = X_pos_E2-2 ; Y_pos_E2 = Y_pos_E2-14 ; WgtE2 = WgtE2+11 ; HgtE2 = HgtE2+28 
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                            
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 0 and patE2 == 54 and st3E2 == 3 then                                  --Wax dolls                           
X_pos_E2 = X_pos_E2-2 ; Y_pos_E2 = Y_pos_E2-14 ; WgtE2 = WgtE2+11 ; HgtE2 = HgtE2+28 
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 1 and patE2 >= 55 and patE2 <= 56 and st1E2 == 32 
and st2E2 == 16 and st3E2 == 3 and st4E2 == 2 
   or OIe2 == 255 and Ehp2 == 3 and LRE2 == 1 and patE2 >= 55 and patE2 <= 56 and st1E2 == 32 
        and st2E2 == 0 and st3E2 == 3 and st4E2 == 2 then                                                           --Magician                                       
X_pos_E2 = X_pos_E2-1 ; Y_pos_E2 = Y_pos_E2-16 ; WgtE2 = WgtE2+7 ; HgtE2 = HgtE2+22   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                            
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 0 and patE2 >= 55 and patE2 <= 56 and st1E2 == 32
and st2E2 == 16 and st3E2 == 3 and st4E2 == 2 
   or OIe2 == 255 and Ehp2 == 3 and LRE2 == 0 and patE2 >= 55 and patE2 <= 56 and st1E2 == 32 
        and st2E2 == 0 and st3E2 == 3 and st4E2 == 2 then                                                           --Magician                             
X_pos_E2 = X_pos_E2-3 ; Y_pos_E2 = Y_pos_E2-16 ; WgtE2 = WgtE2+7 ; HgtE2 = HgtE2+22  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp) 
elseif OIe2 == 255 and Ehp2 == 1 and LRE2 == 1 and patE2 == 57 and st3E2 == 1 then                                  --Knife                                        
X_pos_E2 = X_pos_E2-2 ; Y_pos_E2 = Y_pos_E2-16 ; WgtE2 = WgtE2 ; HgtE2 = HgtE2   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                            
elseif OIe2 == 255 and Ehp2 == 1 and LRE2 == 0 and patE2 == 57 and st3E2 == 1 then                                  --Knife                            
X_pos_E2 = X_pos_E2-2 ; Y_pos_E2 = Y_pos_E2-16 ; WgtE2 = WgtE2 ; HgtE2 = HgtE2   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp) 
elseif OIe2 == 255 and Ehp2 == 2 and LRE2 == 1 and patE2 == 57 and st3E2 == 3 then                                  --Chair                                       
X_pos_E2 = X_pos_E2-1 ; Y_pos_E2 = Y_pos_E2-14 ; WgtE2 = WgtE2+9 ; HgtE2 = HgtE2+20   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                            
elseif OIe2 == 255 and Ehp2 == 2 and LRE2 == 0 and patE2 == 57 and st3E2 == 3 then                                  --Chair                            
X_pos_E2 = X_pos_E2-2 ; Y_pos_E2 = Y_pos_E2-14 ; WgtE2 = WgtE2+9 ; HgtE2 = HgtE2+20   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 1 and patE2 == 57 and st3E2 == 4
  or OIe2 == 255 and Ehp2 == 3 and LRE2 == 1 and patE2 == 56 and st3E2 == 4 then                                    --falcon                                       
X_pos_E2 = X_pos_E2-1 ; Y_pos_E2 = Y_pos_E2-16 ; WgtE2 = WgtE2+24 ; HgtE2 = HgtE2+16   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                            
elseif OIe2 == 255 and Ehp2 == 3 and LRE2 == 0 and patE2 == 57 and st3E2 == 4 
  or OIe2 == 255 and Ehp2 == 3 and LRE2 == 0 and patE2 == 56 and st3E2 == 4 then                                    --falcon                             
X_pos_E2 = X_pos_E2-2 ; Y_pos_E2 = Y_pos_E2-16 ; WgtE2 = WgtE2+24 ; HgtE2 = HgtE2+16   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)
elseif OIe2 == 255 and Ehp2 == 2 and LRE2 == 1 and patE2 == 58 and st3E2 == 3 then                                  --Painting pictures                                       
X_pos_E2 = X_pos_E2-2 ; Y_pos_E2 = Y_pos_E2-15 ; WgtE2 = WgtE2+12 ; HgtE2 = HgtE2+19  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                            
elseif OIe2 == 255 and Ehp2 == 2 and LRE2 == 0 and patE2 == 58 and st3E2 == 3 then                                  --Painting pictures                            
X_pos_E2 = X_pos_E2 ; Y_pos_E2 = Y_pos_E2-15 ; WgtE2 = WgtE2+12 ; HgtE2 = HgtE2+19   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp) 
elseif OIe2 == 255 and Ehp2 == 2 and LRE2 == 1 and patE2 == 58 and st3E2 == 4 then                                  --Table doomed                                        
X_pos_E2 = X_pos_E2-1 ; Y_pos_E2 = Y_pos_E2-15 ; WgtE2 = WgtE2+20 ; HgtE2 = HgtE2+12   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                            
elseif OIe2 == 255 and Ehp2 == 2 and LRE2 == 0 and patE2 == 58 and st3E2 == 4 then                                  --Table doomed                           
X_pos_E2 = X_pos_E2-2 ; Y_pos_E2 = Y_pos_E2-15 ; WgtE2 = WgtE2+20 ; HgtE2 = HgtE2+12  
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp) 
elseif OIe2 == 255 and Ehp2 == 1 and LRE2 == 1 and patE2 == 58 and st3E2 == 2 then                                  --Candle                                      
X_pos_E2 = X_pos_E2-1 ; Y_pos_E2 = Y_pos_E2-16 ; WgtE2 = WgtE2+8 ; HgtE2 = HgtE2+4   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                            
elseif OIe2 == 255 and Ehp2 == 1 and LRE2 == 0 and patE2 == 58 and st3E2 == 2 then                                  --Candle                          
X_pos_E2 = X_pos_E2-2 ; Y_pos_E2 = Y_pos_E2-16 ; WgtE2 = WgtE2+8 ; HgtE2 = HgtE2+4   
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,purp)                      

end

if Ehp2 == 0 then                              -- stop hitbox enemy2
X_pos_E2 = X_pos_E2+1 ; Y_pos_E2 = Y_pos_E2-14       
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,NO2)
elseif Ehp2 > 0 and OIe2 == 0 then
gui.drawRectangle(X_pos_E2,Y_pos_E2,WgtE2,HgtE2,NO2)

end
end

local function Enemy3_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX3 = mainmemory.read_u8              --X coordinate
local YY3 = mainmemory.read_u8              --Y coordinate
local enemy3_hp = mainmemory.read_u8        --Health Points enemy 3
local stat1_E3 = mainmemory.read_u8         --state1
local stat2_E3 = mainmemory.read_u8         --state2
local stat3_E3 = mainmemory.read_u8         --state3
local stat4_E3 = mainmemory.read_u8         --state4
local pat_E3 = mainmemory.read_u8           --pattern select
local pat_count_E3 = mainmemory.read_u8     --pattern start count
local RES_pat_E3 = mainmemory.read_u8       --result pattern
local LR_E3 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E3 = mainmemory.read_u8            --check if enemy is loaded
local Scon = score_ONoff(0x00FD)
local Ehp3 = enemy3_hp(0x0BE1)
local st1E3 = stat1_E3(0x0BF8)
local st2E3 = stat2_E3(0x0BF9)
local st3E3 = stat3_E3(0x0BFA)
local st4E3 = stat4_E3(0x0BFB)
local patE3 = pat_E3(0x0BE7)
local PATcE3 = pat_count_E3(0x0BFF)
local RPatE3 = RES_pat_E3(0x0BFE)
local LRE3 = LR_E3(0x0BF0)
local OIe3 = OI_E3(0x0BE0)
local X_pos_E3 = XX3(0x0BE4)
local Y_pos_E3 = YY3(0x0BE2)
local WgtE3 = 10
local HgtE3 = 10
local green = 0xABABFFFF
local NO3 = 0x000FFFFF

if Scon > 16 then
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,NO3)

elseif OIe3 == 255 and Ehp3 == 1 and LRE3 == 1 and patE3 == 50 and st3E3 == 1 then                   --Bat                                        
X_pos_E3 = X_pos_E3-1 ; Y_pos_E3 = Y_pos_E3-16 ; WgtE3 = WgtE3+8 ; HgtE3 = HgtE3+4   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                            
elseif OIe3 == 255 and Ehp3 == 1 and LRE3 == 0 and patE3 == 50 and st3E3 == 1 then                   --Bat                             
X_pos_E3 = X_pos_E3-2 ; Y_pos_E3 = Y_pos_E3-16 ; WgtE3 = WgtE3+8 ; HgtE3 = HgtE3+4   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                                                   
elseif OIe3 == 255 and Ehp3 == 2 and LRE3 == 1 and st1E3 == 16 and st2E3 == 32 and st3E3 == 2 and st4E3 == 2 
  or OIe3 == 255 and Ehp3 == 2 and LRE3 == 1 and st1E3 == 16 and st2E3 == 0 and st3E3 == 2 and st4E3 == 2 then  --Dog                           
X_pos_E3 = X_pos_E3+1 ; Y_pos_E3 = Y_pos_E3-17 ; WgtE3 = WgtE3+20 ; HgtE3 = HgtE3+7  
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                                  
elseif OIe3 == 255 and Ehp3 == 2 and LRE3 == 0 and st1E3 == 16 and st2E3 == 32 and st3E3 == 2 and st4E3 == 2 
  or OIe3 == 255 and Ehp3 == 2 and LRE3 == 0 and st1E3 == 16 and st2E3 == 0 and st3E3 == 2 and st4E3 == 2 then  --Dog                             
X_pos_E3 = X_pos_E3+1 ; Y_pos_E3 = Y_pos_E3-17 ; WgtE3 = WgtE3+20 ; HgtE3 = HgtE3+7  
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                                  
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 1 and st1E3 == 16 and st2E3 == 32 and st3E3 == 3 and st4E3 == 3 then  --super dog       
X_pos_E3 = X_pos_E3 ; Y_pos_E3 = Y_pos_E3-17 ; WgtE3 = WgtE3+20 ; HgtE3 = HgtE3+7  
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 0 and st1E3 == 16 and st2E3 == 32 and st3E3 == 3 and st4E3 == 3 then  --super dog       
X_pos_E3 = X_pos_E3 ; Y_pos_E3 = Y_pos_E3-17 ; WgtE3 = WgtE3+20 ; HgtE3 = HgtE3+7  
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)
elseif OIe3 == 255 and Ehp3 == 2 and LRE3 == 1 and patE3 >= 52 and st3E3 == 2 then                                 --ghost girl                             
X_pos_E3 = X_pos_E3-4 ; Y_pos_E3 = Y_pos_E3-17 ; WgtE3 = WgtE3+12 ; HgtE3 = HgtE3+23  
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                                  
elseif OIe3 == 255 and Ehp3 == 2 and LRE3 == 0 and patE3 == 52 and st3E3 == 2 then                                 --ghost girl             
X_pos_E3 = X_pos_E3-3 ; Y_pos_E3 = Y_pos_E3-17 ; WgtE3 = WgtE3+12 ; HgtE3 = HgtE3+23  
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 1 and patE3 >= 52 
and st1E3 == 32 and st2E3 == 16 and st3E3 == 3 and st4E3 == 3 then                                                 --Super ghost girl                             
X_pos_E3 = X_pos_E3-4 ; Y_pos_E3 = Y_pos_E3-17 ; WgtE3 = WgtE3+12 ; HgtE3 = HgtE3+23  
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                                 
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 0 and patE3 == 52  
and st1E3 == 32 and st2E3 == 16 and st3E3 == 3 and st4E3 == 3 then                                                 --Super ghost girl             
X_pos_E3 = X_pos_E3-3 ; Y_pos_E3 = Y_pos_E3-17 ; WgtE3 = WgtE3+12 ; HgtE3 = HgtE3+23  
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)    
elseif OIe3 == 255 and Ehp3 >= 2 and LRE3 == 1 and patE3 == 53 and st3E3 >= 3 then                   --Goblin , super goblin                            
X_pos_E3 = X_pos_E3-4 ; Y_pos_E3 = Y_pos_E3-17 ; WgtE3 = WgtE3+10 ; HgtE3 = HgtE3+23  
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                                  
elseif OIe3 == 255 and Ehp3 >= 2 and LRE3 == 0 and patE3 == 53 and st3E3 >= 3 then                   --Goblin , super goblin            
X_pos_E3 = X_pos_E3 ; Y_pos_E3 = Y_pos_E3-17 ; WgtE3 = WgtE3+10 ; HgtE3 = HgtE3+23  
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                     
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 1 and patE3 <= 52 and st3E3 == 3 
and st1E3 == 40 and st2E3 == 16 and st3E3 == 3 and st4E3 == 2
  or OIe3 == 255 and Ehp3 == 3 and LRE3 == 1 and patE3 <= 52 and st3E3 == 3 
and st1E3 == 40 and st2E3 == 0 and st3E3 == 3 and st4E3 == 2 then                                   --Strange man                                 
X_pos_E3 = X_pos_E3 ; Y_pos_E3 = Y_pos_E3-16 ; WgtE3 = WgtE3+7 ; HgtE3 = HgtE3+30 
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                            
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 0 and patE3 == 51 and st3E3 == 3 
and st1E3 == 40 and st2E3 == 16 and st3E3 == 3 and st4E3 == 2 
  or OIe3 == 255 and Ehp3 == 3 and LRE3 == 0 and patE3 <= 52 and st3E3 == 3 
and st1E3 == 40 and st2E3 == 0 and st3E3 == 3 and st4E3 == 2 then                                   --Strange man                             
X_pos_E3 = X_pos_E3-1 ; Y_pos_E3 = Y_pos_E3-16 ; WgtE3 = WgtE3+7 ; HgtE3 = HgtE3+30 
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                           
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 1 and patE3 == 55 and st3E3 == 4 then                   --Skeleton                              
X_pos_E3 = X_pos_E3-8 ; Y_pos_E3 = Y_pos_E3-17 ; WgtE3 = WgtE3+15 ; HgtE3 = HgtE3+30 
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                            
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 0 and patE3 == 55 and st3E3 == 4 then                   --Skeleton                              
X_pos_E3 = X_pos_E3-1 ; Y_pos_E3 = Y_pos_E3-17 ; WgtE3 = WgtE3+15 ; HgtE3 = HgtE3+30 
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 1 and patE3 == 54 and st3E3 == 3 then                  --Wax dolls                           
X_pos_E3 = X_pos_E3-2 ; Y_pos_E3 = Y_pos_E3-14 ; WgtE3 = WgtE3+11 ; HgtE3 = HgtE3+28 
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                            
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 0 and patE3 == 54 and st3E3 == 3 then                   --Wax dolls                           
X_pos_E3 = X_pos_E3-2 ; Y_pos_E3 = Y_pos_E3-14 ; WgtE3 = WgtE3+11 ; HgtE3 = HgtE3+28 
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 1 and patE3 >= 55 and patE3 <= 56 and st3E3 == 3 
 and st1E3 == 32 and st2E3 == 16 and st3E3 == 3 and st4E3 == 2 
  or OIe3 == 255 and Ehp3 == 3 and LRE3 == 1 and patE3 >= 55 and patE3 <= 56 and st3E3 == 3 
 and st1E3 == 32 and st2E3 == 0 and st3E3 == 3 and st4E3 == 2 then                                  --Magician                                       
X_pos_E3 = X_pos_E3-1 ; Y_pos_E3 = Y_pos_E3-16 ; WgtE3 = WgtE3+7 ; HgtE3 = HgtE3+22   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                            
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 0 and patE3 >= 55 and patE3 <= 56 and st3E3 == 3 
 and st1E3 == 32 and st2E3 == 16 and st3E3 == 3 and st4E3 == 2 
  or OIe3 == 255 and Ehp3 == 3 and LRE3 == 0 and patE3 >= 55 and patE3 <= 56 and st3E3 == 3 
 and st1E3 == 32 and st2E3 == 0 and st3E3 == 3 and st4E3 == 2 then                                  --Magician                             
X_pos_E3 = X_pos_E3-3 ; Y_pos_E3 = Y_pos_E3-16 ; WgtE3 = WgtE3+7 ; HgtE3 = HgtE3+22  
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green) 
elseif OIe3 == 255 and Ehp3 == 1 and LRE3 == 1 and patE3 == 57 and st3E3 == 1 then                   --Knife                                        
X_pos_E3 = X_pos_E3-2 ; Y_pos_E3 = Y_pos_E3-16 ; WgtE3 = WgtE3 ; HgtE3 = HgtE3   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                            
elseif OIe3 == 255 and Ehp3 == 1 and LRE3 == 0 and patE3 == 57 and st3E3 == 1 then                   --Knife                            
X_pos_E3 = X_pos_E3-2 ; Y_pos_E3 = Y_pos_E3-16 ; WgtE3 = WgtE3 ; HgtE3 = HgtE3   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green) 
elseif OIe3 == 255 and Ehp3 == 2 and LRE3 == 1 and patE3 == 57 and st3E3 == 3 then                   --Chair                                       
X_pos_E3 = X_pos_E3-1 ; Y_pos_E3 = Y_pos_E3-14 ; WgtE3 = WgtE3+9 ; HgtE3 = HgtE3+20   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                            
elseif OIe3 == 255 and Ehp3 == 2 and LRE3 == 0 and patE3 == 57 and st3E3 == 3 then                   --Chair                            
X_pos_E3 = X_pos_E3-2 ; Y_pos_E3 = Y_pos_E3-14 ; WgtE3 = WgtE3+9 ; HgtE3 = HgtE3+20   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 1 and patE3 == 57 and st3E3 == 4
  or OIe3 == 255 and Ehp3 == 3 and LRE3 == 1 and patE3 == 56 and st3E3 == 4 then                     --falcon                                       
X_pos_E3 = X_pos_E3-1 ; Y_pos_E3 = Y_pos_E3-16 ; WgtE3 = WgtE3+24 ; HgtE3 = HgtE3+16   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                            
elseif OIe3 == 255 and Ehp3 == 3 and LRE3 == 0 and patE3 == 57 and st3E3 == 4 
  or OIe3 == 255 and Ehp3 == 3 and LRE3 == 0 and patE3 == 56 and st3E3 == 4 then                     --falcon                             
X_pos_E3 = X_pos_E3-2 ; Y_pos_E3 = Y_pos_E3-16 ; WgtE3 = WgtE3+24 ; HgtE3 = HgtE3+16   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)
elseif OIe3 == 255 and Ehp3 == 2 and LRE3 == 1 and patE3 == 58 and st3E3 == 3 then                   --Painting pictures                                       
X_pos_E3 = X_pos_E3-2 ; Y_pos_E3 = Y_pos_E3-15 ; WgtE3 = WgtE3+12 ; HgtE3 = HgtE3+19  
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                            
elseif OIe3 == 255 and Ehp3 == 2 and LRE3 == 0 and patE3 == 58 and st3E3 == 3 then                   --Painting pictures                            
X_pos_E3 = X_pos_E3 ; Y_pos_E3 = Y_pos_E3-15 ; WgtE3 = WgtE3+12 ; HgtE3 = HgtE3+19   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green) 
elseif OIe3 == 255 and Ehp3 == 2 and LRE3 == 1 and patE3 == 58 and st3E3 == 4 then                   --Table doomed                                        
X_pos_E3 = X_pos_E3-1 ; Y_pos_E3 = Y_pos_E3-15 ; WgtE3 = WgtE3+20 ; HgtE3 = HgtE3+12   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                            
elseif OIe3 == 255 and Ehp3 == 2 and LRE3 == 0 and patE3 == 58 and st3E3 == 4 then                   --Table doomed                           
X_pos_E3 = X_pos_E3-2 ; Y_pos_E3 = Y_pos_E3-15 ; WgtE3 = WgtE3+20 ; HgtE3 = HgtE3+12   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green) 
elseif OIe3 == 255 and Ehp3 == 1 and LRE3 == 1 and patE3 == 58 and st3E3 == 2 then                   --Candle                                      
X_pos_E3 = X_pos_E3-1 ; Y_pos_E3 = Y_pos_E3-16 ; WgtE3 = WgtE3+8 ; HgtE3 = HgtE3+4   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                            
elseif OIe3 == 255 and Ehp3 == 1 and LRE3 == 0 and patE3 == 58 and st3E3 == 2 then                   --Candle                          
X_pos_E3 = X_pos_E3-2 ; Y_pos_E3 = Y_pos_E3-16 ; WgtE3 = WgtE3+8 ; HgtE3 = HgtE3+4   
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,green)                      

end

if Ehp3 == 0 then                              -- stop hitbox enemy3
X_pos_E3 = X_pos_E3+1 ; Y_pos_E3 = Y_pos_E3-14       
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,NO3)
elseif Ehp3 > 0 and OIe3 == 0 then
gui.drawRectangle(X_pos_E3,Y_pos_E3,WgtE3,HgtE3,NO3)

end
end

local function Enemy4_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX4 = mainmemory.read_u8              --X coordinate
local YY4 = mainmemory.read_u8              --Y coordinate
local enemy4_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E4 = mainmemory.read_u8         --state1 
local stat2_E4 = mainmemory.read_u8         --state2
local stat3_E4 = mainmemory.read_u8         --state3 
local stat4_E4 = mainmemory.read_u8         --state4 
local pat_E4 = mainmemory.read_u8           --pattern select
local pat_count_E4 = mainmemory.read_u8     --pattern start count
local RES_pat_E4 = mainmemory.read_u8       --result pattern
local LR_E4 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E4 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp4 = enemy4_hp(0x0BC1)
local st1E4 = stat1_E4(0x0BD8)
local st2E4 = stat2_E4(0x0BD9)
local st3E4 = stat3_E4(0x0BDA)
local st4E4 = stat4_E4(0x0BDB)
local patE4 = pat_E4(0x0BC7)
local PATcE4 = pat_count_E4(0x0BDF)
local RpatE4 = RES_pat_E4(0x0BDE)
local LRE4 = LR_E4(0x0BD0)
local OIe4 = OI_E4(0x0BC0) 
local X_pos_E4 = XX4(0x0BC4)
local Y_pos_E4 = YY4(0x0BC2)
local WgtE4 = 10
local HgtE4 = 10
local yel = 0xFFFFFF99
local NO4 = 0x000FFFFF

if Scon > 16 then
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,NO4)

elseif OIe4 == 255 and Ehp4 == 1 and LRE4 == 1 and patE4 == 50 and st3E4 == 1 then                       --Bat                                        
X_pos_E4 = X_pos_E4-1 ; Y_pos_E4 = Y_pos_E4-16 ; WgtE4 = WgtE4+8 ; HgtE4 = HgtE4+4   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                            
elseif OIe4 == 255 and Ehp4 == 1 and LRE4 == 0 and patE4 == 50 and st3E4 == 1 then                   --Bat                             
X_pos_E4 = X_pos_E4-2 ; Y_pos_E4 = Y_pos_E4-16 ; WgtE4 = WgtE4+8 ; HgtE4 = HgtE4+4   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                                                   
elseif OIe4 == 255 and Ehp4 == 2 and LRE4 == 1 and st1E4 == 16 and st2E4 == 32 and st3E4 == 2 and st4E4 == 2 
  or OIe4 == 255 and Ehp4 == 2 and LRE4 == 1 and st1E4 == 16 and st2E4 == 0 and st3E4 == 2 and st4E4 == 2 then  --Dog                           
X_pos_E4 = X_pos_E4+1 ; Y_pos_E4 = Y_pos_E4-17 ; WgtE4 = WgtE4+20 ; HgtE4 = HgtE4+7  
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                                  
elseif OIe4 == 255 and Ehp4 == 2 and LRE4 == 0 and st1E4 == 16 and st2E4 == 32 and st3E4 == 2 and st4E4 == 2 
  or OIe4 == 255 and Ehp4 == 2 and LRE4 == 0 and st1E4 == 16 and st2E4 == 0 and st3E4 == 2 and st4E4 == 2 then  --Dog                             
X_pos_E4 = X_pos_E4+1 ; Y_pos_E4 = Y_pos_E4-17 ; WgtE4 = WgtE4+20 ; HgtE4 = HgtE4+7  
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                                  
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 1 and st1E4 == 16 and st2E4 == 32 and st3E4 == 3 and st4E4 == 3 then  --super dog       
X_pos_E4 = X_pos_E4 ; Y_pos_E4 = Y_pos_E4-17 ; WgtE4 = WgtE4+20 ; HgtE4 = HgtE4+7  
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 0 and st1E4 == 16 and st2E4 == 32 and st3E4 == 3 and st4E4 == 3 then  --super dog       
X_pos_E4 = X_pos_E4 ; Y_pos_E4 = Y_pos_E4-17 ; WgtE4 = WgtE4+20 ; HgtE4 = HgtE4+7  
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)
elseif OIe4 == 255 and Ehp4 == 2 and LRE4 == 1 and patE4 >= 52 and st3E4 == 2 then                                 --ghost girl                             
X_pos_E4 = X_pos_E4-4 ; Y_pos_E4 = Y_pos_E4-17 ; WgtE4 = WgtE4+12 ; HgtE4 = HgtE4+23  
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                                  
elseif OIe4 == 255 and Ehp4 == 2 and LRE4 == 0 and patE4 == 52 and st3E4 == 2 then                                 --ghost girl             
X_pos_E4 = X_pos_E4-3 ; Y_pos_E4 = Y_pos_E4-17 ; WgtE4 = WgtE4+12 ; HgtE4 = HgtE4+23  
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 1 and patE4 >= 52  
and st1E4 == 32 and st2E4 == 16 and st3E4 == 3 and st4E4 == 3 then                                                 --Super ghost girl                             
X_pos_E4 = X_pos_E4-4 ; Y_pos_E4 = Y_pos_E4-17 ; WgtE4 = WgtE4+12 ; HgtE4 = HgtE4+23  
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                                 
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 0 and patE4 == 52 
and st1E4 == 32 and st2E4 == 16 and st3E4 == 3 and st4E4 == 3 then                                                 --Super ghost girl             
X_pos_E4 = X_pos_E4-3 ; Y_pos_E4 = Y_pos_E4-17 ; WgtE4 = WgtE4+12 ; HgtE4 = HgtE4+23  
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                     
elseif OIe4 == 255 and Ehp4 >= 2 and LRE4 == 1 and patE4 == 53 and st3E4 >= 3 then                   --Goblin , super goblin                            
X_pos_E4 = X_pos_E4-4 ; Y_pos_E4 = Y_pos_E4-17 ; WgtE4 = WgtE4+10 ; HgtE4 = HgtE4+23  
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                                  
elseif OIe4 == 255 and Ehp4 >= 2 and LRE4 == 0 and patE4 == 53 and st3E4 >= 3 then                   --Goblin , super goblin            
X_pos_E4 = X_pos_E4 ; Y_pos_E4 = Y_pos_E4-17 ; WgtE4 = WgtE4+10 ; HgtE4 = HgtE4+23  
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                     
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 1 and patE4 <= 52 and st3E4 == 3 
and st1E4 == 40 and st2E4 == 16 and st3E4 == 3 and st4E4 == 2 
  or OIe4 == 255 and Ehp4 == 3 and LRE4 == 1 and patE4 <= 52 and st3E4 == 3 
and st1E4 == 40 and st2E4 == 0 and st3E4 == 3 and st4E4 == 2 then                                                    --Strange man                               
X_pos_E4 = X_pos_E4 ; Y_pos_E4 = Y_pos_E4-16 ; WgtE4 = WgtE4+7 ; HgtE4 = HgtE4+30 
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                            
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 0 and patE4 == 51 and st3E4 == 3  
and st1E4 == 40 and st2E4 == 16 and st3E4 == 3 and st4E4 == 2 
  or OIe4 == 255 and Ehp4 == 3 and LRE4 == 0 and patE4 <= 52 and st3E4 == 3 
and st1E4 == 40 and st2E4 == 0 and st3E4 == 3 and st4E4 == 2 then                                                    --Strange man                            
X_pos_E4 = X_pos_E4-1 ; Y_pos_E4 = Y_pos_E4-16 ; WgtE4 = WgtE4+7 ; HgtE4 = HgtE4+30 
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                           
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 1 and patE4 == 55 and st3E4 == 4 then                   --Skeleton                              
X_pos_E4 = X_pos_E4-8 ; Y_pos_E4 = Y_pos_E4-17 ; WgtE4 = WgtE4+15 ; HgtE4 = HgtE4+30 
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                            
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 0 and patE4 == 55 and st3E4 == 4 then                   --Skeleton                              
X_pos_E4 = X_pos_E4-1 ; Y_pos_E4 = Y_pos_E4-17 ; WgtE4 = WgtE4+15 ; HgtE4 = HgtE4+30 
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 1 and patE4 == 54 and st3E4 == 3 then                  --Wax dolls                           
X_pos_E4 = X_pos_E4-2 ; Y_pos_E4 = Y_pos_E4-14 ; WgtE4 = WgtE4+11 ; HgtE4 = HgtE4+28 
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                            
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 0 and patE4 == 54 and st3E4 == 3 then                   --Wax dolls                           
X_pos_E4 = X_pos_E4-2 ; Y_pos_E4 = Y_pos_E4-14 ; WgtE4 = WgtE4+11 ; HgtE4 = HgtE4+28 
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 1 and patE4 >= 55 and patE4 <= 56 and st3E4 == 3 
 and st1E4 == 32 and st2E4 == 16 and st3E4 == 3 and st4E4 == 2 
  or OIe4 == 255 and Ehp4 == 3 and LRE4 == 1 and patE4 >= 55 and patE4 <= 56 and st3E4 == 3 
 and st1E4 == 32 and st2E4 == 0 and st3E4 == 3 and st4E4 == 2 then                                  --Magician                                       
X_pos_E4 = X_pos_E4-1 ; Y_pos_E4 = Y_pos_E4-16 ; WgtE4 = WgtE4+7 ; HgtE4 = HgtE4+22   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                            
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 0 and patE4 >= 55 and patE4 <= 56 and st3E4 == 3 
 and st1E4 == 32 and st2E4 == 16 and st3E4 == 3 and st4E4 == 2 
  or OIe4 == 255 and Ehp4 == 3 and LRE4 == 0 and patE4 >= 55 and patE4 <= 56 and st3E4 == 3 
 and st1E4 == 32 and st2E4 == 0 and st3E4 == 3 and st4E4 == 2 then                                  --Magician                             
X_pos_E4 = X_pos_E4-3 ; Y_pos_E4 = Y_pos_E4-16 ; WgtE4 = WgtE4+7 ; HgtE4 = HgtE4+22  
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel) 
elseif OIe4 == 255 and Ehp4 == 1 and LRE4 == 1 and patE4 == 57 and st3E4 == 1 then                   --Knife                                        
X_pos_E4 = X_pos_E4-2 ; Y_pos_E4 = Y_pos_E4-16 ; WgtE4 = WgtE4 ; HgtE4 = HgtE4   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                            
elseif OIe4 == 255 and Ehp4 == 1 and LRE4 == 0 and patE4 == 57 and st3E4 == 1 then                   --Knife                            
X_pos_E4 = X_pos_E4-2 ; Y_pos_E4 = Y_pos_E4-16 ; WgtE4 = WgtE4 ; HgtE4 = HgtE4   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel) 
elseif OIe4 == 255 and Ehp4 == 2 and LRE4 == 1 and patE4 == 57 and st3E4 == 3 then                   --Chair                                       
X_pos_E4 = X_pos_E4-1 ; Y_pos_E4 = Y_pos_E4-14 ; WgtE4 = WgtE4+9 ; HgtE4 = HgtE4+20   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                            
elseif OIe4 == 255 and Ehp4 == 2 and LRE4 == 0 and patE4 == 57 and st3E4 == 3 then                   --Chair                            
X_pos_E4 = X_pos_E4-2 ; Y_pos_E4 = Y_pos_E4-14 ; WgtE4 = WgtE4+9 ; HgtE4 = HgtE4+20   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 1 and patE4 == 57 and st3E4 == 4
  or OIe4 == 255 and Ehp4 == 3 and LRE4 == 1 and patE4 == 56 and st3E4 == 4 then                     --falcon                                       
X_pos_E4 = X_pos_E4-1 ; Y_pos_E4 = Y_pos_E4-16 ; WgtE4 = WgtE4+24 ; HgtE4 = HgtE4+16   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                            
elseif OIe4 == 255 and Ehp4 == 3 and LRE4 == 0 and patE4 == 57 and st3E4 == 4 
  or OIe4 == 255 and Ehp4 == 3 and LRE4 == 0 and patE4 == 56 and st3E4 == 4 then                     --falcon                             
X_pos_E4 = X_pos_E4-2 ; Y_pos_E4 = Y_pos_E4-16 ; WgtE4 = WgtE4+24 ; HgtE4 = HgtE4+16   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)
elseif OIe4 == 255 and Ehp4 == 2 and LRE4 == 1 and patE4 == 58 and st3E4 == 3 then                   --Painting pictures                                       
X_pos_E4 = X_pos_E4-2 ; Y_pos_E4 = Y_pos_E4-15 ; WgtE4 = WgtE4+12 ; HgtE4 = HgtE4+19  
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                            
elseif OIe4 == 255 and Ehp4 == 2 and LRE4 == 0 and patE4 == 58 and st3E4 == 3 then                   --Painting pictures                            
X_pos_E4 = X_pos_E4 ; Y_pos_E4 = Y_pos_E4-15 ; WgtE4 = WgtE4+12 ; HgtE4 = HgtE4+19   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel) 
elseif OIe4 == 255 and Ehp4 == 2 and LRE4 == 1 and patE4 == 58 and st3E4 == 4 then                   --Table doomed                                        
X_pos_E4 = X_pos_E4-1 ; Y_pos_E4 = Y_pos_E4-15 ; WgtE4 = WgtE4+20 ; HgtE4 = HgtE4+12   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                            
elseif OIe4 == 255 and Ehp4 == 2 and LRE4 == 0 and patE4 == 58 and st3E4 == 4 then                   --Table doomed                           
X_pos_E4 = X_pos_E4-2 ; Y_pos_E4 = Y_pos_E4-15 ; WgtE4 = WgtE4+20 ; HgtE4 = HgtE4+12   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel) 
elseif OIe4 == 255 and Ehp4 == 1 and LRE4 == 1 and patE4 == 58 and st3E4 == 2 then                   --Candle                                      
X_pos_E4 = X_pos_E4-1 ; Y_pos_E4 = Y_pos_E4-16 ; WgtE4 = WgtE4+8 ; HgtE4 = HgtE4+4   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                            
elseif OIe4 == 255 and Ehp4 == 1 and LRE4 == 0 and patE4 == 58 and st3E4 == 2 then                   --Candle                          
X_pos_E4 = X_pos_E4-2 ; Y_pos_E4 = Y_pos_E4-16 ; WgtE4 = WgtE4+8 ; HgtE4 = HgtE4+4   
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,yel)                      

end

if Ehp4 == 0 then                              -- stop hitbox enemy4
X_pos_E4 = X_pos_E4+1 ; Y_pos_E4 = Y_pos_E4-14       
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,NO4)
elseif Ehp4 > 0 and OIe4 == 0 then
gui.drawRectangle(X_pos_E4,Y_pos_E4,WgtE4,HgtE4,NO4)

end
end

local function Enemy5_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX5 = mainmemory.read_u8              --X coordinate
local YY5 = mainmemory.read_u8              --Y coordinate
local enemy5_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E5 = mainmemory.read_u8         --state1 
local stat2_E5 = mainmemory.read_u8         --state2 
local stat3_E5 = mainmemory.read_u8         --state3 
local stat4_E5 = mainmemory.read_u8         --state4 
local pat_E5 = mainmemory.read_u8           --pattern select
local pat_count_E5 = mainmemory.read_u8     --pattern start count
local RES_pat_E5 = mainmemory.read_u8       --result pattern
local LR_E5 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E5 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp5 = enemy5_hp(0x0C01)
local st1E5 = stat1_E5(0x0C18)
local st2E5 = stat2_E5(0x0C19)
local st3E5 = stat3_E5(0x0C1A)
local st4E5 = stat4_E5(0x0C1B)
local patE5 = pat_E5(0x0C07)
local PATcE5 = pat_count_E5(0x0C1F)
local RpatE5 = RES_pat_E5(0x0C1E)
local LRE5 = LR_E5(0x0C10)
local OIe5 = OI_E5(0x0C00)
local X_pos_E5 = XX5(0x0C04)
local Y_pos_E5 = YY5(0x0C02)
local WgtE5 = 10
local HgtE5 = 10
local red = 0xFFF11111
local NO5 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,NO5)

elseif OIe5 == 255 and Ehp5 == 1 and LRE5 == 1 and patE5 == 50 and st3E5 == 1 then                       --Bat                                        
X_pos_E5 = X_pos_E5-1 ; Y_pos_E5 = Y_pos_E5-16 ; WgtE5 = WgtE5+8 ; HgtE5 = HgtE5+4   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                            
elseif OIe5 == 255 and Ehp5 == 1 and LRE5 == 0 and patE5 == 50 and st3E5 == 1 then                   --Bat                             
X_pos_E5 = X_pos_E5-2 ; Y_pos_E5 = Y_pos_E5-16 ; WgtE5 = WgtE5+8 ; HgtE5 = HgtE5+4   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                                                   
elseif OIe5 == 255 and Ehp5 == 2 and LRE5 == 1 and st1E5 == 16 and st2E5 == 32 and st3E5 == 2 and st4E5 == 2 
  or OIe5 == 255 and Ehp5 == 2 and LRE5 == 1 and st1E5 == 16 and st2E5 == 0 and st3E5 == 2 and st4E5 == 2 then  --Dog                           
X_pos_E5 = X_pos_E5+1 ; Y_pos_E5 = Y_pos_E5-17 ; WgtE5 = WgtE5+20 ; HgtE5 = HgtE5+7  
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                                  
elseif OIe5 == 255 and Ehp5 == 2 and LRE5 == 0 and st1E5 == 16 and st2E5 == 32 and st3E5 == 2 and st4E5 == 2 
  or OIe5 == 255 and Ehp5 == 2 and LRE5 == 0 and st1E5 == 16 and st2E5 == 0 and st3E5 == 2 and st4E5 == 2 then  --Dog                             
X_pos_E5 = X_pos_E5+1 ; Y_pos_E5 = Y_pos_E5-17 ; WgtE5 = WgtE5+20 ; HgtE5 = HgtE5+7  
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                                  
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 1 and st1E5 == 16 and st2E5 == 32 and st3E5 == 3 and st4E5 == 3 then  --super dog       
X_pos_E5 = X_pos_E5 ; Y_pos_E5 = Y_pos_E5-17 ; WgtE5 = WgtE5+20 ; HgtE5 = HgtE5+7  
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 0 and st1E5 == 16 and st2E5 == 32 and st3E5 == 3 and st4E5 == 3 then  --super dog       
X_pos_E5 = X_pos_E5 ; Y_pos_E5 = Y_pos_E5-17 ; WgtE5 = WgtE5+20 ; HgtE5 = HgtE5+7  
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)
elseif OIe5 == 255 and Ehp5 == 2 and LRE5 == 1 and patE5 >= 52 and st3E5 == 2 then                                 --ghost girl                             
X_pos_E5 = X_pos_E5-4 ; Y_pos_E5 = Y_pos_E5-17 ; WgtE5 = WgtE5+12 ; HgtE5 = HgtE5+23  
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                                  
elseif OIe5 == 255 and Ehp5 == 2 and LRE5 == 0 and patE5 == 52 and st3E5 == 2 then                                 --ghost girl             
X_pos_E5 = X_pos_E5-3 ; Y_pos_E5 = Y_pos_E5-17 ; WgtE5 = WgtE5+12 ; HgtE5 = HgtE5+23  
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 1 and patE5 >= 52 
and st1E5 == 32 and st2E5 == 16 and st3E5 == 3 and st4E5 == 3 then                                                 --Super ghost girl                             
X_pos_E5 = X_pos_E5-4 ; Y_pos_E5 = Y_pos_E5-17 ; WgtE5 = WgtE5+12 ; HgtE5 = HgtE5+23  
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                                 
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 0 and patE5 == 52
and st1E5 == 32 and st2E5 == 16 and st3E5 == 3 and st4E5 == 3 then                                                 --Super ghost girl             
X_pos_E5 = X_pos_E5-3 ; Y_pos_E5 = Y_pos_E5-17 ; WgtE5 = WgtE5+12 ; HgtE5 = HgtE5+23  
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                    
elseif OIe5 == 255 and Ehp5 >= 2 and LRE5 == 1 and patE5 == 53 and st3E5 >= 3 then                   --Goblin , super goblin                            
X_pos_E5 = X_pos_E5-4 ; Y_pos_E5 = Y_pos_E5-17 ; WgtE5 = WgtE5+10 ; HgtE5 = HgtE5+23  
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                                  
elseif OIe5 == 255 and Ehp5 >= 2 and LRE5 == 0 and patE5 == 53 and st3E5 >= 3 then                   --Goblin , super goblin            
X_pos_E5 = X_pos_E5 ; Y_pos_E5 = Y_pos_E5-17 ; WgtE5 = WgtE5+10 ; HgtE5 = HgtE5+23  
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                     
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 1 and patE5 <= 52 and st3E5 == 3 
and st1E5 == 40 and st2E5 == 16 and st3E5 == 3 and st4E5 == 2 
  or  OIe5 == 255 and Ehp5 == 3 and LRE5 == 1 and patE5 <= 52 and st3E5 == 3 
and st1E5 == 40 and st2E5 == 0 and st3E5 == 3 and st4E5 == 2 then                                   --Strange man                               
X_pos_E5 = X_pos_E5 ; Y_pos_E5 = Y_pos_E5-16 ; WgtE5 = WgtE5+7 ; HgtE5 = HgtE5+30 
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                            
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 0 and patE5 == 51 and st3E5 == 3 
and st1E5 == 40 and st2E5 == 16 and st3E5 == 3 and st4E5 == 2 
  or  OIe5 == 255 and Ehp5 == 3 and LRE5 == 0 and patE5 <= 52 and st3E5 == 3 
and st1E5 == 40 and st2E5 == 0 and st3E5 == 3 and st4E5 == 2 then                                   --Strange man                            
X_pos_E5 = X_pos_E5-1 ; Y_pos_E5 = Y_pos_E5-16 ; WgtE5 = WgtE5+7 ; HgtE5 = HgtE5+30 
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                           
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 1 and patE5 == 55 and st3E5 == 4 then                   --Skeleton                              
X_pos_E5 = X_pos_E5-8 ; Y_pos_E5 = Y_pos_E5-17 ; WgtE5 = WgtE5+15 ; HgtE5 = HgtE5+30 
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                            
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 0 and patE5 == 55 and st3E5 == 4 then                   --Skeleton                              
X_pos_E5 = X_pos_E5-1 ; Y_pos_E5 = Y_pos_E5-17 ; WgtE5 = WgtE5+15 ; HgtE5 = HgtE5+30 
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 1 and patE5 == 54 and st3E5 == 3 then                  --Wax dolls                           
X_pos_E5 = X_pos_E5-2 ; Y_pos_E5 = Y_pos_E5-14 ; WgtE5 = WgtE5+11 ; HgtE5 = HgtE5+28 
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                            
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 0 and patE5 == 54 and st3E5 == 3 then                   --Wax dolls                           
X_pos_E5 = X_pos_E5-2 ; Y_pos_E5 = Y_pos_E5-14 ; WgtE5 = WgtE5+11 ; HgtE5 = HgtE5+28 
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 1 and patE5 >= 55 and patE5 <= 56 and st3E5 == 3 
 and st1E5 == 32 and st2E5 == 16 and st3E5 == 3 and st4E5 == 2 
  or OIe5 == 255 and Ehp5 == 3 and LRE5 == 1 and patE5 >= 55 and patE5 <= 56 and st3E5 == 3 
 and st1E5 == 32 and st2E5 == 0 and st3E5 == 3 and st4E5 == 2 then                                  --Magician                                       
X_pos_E5 = X_pos_E5-1 ; Y_pos_E5 = Y_pos_E5-16 ; WgtE5 = WgtE5+7 ; HgtE5 = HgtE5+22   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                            
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 0 and patE5 >= 55 and patE5 <= 56 and st3E5 == 3 
 and st1E5 == 32 and st2E5 == 16 and st3E5 == 3 and st4E5 == 2 
  or OIe5 == 255 and Ehp5 == 3 and LRE5 == 0 and patE5 >= 55 and patE5 <= 56 and st3E5 == 3 
 and st1E5 == 32 and st2E5 == 0 and st3E5 == 3 and st4E5 == 2 then                                  --Magician                             
X_pos_E5 = X_pos_E5-3 ; Y_pos_E5 = Y_pos_E5-16 ; WgtE5 = WgtE5+7 ; HgtE5 = HgtE5+22  
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red) 
elseif OIe5 == 255 and Ehp5 == 1 and LRE5 == 1 and patE5 == 57 and st3E5 == 1 then                   --Knife                                        
X_pos_E5 = X_pos_E5-2 ; Y_pos_E5 = Y_pos_E5-16 ; WgtE5 = WgtE5 ; HgtE5 = HgtE5   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                            
elseif OIe5 == 255 and Ehp5 == 1 and LRE5 == 0 and patE5 == 57 and st3E5 == 1 then                   --Knife                            
X_pos_E5 = X_pos_E5-2 ; Y_pos_E5 = Y_pos_E5-16 ; WgtE5 = WgtE5 ; HgtE5 = HgtE5   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red) 
elseif OIe5 == 255 and Ehp5 == 2 and LRE5 == 1 and patE5 == 57 and st3E5 == 3 then                   --Chair                                       
X_pos_E5 = X_pos_E5-1 ; Y_pos_E5 = Y_pos_E5-14 ; WgtE5 = WgtE5+9 ; HgtE5 = HgtE5+20   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                            
elseif OIe5 == 255 and Ehp5 == 2 and LRE5 == 0 and patE5 == 57 and st3E5 == 3 then                   --Chair                            
X_pos_E5 = X_pos_E5-2 ; Y_pos_E5 = Y_pos_E5-14 ; WgtE5 = WgtE5+9 ; HgtE5 = HgtE5+20   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 1 and patE5 == 57 and st3E5 == 4
  or OIe5 == 255 and Ehp5 == 3 and LRE5 == 1 and patE5 == 56 and st3E5 == 4 then                     --falcon                                       
X_pos_E5 = X_pos_E5-1 ; Y_pos_E5 = Y_pos_E5-16 ; WgtE5 = WgtE5+24 ; HgtE5 = HgtE5+16   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                            
elseif OIe5 == 255 and Ehp5 == 3 and LRE5 == 0 and patE5 == 57 and st3E5 == 4 
  or OIe5 == 255 and Ehp5 == 3 and LRE5 == 0 and patE5 == 56 and st3E5 == 4 then                     --falcon                             
X_pos_E5 = X_pos_E5-2 ; Y_pos_E5 = Y_pos_E5-16 ; WgtE5 = WgtE5+24 ; HgtE5 = HgtE5+16   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)
elseif OIe5 == 255 and Ehp5 == 2 and LRE5 == 1 and patE5 == 58 and st3E5 == 3 then                   --Painting pictures                                       
X_pos_E5 = X_pos_E5-2 ; Y_pos_E5 = Y_pos_E5-15 ; WgtE5 = WgtE5+12 ; HgtE5 = HgtE5+19  
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                            
elseif OIe5 == 255 and Ehp5 == 2 and LRE5 == 0 and patE5 == 58 and st3E5 == 3 then                   --Painting pictures                            
X_pos_E5 = X_pos_E5 ; Y_pos_E5 = Y_pos_E5-15 ; WgtE5 = WgtE5+12 ; HgtE5 = HgtE5+19   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red) 
elseif OIe5 == 255 and Ehp5 == 2 and LRE5 == 1 and patE5 == 58 and st3E5 == 4 then                   --Table doomed                                        
X_pos_E5 = X_pos_E5-1 ; Y_pos_E5 = Y_pos_E5-15 ; WgtE5 = WgtE5+20 ; HgtE5 = HgtE5+12   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                            
elseif OIe5 == 255 and Ehp5 == 2 and LRE5 == 0 and patE5 == 58 and st3E5 == 4 then                   --Table doomed                           
X_pos_E5 = X_pos_E5-2 ; Y_pos_E5 = Y_pos_E5-15 ; WgtE5 = WgtE5+20 ; HgtE5 = HgtE5+12   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red) 
elseif OIe5 == 255 and Ehp5 == 1 and LRE5 == 1 and patE5 == 58 and st3E5 == 2 then                   --Candle                                      
X_pos_E5 = X_pos_E5-1 ; Y_pos_E5 = Y_pos_E5-16 ; WgtE5 = WgtE5+8 ; HgtE5 = HgtE5+4   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                            
elseif OIe5 == 255 and Ehp5 == 1 and LRE5 == 0 and patE5 == 58 and st3E5 == 2 then                   --Candle                          
X_pos_E5 = X_pos_E5-2 ; Y_pos_E5 = Y_pos_E5-16 ; WgtE5 = WgtE5+8 ; HgtE5 = HgtE5+4   
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,red)                      

end

if Ehp5 == 0 then                              -- stop hitbox enemy5
X_pos_E5 = X_pos_E5+1 ; Y_pos_E5 = Y_pos_E5-14       
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,NO5)
elseif Ehp5 > 0 and OIe5 == 0 then
gui.drawRectangle(X_pos_E5,Y_pos_E5,WgtE5,HgtE5,NO5)

end
end

local function Enemy6_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX6 = mainmemory.read_u8              --X coordinate
local YY6 = mainmemory.read_u8              --Y coordinate
local enemy6_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E6 = mainmemory.read_u8         --state1 
local stat2_E6 = mainmemory.read_u8         --state2 
local stat3_E6 = mainmemory.read_u8         --state3 
local stat4_E6 = mainmemory.read_u8         --state4 
local pat_E6 = mainmemory.read_u8           --pattern select
local pat_count_E6 = mainmemory.read_u8     --pattern start count
local RES_pat_E6 = mainmemory.read_u8       --result pattern
local LR_E6 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E6 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp6 = enemy6_hp(0x0BA1)
local st1E6 = stat3_E6(0x0BB8)
local st2E6 = stat3_E6(0x0BB9)
local st3E6 = stat3_E6(0x0BBA)
local st4E6 = stat3_E6(0x0BBB)
local patE6 = pat_E6(0x0BA7)
local PATcE6 = pat_count_E6(0x0BBF)
local RpatE6 = RES_pat_E6(0x0BBE)
local LRE6 = LR_E6(0x0BB0)
local OIe6 = OI_E6(0x0BA0)
local X_pos_E6 = XX6(0x0BA4)
local Y_pos_E6 = YY6(0x0BA2)
local WgtE6 = 10
local HgtE6 = 10
local grey = 0xFFAAAAAA
local NO6 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,NO6)

elseif OIe6 == 255 and Ehp6 == 1 and LRE6 == 1 and patE6 == 50 and st3E6 == 1 then                       --Bat                                        
X_pos_E6 = X_pos_E6-1 ; Y_pos_E6 = Y_pos_E6-16 ; WgtE6 = WgtE6+8 ; HgtE6 = HgtE6+4   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                            
elseif OIe6 == 255 and Ehp6 == 1 and LRE6 == 0 and patE6 == 50 and st3E6 == 1 then                   --Bat                             
X_pos_E6 = X_pos_E6-2 ; Y_pos_E6 = Y_pos_E6-16 ; WgtE6 = WgtE6+8 ; HgtE6 = HgtE6+4   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                                                   
elseif OIe6 == 255 and Ehp6 == 2 and LRE6 == 1 and st1E6 == 16 and st2E6 == 32 and st3E6 == 2 and st4E6 == 2 
  or OIe6 == 255 and Ehp6 == 2 and LRE6 == 1 and st1E6 == 16 and st2E6 == 0 and st3E6 == 2 and st4E6 == 2 then  --Dog                           
X_pos_E6 = X_pos_E6+1 ; Y_pos_E6 = Y_pos_E6-17 ; WgtE6 = WgtE6+20 ; HgtE6 = HgtE6+7  
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                                  
elseif OIe6 == 255 and Ehp6 == 2 and LRE6 == 0 and st1E6 == 16 and st2E6 == 32 and st3E6 == 2 and st4E6 == 2 
  or OIe6 == 255 and Ehp6 == 2 and LRE6 == 0 and st1E6 == 16 and st2E6 == 0 and st3E6 == 2 and st4E6 == 2 then  --Dog                             
X_pos_E6 = X_pos_E6+1 ; Y_pos_E6 = Y_pos_E6-17 ; WgtE6 = WgtE6+20 ; HgtE6 = HgtE6+7  
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                                  
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 1 and st1E6 == 16 and st2E6 == 32 and st3E6 == 3 and st4E6 == 3 then  --super dog       
X_pos_E6 = X_pos_E6 ; Y_pos_E6 = Y_pos_E6-17 ; WgtE6 = WgtE6+20 ; HgtE6 = HgtE6+7  
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 0 and st1E6 == 16 and st2E6 == 32 and st3E6 == 3 and st4E6 == 3 then  --super dog       
X_pos_E6 = X_pos_E6 ; Y_pos_E6 = Y_pos_E6-17 ; WgtE6 = WgtE6+20 ; HgtE6 = HgtE6+7  
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)
elseif OIe6 == 255 and Ehp6 == 2 and LRE6 == 1 and patE6 >= 52 and st3E6 == 2 then                                 --ghost girl                             
X_pos_E6 = X_pos_E6-4 ; Y_pos_E6 = Y_pos_E6-17 ; WgtE6 = WgtE6+12 ; HgtE6 = HgtE6+23  
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                                  
elseif OIe6 == 255 and Ehp5 == 2 and LRE6 == 0 and patE6 == 52 and st3E6 == 2 then                                 --ghost girl             
X_pos_E6 = X_pos_E6-3 ; Y_pos_E6 = Y_pos_E6-17 ; WgtE6 = WgtE6+12 ; HgtE6 = HgtE6+23  
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 1 and patE6 >= 52  
and st1E6 == 32 and st2E6 == 16 and st3E6 == 3 and st4E6 == 3 then                                                 --Super ghost girl                             
X_pos_E6 = X_pos_E6-4 ; Y_pos_E6 = Y_pos_E6-17 ; WgtE6 = WgtE6+12 ; HgtE6 = HgtE6+23  
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                                 
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 0 and patE6 == 52 
and st1E6 == 32 and st2E6 == 16 and st3E6 == 3 and st4E6 == 3 then                                                 --Super ghost girl             
X_pos_E6 = X_pos_E6-3 ; Y_pos_E6 = Y_pos_E6-17 ; WgtE6 = WgtE6+12 ; HgtE6 = HgtE6+23  
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                    
elseif OIe6 == 255 and Ehp6 >= 2 and LRE6 == 1 and patE6 == 53 and st3E6 >= 3 then                   --Goblin , super goblin                            
X_pos_E6 = X_pos_E6-4 ; Y_pos_E6 = Y_pos_E6-17 ; WgtE6 = WgtE6+10 ; HgtE6 = HgtE6+23  
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                                  
elseif OIe6 == 255 and Ehp6 >= 2 and LRE6 == 0 and patE6 == 53 and st3E6 >= 3 then                   --Goblin , super goblin            
X_pos_E6 = X_pos_E6 ; Y_pos_E6 = Y_pos_E6-17 ; WgtE6 = WgtE6+10 ; HgtE6 = HgtE6+23  
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                     
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 1 and patE6 <= 52 and st3E6 == 3 
and st1E6 == 40 and st2E6 == 16 and st3E6 == 3 and st4E6 == 2 
  or OIe6 == 255 and Ehp6 == 3 and LRE6 == 1 and patE6 <= 52 and st3E6 == 3 
and st1E6 == 40 and st2E6 == 0 and st3E6 == 3 and st4E6 == 2 then                                   --Strange man                               
X_pos_E6 = X_pos_E6 ; Y_pos_E6 = Y_pos_E6-16 ; WgtE6 = WgtE6+7 ; HgtE6 = HgtE6+30 
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                            
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 0 and patE6 == 51 and st3E6 == 3 
and st1E6 == 40 and st2E6 == 16 and st3E6 == 3 and st4E6 == 2 
  or OIe6 == 255 and Ehp6 == 3 and LRE6 == 0 and patE6 <= 52 and st3E6 == 3 
and st1E6 == 40 and st2E6 == 0 and st3E6 == 3 and st4E6 == 2 then                                   --Strange man                            
X_pos_E6 = X_pos_E6-1 ; Y_pos_E6 = Y_pos_E6-16 ; WgtE6 = WgtE6+7 ; HgtE6 = HgtE6+30 
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                           
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 1 and patE6 == 55 and st3E6 == 4 then                   --Skeleton                              
X_pos_E6 = X_pos_E6-8 ; Y_pos_E6 = Y_pos_E6-17 ; WgtE6 = WgtE6+15 ; HgtE6 = HgtE6+30 
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                            
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 0 and patE6 == 55 and st3E6 == 4 then                   --Skeleton                              
X_pos_E6 = X_pos_E6-1 ; Y_pos_E6 = Y_pos_E6-17 ; WgtE6 = WgtE6+15 ; HgtE6 = HgtE6+30 
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 1 and patE6 == 54 and st3E6 == 3 then                  --Wax dolls                           
X_pos_E6 = X_pos_E6-2 ; Y_pos_E6 = Y_pos_E6-14 ; WgtE6 = WgtE6+11 ; HgtE6 = HgtE6+28 
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                            
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 0 and patE6 == 54 and st3E6 == 3 then                   --Wax dolls                           
X_pos_E6 = X_pos_E6-2 ; Y_pos_E6 = Y_pos_E6-14 ; WgtE6 = WgtE6+11 ; HgtE6 = HgtE6+28 
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 1 and patE6 >= 55 and patE6 <= 56 and st3E6 == 3 
 and st1E6 == 32 and st2E6 == 16 and st3E6 == 3 and st4E6 == 2 
  or OIe6 == 255 and Ehp6 == 3 and LRE6 == 1 and patE6 >= 55 and patE6 <= 56 and st3E6 == 3 
 and st1E6 == 32 and st2E6 == 0 and st3E6 == 3 and st4E6 == 2 then                                  --Magician                                       
X_pos_E6 = X_pos_E6-1 ; Y_pos_E6 = Y_pos_E6-16 ; WgtE6 = WgtE6+7 ; HgtE6 = HgtE6+22   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                            
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 0 and patE6 >= 55 and patE6 <= 56 and st3E6 == 3 
 and st1E6 == 32 and st2E6 == 16 and st3E6 == 3 and st4E6 == 2 
  or OIe6 == 255 and Ehp6 == 3 and LRE6 == 0 and patE6 >= 55 and patE6 <= 56 and st3E6 == 3 
 and st1E6 == 32 and st2E6 == 0 and st3E6 == 3 and st4E6 == 2 then                                  --Magician                             
X_pos_E6 = X_pos_E6-3 ; Y_pos_E6 = Y_pos_E6-16 ; WgtE6 = WgtE6+7 ; HgtE6 = HgtE6+22  
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey) 
elseif OIe6 == 255 and Ehp6 == 1 and LRE6 == 1 and patE6 == 57 and st3E6 == 1 then                   --Knife                                        
X_pos_E6 = X_pos_E6-2 ; Y_pos_E6 = Y_pos_E6-16 ; WgtE6 = WgtE6 ; HgtE6 = HgtE6   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                            
elseif OIe6 == 255 and Ehp6 == 1 and LRE6 == 0 and patE6 == 57 and st3E6 == 1 then                   --Knife                            
X_pos_E6 = X_pos_E6-2 ; Y_pos_E6 = Y_pos_E6-16 ; WgtE6 = WgtE6 ; HgtE6 = HgtE6   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey) 
elseif OIe6 == 255 and Ehp6 == 2 and LRE6 == 1 and patE6 == 57 and st3E6 == 3 then                   --Chair                                       
X_pos_E6 = X_pos_E6-1 ; Y_pos_E6 = Y_pos_E6-14 ; WgtE6 = WgtE6+9 ; HgtE6 = HgtE6+20   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                            
elseif OIe6 == 255 and Ehp6 == 2 and LRE6 == 0 and patE6 == 57 and st3E6 == 3 then                   --Chair                            
X_pos_E6 = X_pos_E6-2 ; Y_pos_E6 = Y_pos_E6-14 ; WgtE6 = WgtE6+9 ; HgtE6 = HgtE6+20   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 1 and patE6 == 57 and st3E6 == 4
  or OIe6 == 255 and Ehp6 == 3 and LRE6 == 1 and patE6 == 56 and st3E6 == 4 then                     --falcon                                       
X_pos_E6 = X_pos_E6-1 ; Y_pos_E6 = Y_pos_E6-16 ; WgtE6 = WgtE6+24 ; HgtE6 = HgtE6+16   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                            
elseif OIe6 == 255 and Ehp6 == 3 and LRE6 == 0 and patE6 == 57 and st3E6 == 4 
  or OIe6 == 255 and Ehp6 == 3 and LRE6 == 0 and patE6 == 56 and st3E6 == 4 then                     --falcon                             
X_pos_E6 = X_pos_E6-2 ; Y_pos_E6 = Y_pos_E6-16 ; WgtE6 = WgtE6+24 ; HgtE6 = HgtE6+16   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)
elseif OIe6 == 255 and Ehp6 == 2 and LRE6 == 1 and patE6 == 58 and st3E6 == 3 then                   --Painting pictures                                       
X_pos_E6 = X_pos_E6-2 ; Y_pos_E6 = Y_pos_E6-15 ; WgtE6 = WgtE6+12 ; HgtE6 = HgtE6+19  
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                            
elseif OIe6 == 255 and Ehp6 == 2 and LRE6 == 0 and patE6 == 58 and st3E6 == 3 then                   --Painting pictures                            
X_pos_E6 = X_pos_E6 ; Y_pos_E6 = Y_pos_E6-15 ; WgtE6 = WgtE6+12 ; HgtE6 = HgtE6+19   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey) 
elseif OIe6 == 255 and Ehp6 == 2 and LRE6 == 1 and patE6 == 58 and st3E6 == 4 then                   --Table doomed                                        
X_pos_E6 = X_pos_E6-1 ; Y_pos_E6 = Y_pos_E6-15 ; WgtE6 = WgtE6+20 ; HgtE6 = HgtE6+12   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                            
elseif OIe6 == 255 and Ehp6 == 2 and LRE6 == 0 and patE6 == 58 and st3E6 == 4 then                   --Table doomed                           
X_pos_E6 = X_pos_E6-2 ; Y_pos_E6 = Y_pos_E6-15 ; WgtE6 = WgtE6+20 ; HgtE6 = HgtE6+12   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey) 
elseif OIe6 == 255 and Ehp6 == 1 and LRE6 == 1 and patE6 == 58 and st3E6 == 2 then                   --Candle                                      
X_pos_E6 = X_pos_E6-1 ; Y_pos_E6 = Y_pos_E6-16 ; WgtE6 = WgtE6+8 ; HgtE6 = HgtE6+4   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                            
elseif OIe6 == 255 and Ehp6 == 1 and LRE6 == 0 and patE6 == 58 and st3E6 == 2 then                   --Candle                          
X_pos_E6 = X_pos_E6-2 ; Y_pos_E6 = Y_pos_E6-16 ; WgtE6 = WgtE6+8 ; HgtE6 = HgtE6+4   
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,grey)                      

end

if Ehp6 == 0 then                              -- stop hitbox enemy6
X_pos_E6 = X_pos_E6+1 ; Y_pos_E6 = Y_pos_E6-14       
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,NO6)
elseif Ehp6 > 0 and OIe6 == 0 then 
gui.drawRectangle(X_pos_E6,Y_pos_E6,WgtE6,HgtE6,NO6)

end
end

local function Enemy7_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX7 = mainmemory.read_u8              --X coordinate
local YY7 = mainmemory.read_u8              --Y coordinate
local enemy7_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E7 = mainmemory.read_u8         --state1 
local stat2_E7 = mainmemory.read_u8         --state2 
local stat3_E7 = mainmemory.read_u8         --state3 
local stat4_E7 = mainmemory.read_u8         --state4 
local pat_E7 = mainmemory.read_u8           --pattern select
local pat_count_E7 = mainmemory.read_u8     --pattern start count
local RES_pat_E7 = mainmemory.read_u8       --result pattern
local LR_E7 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E7 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp7 = enemy7_hp(0x0C21)
local st1E7 = stat1_E7(0x0C38)
local st2E7 = stat2_E7(0x0C39)
local st3E7 = stat3_E7(0x0C3A)
local st4E7 = stat4_E7(0x0C3B)
local patE7 = pat_E7(0x0C27)
local PATcE7 = pat_count_E7(0x0C3F)
local RpatE7 = RES_pat_E7(0x0C3E)
local LRE7 = LR_E7(0x0C30)
local OIe7 = OI_E7(0x0C20)
local X_pos_E7 = XX7(0x0C24)
local Y_pos_E7 = YY7(0x0C22)
local WgtE7 = 10
local HgtE7 = 10
local blut = 0xFF0FFFFF
local NO7 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,NO7)

elseif OIe7 == 255 and Ehp7 == 1 and LRE7 == 1 and patE7 == 50 and st3E7 == 1 then                       --Bat                                        
X_pos_E7 = X_pos_E7-1 ; Y_pos_E7 = Y_pos_E7-16 ; WgtE7 = WgtE7+8 ; HgtE7 = HgtE7+4   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                            
elseif OIe7 == 255 and Ehp7 == 1 and LRE7 == 0 and patE7 == 50 and st3E7 == 1 then                   --Bat                             
X_pos_E7 = X_pos_E7-2 ; Y_pos_E7 = Y_pos_E7-16 ; WgtE7 = WgtE7+8 ; HgtE7 = HgtE7+4   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                                                   
elseif OIe7 == 255 and Ehp7 == 2 and LRE7 == 1 and st1E7 == 16 and st2E7 == 32 and st3E7 == 2 and st4E7 == 2 
  or OIe7 == 255 and Ehp7 == 2 and LRE7 == 1 and st1E7 == 16 and st2E7 == 0 and st3E7 == 2 and st4E7 == 2 then  --Dog                           
X_pos_E7 = X_pos_E7+1 ; Y_pos_E7 = Y_pos_E7-17 ; WgtE7 = WgtE7+20 ; HgtE7 = HgtE7+7  
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                                  
elseif OIe7 == 255 and Ehp7 == 2 and LRE7 == 0 and st1E7 == 16 and st2E7 == 32 and st3E7 == 2 and st4E7 == 2 
  or OIe7 == 255 and Ehp7 == 2 and LRE7 == 0 and st1E7 == 16 and st2E7 == 0 and st3E7 == 2 and st4E7 == 2 then  --Dog                             
X_pos_E7 = X_pos_E7+1 ; Y_pos_E7 = Y_pos_E7-17 ; WgtE7 = WgtE7+20 ; HgtE7 = HgtE7+7  
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                                  
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 1 and st1E7 == 16 and st2E7 == 32 and st3E7 == 3 and st4E7 == 3 then  --super dog       
X_pos_E7 = X_pos_E7 ; Y_pos_E7 = Y_pos_E7-17 ; WgtE7 = WgtE7+20 ; HgtE7 = HgtE7+7  
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 0 and st1E7 == 16 and st2E7 == 32 and st3E7 == 3 and st4E7 == 3 then  --super dog       
X_pos_E7 = X_pos_E7 ; Y_pos_E7 = Y_pos_E7-17 ; WgtE7 = WgtE7+20 ; HgtE7 = HgtE7+7  
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)
elseif OIe7 == 255 and Ehp7 == 2 and LRE7 == 1 and patE7 >= 52 and st3E7 == 2 then                                 --ghost girl                             
X_pos_E7 = X_pos_E7-4 ; Y_pos_E7 = Y_pos_E7-17 ; WgtE7 = WgtE7+12 ; HgtE7 = HgtE7+23  
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                                  
elseif OIe7 == 255 and Ehp7 == 2 and LRE7 == 0 and patE7 == 52 and st3E7 == 2 then                                 --ghost girl             
X_pos_E7 = X_pos_E7-3 ; Y_pos_E7 = Y_pos_E7-17 ; WgtE7 = WgtE7+12 ; HgtE7 = HgtE7+23  
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 1 and patE7 >= 52 
and st1E7 == 32 and st2E7 == 16 and st3E7 == 3 and st4E7 == 3 then                                                 --Super ghost girl                             
X_pos_E7 = X_pos_E7-4 ; Y_pos_E7 = Y_pos_E7-17 ; WgtE7 = WgtE7+12 ; HgtE7 = HgtE7+23  
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                                 
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 0 and patE7 == 52 
and st1E7 == 32 and st2E7 == 16 and st3E7 == 3 and st4E7 == 3 then                                                 --Super ghost girl             
X_pos_E7 = X_pos_E7-3 ; Y_pos_E7 = Y_pos_E7-17 ; WgtE7 = WgtE7+12 ; HgtE7 = HgtE7+23  
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                    
elseif OIe7 == 255 and Ehp7 >= 2 and LRE7 == 1 and patE7 == 53 and st3E7 >= 3 then                   --Goblin , super goblin                            
X_pos_E7 = X_pos_E7-4 ; Y_pos_E7 = Y_pos_E7-17 ; WgtE7 = WgtE7+10 ; HgtE7 = HgtE7+23  
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                                  
elseif OIe7 == 255 and Ehp7 >= 2 and LRE7 == 0 and patE7 == 53 and st3E7 >= 3 then                   --Goblin , super goblin            
X_pos_E7 = X_pos_E7 ; Y_pos_E7 = Y_pos_E7-17 ; WgtE7 = WgtE7+10 ; HgtE7 = HgtE7+23  
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                     
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 1 and patE7 <= 52 and st3E7 == 3 
and st1E7 == 40 and st2E7 == 16 and st3E7 == 3 and st4E7 == 2 
  or OIe7 == 255 and Ehp7 == 3 and LRE7 == 1 and patE7 <= 52 and st3E7 == 3 
and st1E7 == 40 and st2E7 == 0 and st3E7 == 3 and st4E7 == 2 then                                   --Strange man                               
X_pos_E7 = X_pos_E7 ; Y_pos_E7 = Y_pos_E7-16 ; WgtE7 = WgtE7+7 ; HgtE7 = HgtE7+30 
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                            
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 0 and patE7 == 51 and st3E7 == 3 
and st1E7 == 40 and st2E7 == 16 and st3E7 == 3 and st4E7 == 2 
  or OIe7 == 255 and Ehp7 == 3 and LRE7 == 0 and patE7 <= 52 and st3E7 == 3 
and st1E7 == 40 and st2E7 == 0 and st3E7 == 3 and st4E7 == 2 then                                   --Strange man                            
X_pos_E7 = X_pos_E7-1 ; Y_pos_E7 = Y_pos_E7-16 ; WgtE7 = WgtE7+7 ; HgtE7 = HgtE7+30 
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                           
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 1 and patE7 == 55 and st3E7 == 4 then                   --Skeleton                              
X_pos_E7 = X_pos_E7-8 ; Y_pos_E7 = Y_pos_E7-17 ; WgtE7 = WgtE7+15 ; HgtE7 = HgtE7+30 
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                            
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 0 and patE7 == 55 and st3E7 == 4 then                   --Skeleton                              
X_pos_E7 = X_pos_E7-1 ; Y_pos_E7 = Y_pos_E7-17 ; WgtE7 = WgtE7+15 ; HgtE7 = HgtE7+30 
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 1 and patE7 == 54 and st3E7 == 3 then                  --Wax dolls                           
X_pos_E7 = X_pos_E7-2 ; Y_pos_E7 = Y_pos_E7-14 ; WgtE7 = WgtE7+11 ; HgtE7 = HgtE7+28 
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                            
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 0 and patE7 == 54 and st3E7 == 3 then                   --Wax dolls                           
X_pos_E7 = X_pos_E7-2 ; Y_pos_E7 = Y_pos_E7-14 ; WgtE7 = WgtE7+11 ; HgtE7 = HgtE7+28 
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 1 and patE7 >= 55 and patE7 <= 56 and st3E7 == 3 
 and st1E7 == 32 and st2E7 == 16 and st3E7 == 3 and st4E7 == 2 
  or OIe7 == 255 and Ehp7 == 3 and LRE7 == 1 and patE7 >= 55 and patE7 <= 56 and st3E7 == 3 
 and st1E7 == 32 and st2E7 == 0 and st3E7 == 3 and st4E7 == 2 then                                  --Magician                                       
X_pos_E7 = X_pos_E7-1 ; Y_pos_E7 = Y_pos_E7-16 ; WgtE7 = WgtE7+7 ; HgtE7 = HgtE7+22   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                            
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 0 and patE7 >= 55 and patE7 <= 56 and st3E7 == 3 
 and st1E7 == 32 and st2E7 == 16 and st3E7 == 3 and st4E7 == 2 
  or OIe7 == 255 and Ehp7 == 3 and LRE7 == 0 and patE7 >= 55 and patE7 <= 56 and st3E7 == 3 
 and st1E7 == 32 and st2E7 == 0 and st3E7 == 3 and st4E7 == 2 then                                  --Magician                             
X_pos_E7 = X_pos_E7-3 ; Y_pos_E7 = Y_pos_E7-16 ; WgtE7 = WgtE7+7 ; HgtE7 = HgtE7+22  
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut) 
elseif OIe7 == 255 and Ehp7 == 1 and LRE7 == 1 and patE7 == 57 and st3E7 == 1 then                   --Knife                                        
X_pos_E7 = X_pos_E7-2 ; Y_pos_E7 = Y_pos_E7-16 ; WgtE7 = WgtE7 ; HgtE7 = HgtE7   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                            
elseif OIe7 == 255 and Ehp7 == 1 and LRE7 == 0 and patE7 == 57 and st3E7 == 1 then                   --Knife                            
X_pos_E7 = X_pos_E7-2 ; Y_pos_E7 = Y_pos_E7-16 ; WgtE7 = WgtE7 ; HgtE7 = HgtE7   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut) 
elseif OIe7 == 255 and Ehp7 == 2 and LRE7 == 1 and patE7 == 57 and st3E7 == 3 then                   --Chair                                       
X_pos_E7 = X_pos_E7-1 ; Y_pos_E7 = Y_pos_E7-14 ; WgtE7 = WgtE7+9 ; HgtE7 = HgtE7+20   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                            
elseif OIe7 == 255 and Ehp7 == 2 and LRE7 == 0 and patE7 == 57 and st3E7 == 3 then                   --Chair                            
X_pos_E7 = X_pos_E7-2 ; Y_pos_E7 = Y_pos_E7-14 ; WgtE7 = WgtE7+9 ; HgtE7 = HgtE7+20   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 1 and patE7 == 57 and st3E7 == 4
  or OIe7 == 255 and Ehp7 == 3 and LRE7 == 1 and patE7 == 56 and st3E7 == 4 then                     --falcon                                       
X_pos_E7 = X_pos_E7-1 ; Y_pos_E7 = Y_pos_E7-16 ; WgtE7 = WgtE7+24 ; HgtE7 = HgtE7+16   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                            
elseif OIe7 == 255 and Ehp7 == 3 and LRE7 == 0 and patE7 == 57 and st3E7 == 4 
  or OIe7 == 255 and Ehp7 == 3 and LRE7 == 0 and patE7 == 56 and st3E7 == 4 then                     --falcon                             
X_pos_E7 = X_pos_E7-2 ; Y_pos_E7 = Y_pos_E7-16 ; WgtE7 = WgtE7+24 ; HgtE7 = HgtE7+16   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)
elseif OIe7 == 255 and Ehp7 == 2 and LRE7 == 1 and patE7 == 58 and st3E7 == 3 then                   --Painting pictures                                       
X_pos_E7 = X_pos_E7-2 ; Y_pos_E7 = Y_pos_E7-15 ; WgtE7 = WgtE7+12 ; HgtE7 = HgtE7+19  
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                            
elseif OIe7 == 255 and Ehp7 == 2 and LRE7 == 0 and patE7 == 58 and st3E7 == 3 then                   --Painting pictures                            
X_pos_E7 = X_pos_E7 ; Y_pos_E7 = Y_pos_E7-15 ; WgtE7 = WgtE7+12 ; HgtE7 = HgtE7+19   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut) 
elseif OIe7 == 255 and Ehp7 == 2 and LRE7 == 1 and patE7 == 58 and st3E7 == 4 then                   --Table doomed                                        
X_pos_E7 = X_pos_E7-1 ; Y_pos_E7 = Y_pos_E7-15 ; WgtE7 = WgtE7+20 ; HgtE7 = HgtE7+12   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                            
elseif OIe7 == 255 and Ehp7 == 2 and LRE7 == 0 and patE7 == 58 and st3E7 == 4 then                   --Table doomed                           
X_pos_E7 = X_pos_E7-2 ; Y_pos_E7 = Y_pos_E7-15 ; WgtE7 = WgtE7+20 ; HgtE7 = HgtE7+12   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut) 
elseif OIe7 == 255 and Ehp7 == 1 and LRE7 == 1 and patE7 == 58 and st3E7 == 2 then                   --Candle                                      
X_pos_E7 = X_pos_E7-1 ; Y_pos_E7 = Y_pos_E7-16 ; WgtE7 = WgtE7+8 ; HgtE7 = HgtE7+4   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                            
elseif OIe7 == 255 and Ehp7 == 1 and LRE7 == 0 and patE7 == 58 and st3E7 == 2 then                   --Candle                          
X_pos_E7 = X_pos_E7-2 ; Y_pos_E7 = Y_pos_E7-16 ; WgtE7 = WgtE7+8 ; HgtE7 = HgtE7+4   
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,blut)                      

end

if Ehp7 == 0 then                              -- stop hitbox enemy7
X_pos_E7 = X_pos_E7+1 ; Y_pos_E7 = Y_pos_E7-14       
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,NO7)
elseif Ehp7 > 0 and OIe7 == 0 then
gui.drawRectangle(X_pos_E7,Y_pos_E7,WgtE7,HgtE7,NO7)

end
end

local function Enemy8_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX8 = mainmemory.read_u8              --X coordinate
local YY8 = mainmemory.read_u8              --Y coordinate
local enemy8_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E8 = mainmemory.read_u8         --state1 
local stat2_E8 = mainmemory.read_u8         --state2 
local stat3_E8 = mainmemory.read_u8         --state3 
local stat4_E8 = mainmemory.read_u8         --state4 
local pat_E8 = mainmemory.read_u8           --pattern select
local pat_count_E8 = mainmemory.read_u8     --pattern start count
local RES_pat_E8 = mainmemory.read_u8       --result pattern
local LR_E8 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E8 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp8 = enemy8_hp(0x0C41)
local st1E8 = stat1_E8(0x0C58)
local st2E8 = stat2_E8(0x0C59)
local st3E8 = stat3_E8(0x0C5A)
local st4E8 = stat4_E8(0x0C5B)
local patE8 = pat_E8(0x0C47)
local PATcE8 = pat_count_E8(0x0C5F)
local RpatE8 = RES_pat_E8(0x0C5E)
local LRE8 = LR_E8(0x0C50)
local OIe8 = OI_E8(0x0C40)
local X_pos_E8 = XX8(0x0C44)
local Y_pos_E8 = YY8(0x0C42)
local WgtE8 = 10
local HgtE8 = 10
local pink = 0xFFFFCCCC
local NO8 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,NO8)

elseif OIe8 == 255 and Ehp8 == 1 and LRE8 == 1 and patE8 == 50 and st3E8 == 1 then                       --Bat                                        
X_pos_E8 = X_pos_E8-1 ; Y_pos_E8 = Y_pos_E8-16 ; WgtE8 = WgtE8+8 ; HgtE8 = HgtE8+4   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                            
elseif OIe8 == 255 and Ehp8 == 1 and LRE8 == 0 and patE8 == 50 and st3E8 == 1 then                   --Bat                             
X_pos_E8 = X_pos_E8-2 ; Y_pos_E8 = Y_pos_E8-16 ; WgtE8 = WgtE8+8 ; HgtE8 = HgtE8+4   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                                                   
elseif OIe8 == 255 and Ehp8 == 2 and LRE8 == 1 and st1E8 == 16 and st2E8 == 32 and st3E8 == 2 and st4E8 == 2 
  or OIe8 == 255 and Ehp8 == 2 and LRE8 == 1 and st1E8 == 16 and st2E8 == 0 and st3E8 == 2 and st4E8 == 2 then  --Dog                           
X_pos_E8 = X_pos_E8+1 ; Y_pos_E8 = Y_pos_E8-17 ; WgtE8 = WgtE8+20 ; HgtE8 = HgtE8+7  
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                                  
elseif OIe8 == 255 and Ehp8 == 2 and LRE8 == 0 and st1E8 == 16 and st2E8 == 32 and st3E8 == 2 and st4E8 == 2 
  or OIe8 == 255 and Ehp8 == 2 and LRE8 == 0 and st1E8 == 16 and st2E8 == 0 and st3E8 == 2 and st4E8 == 2 then  --Dog                             
X_pos_E8 = X_pos_E8+1 ; Y_pos_E8 = Y_pos_E8-17 ; WgtE8 = WgtE8+20 ; HgtE8 = HgtE8+7  
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                                  
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 1 and st1E8 == 16 and st2E8 == 32 and st3E8 == 3 and st4E8 == 3 then  --super dog       
X_pos_E8 = X_pos_E8 ; Y_pos_E8 = Y_pos_E8-17 ; WgtE8 = WgtE8+20 ; HgtE8 = HgtE8+7  
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 0 and st1E8 == 16 and st2E8 == 32 and st3E8 == 3 and st4E8 == 3 then  --super dog       
X_pos_E8 = X_pos_E8 ; Y_pos_E8 = Y_pos_E8-17 ; WgtE8 = WgtE8+20 ; HgtE8 = HgtE8+7  
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)
elseif OIe8 == 255 and Ehp8 == 2 and LRE8 == 1 and patE8 >= 52 and st3E8 == 2 then                                 --ghost girl                             
X_pos_E8 = X_pos_E8-4 ; Y_pos_E8 = Y_pos_E8-17 ; WgtE8 = WgtE8+12 ; HgtE8 = HgtE8+23  
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                                  
elseif OIe8 == 255 and Ehp8 == 2 and LRE8 == 0 and patE8 == 52 and st3E8 == 2 then                                 --ghost girl             
X_pos_E8 = X_pos_E8-3 ; Y_pos_E8 = Y_pos_E8-17 ; WgtE8 = WgtE8+12 ; HgtE8 = HgtE8+23  
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 1 and patE8 >= 52  
and st1E8 == 32 and st2E8 == 16 and st3E8 == 3 and st4E8 == 3 then                                                 --Super ghost girl                             
X_pos_E8 = X_pos_E8-4 ; Y_pos_E8 = Y_pos_E8-17 ; WgtE8 = WgtE8+12 ; HgtE8 = HgtE8+23  
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                                 
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 0 and patE8 == 52  
and st1E8 == 32 and st2E8 == 16 and st3E8 == 3 and st4E8 == 3 then                                                 --Super ghost girl             
X_pos_E8 = X_pos_E8-3 ; Y_pos_E8 = Y_pos_E8-17 ; WgtE8 = WgtE8+12 ; HgtE8 = HgtE8+23  
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                    
elseif OIe8 == 255 and Ehp8 >= 2 and LRE8 == 1 and patE8 == 53 and st3E8 >= 3 then                   --Goblin , super goblin                            
X_pos_E8 = X_pos_E8-4 ; Y_pos_E8 = Y_pos_E8-17 ; WgtE8 = WgtE8+10 ; HgtE8 = HgtE8+23  
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                                  
elseif OIe8 == 255 and Ehp8 >= 2 and LRE8 == 0 and patE8 == 53 and st3E8 >= 3 then                   --Goblin , super goblin            
X_pos_E8 = X_pos_E8 ; Y_pos_E8 = Y_pos_E8-17 ; WgtE8 = WgtE8+10 ; HgtE8 = HgtE8+23  
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                     
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 1 and patE8 <= 52 and st3E8 == 3 
and st1E8 == 40 and st2E8 == 16 and st3E8 == 3 and st4E8 == 2 
  or OIe8 == 255 and Ehp8 == 3 and LRE8 == 1 and patE8 <= 52 and st3E8 == 3 
and st1E8 == 40 and st2E8 == 0 and st3E8 == 3 and st4E8 == 2 then                                   --Strange man                               
X_pos_E8 = X_pos_E8 ; Y_pos_E8 = Y_pos_E8-16 ; WgtE8 = WgtE8+7 ; HgtE8 = HgtE8+30 
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                            
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 0 and patE8 == 51 and st3E8 == 3 
and st1E8 == 40 and st2E8 == 16 and st3E8 == 3 and st4E8 == 2 
  or OIe8 == 255 and Ehp8 == 3 and LRE8 == 0 and patE8 <= 52 and st3E8 == 3 
and st1E8 == 40 and st2E8 == 0 and st3E8 == 3 and st4E8 == 2 then                                   --Strange man                            
X_pos_E8 = X_pos_E8-1 ; Y_pos_E8 = Y_pos_E8-16 ; WgtE8 = WgtE8+7 ; HgtE8 = HgtE8+30 
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                           
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 1 and patE8 == 55 and st3E8 == 4 then                   --Skeleton                              
X_pos_E8 = X_pos_E8-8 ; Y_pos_E8 = Y_pos_E8-17 ; WgtE8 = WgtE8+15 ; HgtE8 = HgtE8+30 
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                            
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 0 and patE8 == 55 and st3E8 == 4 then                   --Skeleton                              
X_pos_E8 = X_pos_E8-1 ; Y_pos_E8 = Y_pos_E8-17 ; WgtE8 = WgtE8+15 ; HgtE8 = HgtE8+30 
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 1 and patE8 == 54 and st3E8 == 3 then                  --Wax dolls                           
X_pos_E8 = X_pos_E8-2 ; Y_pos_E8 = Y_pos_E8-14 ; WgtE8 = WgtE8+11 ; HgtE8 = HgtE8+28 
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                            
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 0 and patE8 == 54 and st3E8 == 3 then                   --Wax dolls                           
X_pos_E8 = X_pos_E8-2 ; Y_pos_E8 = Y_pos_E8-14 ; WgtE8 = WgtE8+11 ; HgtE8 = HgtE8+28 
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 1 and patE8 >= 55 and patE8 <= 56 and st3E8 == 3 
 and st1E8 == 32 and st2E8 == 16 and st3E8 == 3 and st4E8 == 2 
  or OIe8 == 255 and Ehp8 == 3 and LRE8 == 1 and patE8 >= 55 and patE8 <= 56 and st3E8 == 3 
 and st1E8 == 32 and st2E8 == 0 and st3E8 == 3 and st4E8 == 2 then                                             --Magician                                       
X_pos_E8 = X_pos_E8-1 ; Y_pos_E8 = Y_pos_E8-16 ; WgtE8 = WgtE8+7 ; HgtE8 = HgtE8+22   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                            
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 0 and patE8 >= 55 and patE8 <= 56 and st3E8 == 3 
 and st1E8 == 32 and st2E8 == 16 and st3E8 == 3 and st4E8 == 2 
  or OIe8 == 255 and Ehp8 == 3 and LRE8 == 0 and patE8 >= 55 and patE8 <= 56 and st3E8 == 3 
 and st1E8 == 32 and st2E8 == 0 and st3E8 == 3 and st4E8 == 2 then                                             --Magician                             
X_pos_E8 = X_pos_E8-3 ; Y_pos_E8 = Y_pos_E8-16 ; WgtE8 = WgtE8+7 ; HgtE8 = HgtE8+22  
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink) 
elseif OIe8 == 255 and Ehp8 == 1 and LRE8 == 1 and patE8 == 57 and st3E8 == 1 then                   --Knife                                        
X_pos_E8 = X_pos_E8-2 ; Y_pos_E8 = Y_pos_E8-16 ; WgtE8 = WgtE8 ; HgtE8 = HgtE8   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                            
elseif OIe8 == 255 and Ehp8 == 1 and LRE8 == 0 and patE8 == 57 and st3E8 == 1 then                   --Knife                            
X_pos_E8 = X_pos_E8-2 ; Y_pos_E8 = Y_pos_E8-16 ; WgtE8 = WgtE8 ; HgtE8 = HgtE8   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink) 
elseif OIe8 == 255 and Ehp8 == 2 and LRE8 == 1 and patE8 == 57 and st3E8 == 3 then                   --Chair                                       
X_pos_E8 = X_pos_E8-1 ; Y_pos_E8 = Y_pos_E8-14 ; WgtE8 = WgtE8+9 ; HgtE8 = HgtE8+20   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                            
elseif OIe8 == 255 and Ehp8 == 2 and LRE8 == 0 and patE8 == 57 and st3E8 == 3 then                   --Chair                            
X_pos_E8 = X_pos_E8-2 ; Y_pos_E8 = Y_pos_E8-14 ; WgtE8 = WgtE8+9 ; HgtE8 = HgtE8+20   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 1 and patE8 == 57 and st3E8 == 4
  or OIe8 == 255 and Ehp8 == 3 and LRE8 == 1 and patE8 == 56 and st3E8 == 4 then                     --falcon                                       
X_pos_E8 = X_pos_E8-1 ; Y_pos_E8 = Y_pos_E8-16 ; WgtE8 = WgtE8+24 ; HgtE8 = HgtE8+16   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                            
elseif OIe8 == 255 and Ehp8 == 3 and LRE8 == 0 and patE8 == 57 and st3E8 == 4 
  or OIe8 == 255 and Ehp8 == 3 and LRE8 == 0 and patE8 == 56 and st3E8 == 4 then                     --falcon                             
X_pos_E8 = X_pos_E8-2 ; Y_pos_E8 = Y_pos_E8-16 ; WgtE8 = WgtE8+24 ; HgtE8 = HgtE8+16   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)
elseif OIe8 == 255 and Ehp8 == 2 and LRE8 == 1 and patE8 == 58 and st3E8 == 3 then                   --Painting pictures                                       
X_pos_E8 = X_pos_E8-2 ; Y_pos_E8 = Y_pos_E8-15 ; WgtE8 = WgtE8+12 ; HgtE8 = HgtE8+19  
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                            
elseif OIe8 == 255 and Ehp8 == 2 and LRE8 == 0 and patE8 == 58 and st3E8 == 3 then                   --Painting pictures                            
X_pos_E8 = X_pos_E8 ; Y_pos_E8 = Y_pos_E8-15 ; WgtE8 = WgtE8+12 ; HgtE8 = HgtE8+19   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink) 
elseif OIe8 == 255 and Ehp8 == 2 and LRE8 == 1 and patE8 == 58 and st3E8 == 4 then                   --Table doomed                                        
X_pos_E8 = X_pos_E8-1 ; Y_pos_E8 = Y_pos_E8-15 ; WgtE8 = WgtE8+20 ; HgtE8 = HgtE8+12   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                            
elseif OIe8 == 255 and Ehp8 == 2 and LRE8 == 0 and patE8 == 58 and st3E8 == 4 then                   --Table doomed                           
X_pos_E8 = X_pos_E8-2 ; Y_pos_E8 = Y_pos_E8-15 ; WgtE8 = WgtE8+20 ; HgtE8 = HgtE8+12   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink) 
elseif OIe8 == 255 and Ehp8 == 1 and LRE8 == 1 and patE8 == 58 and st3E8 == 2 then                   --Candle                                      
X_pos_E8 = X_pos_E8-1 ; Y_pos_E8 = Y_pos_E8-16 ; WgtE8 = WgtE8+8 ; HgtE8 = HgtE8+4   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                            
elseif OIe8 == 255 and Ehp8 == 1 and LRE8 == 0 and patE8 == 58 and st3E8 == 2 then                   --Candle                          
X_pos_E8 = X_pos_E8-2 ; Y_pos_E8 = Y_pos_E8-16 ; WgtE8 = WgtE8+8 ; HgtE8 = HgtE8+4   
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,pink)                      

end

if Ehp8 == 0 then                              -- stop hitbox enemy8
X_pos_E8 = X_pos_E8+1 ; Y_pos_E8 = Y_pos_E8-14       
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,NO8)
elseif Ehp8 > 0 and OIe8 == 0 then
gui.drawRectangle(X_pos_E8,Y_pos_E8,WgtE8,HgtE8,NO8)

end
end

local function Enemy9_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX9 = mainmemory.read_u8              --X coordinate
local YY9 = mainmemory.read_u8              --Y coordinate
local enemy9_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E9 = mainmemory.read_u8         --state1 
local stat2_E9 = mainmemory.read_u8         --state2 
local stat3_E9 = mainmemory.read_u8         --state3 
local stat4_E9 = mainmemory.read_u8         --state4 
local pat_E9 = mainmemory.read_u8           --pattern select
local pat_count_E9 = mainmemory.read_u8     --pattern start count
local RES_pat_E9 = mainmemory.read_u8       --result pattern
local LR_E9 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E9 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp9 = enemy9_hp(0x0C61)
local st1E9 = stat1_E9(0x0C78)
local st2E9 = stat2_E9(0x0C79)
local st3E9 = stat3_E9(0x0C7A)
local st4E9 = stat4_E9(0x0C7B)
local patE9 = pat_E9(0x0C67)
local PATcE9 = pat_count_E9(0x0C7F)
local RpatE9 = RES_pat_E9(0x0C7E)
local LRE9 = LR_E9(0x0C70)
local OIe9 = OI_E9(0x0C60)
local X_pos_E9 = XX9(0x0C64)
local Y_pos_E9 = YY9(0x0C62)
local WgtE9 = 10
local HgtE9 = 10
local orange = 0xFFFF6600
local NO9 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,NO9)

elseif OIe9 == 255 and Ehp9 == 1 and LRE9 == 1 and patE9 == 50 and st3E9 == 1 then                       --Bat                                        
X_pos_E9 = X_pos_E9-1 ; Y_pos_E9 = Y_pos_E9-16 ; WgtE9 = WgtE9+8 ; HgtE9 = HgtE9+4   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                            
elseif OIe9 == 255 and Ehp9 == 1 and LRE9 == 0 and patE9 == 50 and st3E9 == 1 then                   --Bat                             
X_pos_E9 = X_pos_E9-2 ; Y_pos_E9 = Y_pos_E9-16 ; WgtE9 = WgtE9+8 ; HgtE9 = HgtE9+4   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                                                   
elseif OIe9 == 255 and Ehp9 == 2 and LRE9 == 1 and st1E9 == 16 and st2E9 == 32 and st3E9 == 2 and st4E9 == 2 
  or OIe9 == 255 and Ehp9 == 2 and LRE9 == 1 and st1E9 == 16 and st2E9 == 0 and st3E9 == 2 and st4E9 == 2 then  --Dog                           
X_pos_E9 = X_pos_E9+1 ; Y_pos_E9 = Y_pos_E9-17 ; WgtE9 = WgtE9+20 ; HgtE9 = HgtE9+7  
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                                  
elseif OIe9 == 255 and Ehp9 == 2 and LRE9 == 0 and st1E9 == 16 and st2E9 == 32 and st3E9 == 2 and st4E9 == 2 
  or OIe9 == 255 and Ehp9 == 2 and LRE9 == 0 and st1E9 == 16 and st2E9 == 0 and st3E9 == 2 and st4E9 == 2 then  --Dog                             
X_pos_E9 = X_pos_E9+1 ; Y_pos_E9 = Y_pos_E9-17 ; WgtE9 = WgtE9+20 ; HgtE9 = HgtE9+7  
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                                  
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 1 and st1E9 == 16 and st2E9 == 32 and st3E9 == 3 and st4E9 == 3 then  --super dog       
X_pos_E9 = X_pos_E9 ; Y_pos_E9 = Y_pos_E9-17 ; WgtE9 = WgtE9+20 ; HgtE9 = HgtE9+7  
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 0 and st1E9 == 16 and st2E9 == 32 and st3E9 == 3 and st4E9 == 3 then  --super dog       
X_pos_E9 = X_pos_E9 ; Y_pos_E9 = Y_pos_E9-17 ; WgtE9 = WgtE9+20 ; HgtE9 = HgtE9+7  
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)
elseif OIe9 == 255 and Ehp9 == 2 and LRE9 == 1 and patE9 >= 52 and st3E9 == 2 then                                 --ghost girl                             
X_pos_E9 = X_pos_E9-4 ; Y_pos_E9 = Y_pos_E9-17 ; WgtE9 = WgtE9+12 ; HgtE9 = HgtE9+23  
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                                  
elseif OIe9 == 255 and Ehp9 == 2 and LRE9 == 0 and patE9 == 52 and st3E9 == 2 then                                 --ghost girl             
X_pos_E9 = X_pos_E9-3 ; Y_pos_E9 = Y_pos_E9-17 ; WgtE9 = WgtE9+12 ; HgtE9 = HgtE9+23  
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 1 and patE9 >= 52  
and st1E9 == 32 and st2E9 == 16 and st3E9 == 3 and st4E9 == 3 then                                                 --Super ghost girl                             
X_pos_E9 = X_pos_E9-4 ; Y_pos_E9 = Y_pos_E9-17 ; WgtE9 = WgtE9+12 ; HgtE9 = HgtE9+23  
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                                 
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 0 and patE9 == 52 
and st1E9 == 32 and st2E9 == 16 and st3E9 == 3 and st4E9 == 3 then                                                 --Super ghost girl             
X_pos_E9 = X_pos_E9-3 ; Y_pos_E9 = Y_pos_E9-17 ; WgtE9 = WgtE9+12 ; HgtE9 = HgtE9+23  
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                    
elseif OIe9 == 255 and Ehp9 >= 2 and LRE9 == 1 and patE9 == 53 and st3E9 >= 3 then                                 --Goblin , super goblin                            
X_pos_E9 = X_pos_E9-4 ; Y_pos_E9 = Y_pos_E9-17 ; WgtE9 = WgtE9+10 ; HgtE9 = HgtE9+23  
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                                  
elseif OIe9 == 255 and Ehp9 >= 2 and LRE9 == 0 and patE9 == 53 and st3E9 >= 3 then                                 --Goblin , super goblin            
X_pos_E9 = X_pos_E9 ; Y_pos_E9 = Y_pos_E9-17 ; WgtE9 = WgtE9+10 ; HgtE9 = HgtE9+23  
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                     
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 1 and patE9 <= 52 and st3E9 == 3 
and st1E9 == 40 and st2E9 == 16 and st3E9 == 3 and st4E9 == 2 
  or OIe9 == 255 and Ehp9 == 3 and LRE9 == 1 and patE9 <= 52 and st3E9 == 3 
and st1E9 == 40 and st2E9 == 0 and st3E9 == 3 and st4E9 == 2 then                                                 --Strange man                               
X_pos_E9 = X_pos_E9 ; Y_pos_E9 = Y_pos_E9-16 ; WgtE9 = WgtE9+7 ; HgtE9 = HgtE9+30 
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                            
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 0 and patE9 == 51 and st3E9 == 3 
and st1E9 == 40 and st2E9 == 16 and st3E9 == 3 and st4E9 == 2 
  or OIe9 == 255 and Ehp9 == 3 and LRE9 == 0 and patE9 <= 52 and st3E9 == 3 
and st1E9 == 40 and st2E9 == 0 and st3E9 == 3 and st4E9 == 2 then                                                 --Strange man                            
X_pos_E9 = X_pos_E9-1 ; Y_pos_E9 = Y_pos_E9-16 ; WgtE9 = WgtE9+7 ; HgtE9 = HgtE9+30 
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                           
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 1 and patE9 == 55 and st3E9 == 4 then                                 --Skeleton                              
X_pos_E9 = X_pos_E9-8 ; Y_pos_E9 = Y_pos_E9-17 ; WgtE9 = WgtE9+15 ; HgtE9 = HgtE9+30 
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                            
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 0 and patE9 == 55 and st3E9 == 4 then                                 --Skeleton                              
X_pos_E9 = X_pos_E9-1 ; Y_pos_E9 = Y_pos_E9-17 ; WgtE9 = WgtE9+15 ; HgtE9 = HgtE9+30 
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 1 and patE9 == 54 and st3E9 == 3 then                                 --Wax dolls                           
X_pos_E9 = X_pos_E9-2 ; Y_pos_E9 = Y_pos_E9-14 ; WgtE9 = WgtE9+11 ; HgtE9 = HgtE9+28 
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                            
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 0 and patE9 == 54 and st3E9 == 3 then                                 --Wax dolls                           
X_pos_E9 = X_pos_E9-2 ; Y_pos_E9 = Y_pos_E9-14 ; WgtE9 = WgtE9+11 ; HgtE9 = HgtE9+28 
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 1 and patE9 >= 55 and patE9 <= 56 and st3E9 == 3 
 and st1E9 == 32 and st2E9 == 16 and st3E9 == 3 and st4E9 == 2 
  or OIe9 == 255 and Ehp9 == 3 and LRE9 == 1 and patE9 >= 55 and patE9 <= 56 and st3E9 == 3 
 and st1E9 == 32 and st2E9 == 0 and st3E9 == 3 and st4E9 == 2 then                                                          --Magician                                       
X_pos_E9 = X_pos_E9-1 ; Y_pos_E9 = Y_pos_E9-16 ; WgtE9 = WgtE9+7 ; HgtE9 = HgtE9+22   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                            
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 0 and patE9 >= 55 and patE9 <= 56 and st3E9 == 3 
 and st1E9 == 32 and st2E9 == 16 and st3E9 == 3 and st4E9 == 2 
  or OIe9 == 255 and Ehp9 == 3 and LRE9 == 0 and patE9 >= 55 and patE9 <= 56 and st3E9 == 3 
 and st1E9 == 32 and st2E9 == 0 and st3E9 == 3 and st4E9 == 2 then                                                           --Magician                             
X_pos_E9 = X_pos_E9-3 ; Y_pos_E9 = Y_pos_E9-16 ; WgtE9 = WgtE9+7 ; HgtE9 = HgtE9+22  
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange) 
elseif OIe9 == 255 and Ehp9 == 1 and LRE9 == 1 and patE9 == 57 and st3E9 == 1 then                                 --Knife                                        
X_pos_E9 = X_pos_E9-2 ; Y_pos_E9 = Y_pos_E9-16 ; WgtE9 = WgtE9 ; HgtE9 = HgtE9   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                            
elseif OIe9 == 255 and Ehp9 == 1 and LRE9 == 0 and patE9 == 57 and st3E9 == 1 then                                 --Knife                            
X_pos_E9 = X_pos_E9-2 ; Y_pos_E9 = Y_pos_E9-16 ; WgtE9 = WgtE9 ; HgtE9 = HgtE9   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange) 
elseif OIe9 == 255 and Ehp9 == 2 and LRE9 == 1 and patE9 == 57 and st3E9 == 3 then                                 --Chair                                       
X_pos_E9 = X_pos_E9-1 ; Y_pos_E9 = Y_pos_E9-14 ; WgtE9 = WgtE9+9 ; HgtE9 = HgtE9+20   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                            
elseif OIe9 == 255 and Ehp9 == 2 and LRE9 == 0 and patE9 == 57 and st3E9 == 3 then                                 --Chair                            
X_pos_E9 = X_pos_E9-2 ; Y_pos_E9 = Y_pos_E9-14 ; WgtE9 = WgtE9+9 ; HgtE9 = HgtE9+20   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 1 and patE9 == 57 and st3E9 == 4
  or OIe9 == 255 and Ehp9 == 3 and LRE9 == 1 and patE9 == 56 and st3E9 == 4 then                                   --falcon                                       
X_pos_E9 = X_pos_E9-1 ; Y_pos_E9 = Y_pos_E9-16 ; WgtE9 = WgtE9+24 ; HgtE9 = HgtE9+16   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                            
elseif OIe9 == 255 and Ehp9 == 3 and LRE9 == 0 and patE9 == 57 and st3E9 == 4 
  or OIe9 == 255 and Ehp9 == 3 and LRE9 == 0 and patE9 == 56 and st3E9 == 4 then                                   --falcon                             
X_pos_E9 = X_pos_E9-2 ; Y_pos_E9 = Y_pos_E9-16 ; WgtE9 = WgtE9+24 ; HgtE9 = HgtE9+16   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)
elseif OIe9 == 255 and Ehp9 == 2 and LRE9 == 1 and patE9 == 58 and st3E9 == 3 then                                 --Painting pictures                                       
X_pos_E9 = X_pos_E9-2 ; Y_pos_E9 = Y_pos_E9-15 ; WgtE9 = WgtE9+12 ; HgtE9 = HgtE9+19  
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                            
elseif OIe9 == 255 and Ehp9 == 2 and LRE9 == 0 and patE9 == 58 and st3E9 == 3 then                                 --Painting pictures                            
X_pos_E9 = X_pos_E9 ; Y_pos_E9 = Y_pos_E9-15 ; WgtE9 = WgtE9+12 ; HgtE9 = HgtE9+19   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange) 
elseif OIe9 == 255 and Ehp9 == 2 and LRE9 == 1 and patE9 == 58 and st3E9 == 4 then                                 --Table doomed                                        
X_pos_E9 = X_pos_E9-1 ; Y_pos_E9 = Y_pos_E9-15 ; WgtE9 = WgtE9+20 ; HgtE9 = HgtE9+12   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                            
elseif OIe9 == 255 and Ehp9 == 2 and LRE9 == 0 and patE9 == 58 and st3E9 == 4 then                                 --Table doomed                           
X_pos_E9 = X_pos_E9-2 ; Y_pos_E9 = Y_pos_E9-15 ; WgtE9 = WgtE9+20 ; HgtE9 = HgtE9+12   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange) 
elseif OIe9 == 255 and Ehp9 == 1 and LRE9 == 1 and patE9 == 58 and st3E9 == 2 then                                 --Candle                                      
X_pos_E9 = X_pos_E9-1 ; Y_pos_E9 = Y_pos_E9-16 ; WgtE9 = WgtE9+8 ; HgtE9 = HgtE9+4   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                            
elseif OIe9 == 255 and Ehp9 == 1 and LRE9 == 0 and patE9 == 58 and st3E9 == 2 then                                 --Candle                          
X_pos_E9 = X_pos_E9-2 ; Y_pos_E9 = Y_pos_E9-16 ; WgtE9 = WgtE9+8 ; HgtE9 = HgtE9+4   
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,orange)                      

end

if Ehp9 == 0 then                              -- stop hitbox enemy9
X_pos_E9 = X_pos_E9+1 ; Y_pos_E9 = Y_pos_E9-14       
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,NO9)
elseif Ehp9 > 0 and OIe9 == 0 then
gui.drawRectangle(X_pos_E9,Y_pos_E9,WgtE9,HgtE9,NO9)

end
end

local function Enemy10_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX10 = mainmemory.read_u8              --X coordinate
local YY10 = mainmemory.read_u8              --Y coordinate
local enemy10_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E10 = mainmemory.read_u8         --state1 
local stat2_E10 = mainmemory.read_u8         --state2 
local stat3_E10 = mainmemory.read_u8         --state3 
local stat4_E10 = mainmemory.read_u8         --state4 
local pat_E10 = mainmemory.read_u8           --pattern select
local pat_count_E10 = mainmemory.read_u8     --pattern start count
local RES_pat_E10 = mainmemory.read_u8       --result pattern
local LR_E10 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E10 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp10 = enemy10_hp(0x0C81)
local st1E10 = stat1_E10(0x0C98)
local st2E10 = stat2_E10(0x0C99)
local st3E10 = stat3_E10(0x0C9A)
local st4E10 = stat4_E10(0x0C9B)
local patE10 = pat_E10(0x0C87)
local PATcE10 = pat_count_E10(0x0C9F)
local RpatE10 = RES_pat_E10(0x0C9E)
local LRE10 = LR_E10(0x0C90)
local OIe10 = OI_E10(0x0C80)
local X_pos_E10 = XX10(0x0C84)
local Y_pos_E10 = YY10(0x0C82)
local WgtE10 = 10
local HgtE10 = 10
local greenf = 0xFF007700
local NO10 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,NO10)

elseif OIe10 == 255 and Ehp10 == 1 and LRE10 == 1 and patE10 == 50 and st3E10 == 1 then                       --Bat                                        
X_pos_E10 = X_pos_E10-1 ; Y_pos_E10 = Y_pos_E10-16 ; WgtE10 = WgtE10+8 ; HgtE10 = HgtE10+4   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                            
elseif OIe10 == 255 and Ehp10 == 1 and LRE10 == 0 and patE10 == 50 and st3E10 == 1 then                   --Bat                             
X_pos_E10 = X_pos_E10-2 ; Y_pos_E10 = Y_pos_E10-16 ; WgtE10 = WgtE10+8 ; HgtE10 = HgtE10+4   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                                                   
elseif OIe10 == 255 and Ehp10 == 2 and LRE10 == 1 and st1E10 == 16 and st2E10 == 32 and st3E10 == 2 and st4E10 == 2 
  or OIe10 == 255 and Ehp10 == 2 and LRE10 == 1 and st1E10 == 16 and st2E10 == 0 and st3E10 == 2 and st4E10 == 2 then  --Dog                           
X_pos_E10 = X_pos_E10+1 ; Y_pos_E10 = Y_pos_E10-17 ; WgtE10 = WgtE10+20 ; HgtE10 = HgtE10+7  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                                  
elseif OIe10 == 255 and Ehp10 == 2 and LRE10 == 0 and st1E10 == 16 and st2E10 == 32 and st3E10 == 2 and st4E10 == 2 
  or OIe10 == 255 and Ehp10 == 2 and LRE10 == 0 and st1E10 == 16 and st2E10 == 0 and st3E10 == 2 and st4E10 == 2 then  --Dog                             
X_pos_E10 = X_pos_E10+1 ; Y_pos_E10 = Y_pos_E10-17 ; WgtE10 = WgtE10+20 ; HgtE10 = HgtE10+7  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                                  
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 1 and st1E10 == 16 and st2E10 == 32 and st3E10 == 3 and st4E10 == 3 then  --super dog       
X_pos_E10 = X_pos_E10 ; Y_pos_E10 = Y_pos_E10-17 ; WgtE10 = WgtE10+20 ; HgtE10 = HgtE10+7  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 0 and st1E10 == 16 and st2E10 == 32 and st3E10 == 3 and st4E10 == 3 then  --super dog       
X_pos_E10 = X_pos_E10 ; Y_pos_E10 = Y_pos_E10-17 ; WgtE10 = WgtE10+20 ; HgtE10 = HgtE10+7  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)
elseif OIe10 == 255 and Ehp10 == 2 and LRE10 == 1 and patE10 >= 52 and st3E10 == 2 then                                 --ghost girl                             
X_pos_E10 = X_pos_E10-4 ; Y_pos_E10 = Y_pos_E10-17 ; WgtE10 = WgtE10+12 ; HgtE10 = HgtE10+23  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                                  
elseif OIe10 == 255 and Ehp10 == 2 and LRE10 == 0 and patE10 == 52 and st3E10 == 2 then                                 --ghost girl             
X_pos_E10 = X_pos_E10-3 ; Y_pos_E10 = Y_pos_E10-17 ; WgtE10 = WgtE10+12 ; HgtE10 = HgtE10+23  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 1 and patE10 >= 52  
and st1E10 == 32 and st2E10 == 16 and st3E10 == 3 and st4E10 == 3 then                                                 --Super ghost girl                             
X_pos_E10 = X_pos_E10-4 ; Y_pos_E10 = Y_pos_E10-17 ; WgtE10 = WgtE10+12 ; HgtE10 = HgtE10+23  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                                 
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 0 and patE10 == 52 
and st1E10 == 32 and st2E10 == 16 and st3E10 == 3 and st4E10 == 3 then                                                 --Super ghost girl             
X_pos_E10 = X_pos_E10-3 ; Y_pos_E10 = Y_pos_E10-17 ; WgtE10 = WgtE10+12 ; HgtE10 = HgtE10+23  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                    
elseif OIe10 == 255 and Ehp10 >= 2 and LRE10 == 1 and patE10 == 53 and st3E10 >= 3 then                                 --Goblin , super goblin                            
X_pos_E10 = X_pos_E10-4 ; Y_pos_E10 = Y_pos_E10-17 ; WgtE10 = WgtE10+10 ; HgtE10 = HgtE10+23  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                                  
elseif OIe10 == 255 and Ehp10 >= 2 and LRE10 == 0 and patE10 == 53 and st3E10 >= 3 then                                 --Goblin , super goblin            
X_pos_E10 = X_pos_E10 ; Y_pos_E10 = Y_pos_E10-17 ; WgtE10 = WgtE10+10 ; HgtE10 = HgtE10+23  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                     
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 1 and patE10 <= 52 and st3E10 == 3 
and st1E10 == 40 and st2E10 == 16 and st3E10 == 3 and st4E10 == 2 
  or OIe10 == 255 and Ehp10 == 3 and LRE10 == 1 and patE10 <= 52 and st3E10 == 3 
and st1E10 == 40 and st2E10 == 0 and st3E10 == 3 and st4E10 == 2 then                                                      --Strange man                               
X_pos_E10 = X_pos_E10 ; Y_pos_E10 = Y_pos_E10-16 ; WgtE10 = WgtE10+7 ; HgtE10 = HgtE10+30 
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                            
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 0 and patE10 == 51 and st3E10 == 3 
and st1E10 == 40 and st2E10 == 16 and st3E10 == 3 and st4E10 == 2 
  or OIe10 == 255 and Ehp10 == 3 and LRE10 == 0 and patE10 <= 52 and st3E10 == 3 
and st1E10 == 40 and st2E10 == 0 and st3E10 == 3 and st4E10 == 2 then                                                      --Strange man                            
X_pos_E10 = X_pos_E10-1 ; Y_pos_E10 = Y_pos_E10-16 ; WgtE10 = WgtE10+7 ; HgtE10 = HgtE10+30 
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                           
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 1 and patE10 == 55 and st3E10 == 4 then                                 --Skeleton                              
X_pos_E10 = X_pos_E10-8 ; Y_pos_E10 = Y_pos_E10-17 ; WgtE10 = WgtE10+15 ; HgtE10 = HgtE10+30 
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                            
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 0 and patE10 == 55 and st3E10 == 4 then                                 --Skeleton                              
X_pos_E10 = X_pos_E10-1 ; Y_pos_E10 = Y_pos_E10-17 ; WgtE10 = WgtE10+15 ; HgtE10 = HgtE10+30 
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 1 and patE10 == 54 and st3E10 == 3 then                                 --Wax dolls                           
X_pos_E10 = X_pos_E10-2 ; Y_pos_E10 = Y_pos_E10-14 ; WgtE10 = WgtE10+11 ; HgtE10 = HgtE10+28 
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                            
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 0 and patE10 == 54 and st3E10 == 3 then                                 --Wax dolls                           
X_pos_E10 = X_pos_E10-2 ; Y_pos_E10 = Y_pos_E10-14 ; WgtE10 = WgtE10+11 ; HgtE10 = HgtE10+28 
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 1 and patE10 >= 55 and patE10 <= 56 and st3E10 == 3 
 and st1E10 == 32 and st2E10 == 16 and st3E10 == 3 and st4E10 == 2 
  or OIe10 == 255 and Ehp10 == 3 and LRE10 == 1 and patE10 >= 55 and patE10 <= 56 and st3E10 == 3 
 and st1E10 == 32 and st2E10 == 0 and st3E10 == 3 and st4E10 == 2 then                                                          --Magician                                       
X_pos_E10 = X_pos_E10-1 ; Y_pos_E10 = Y_pos_E10-16 ; WgtE10 = WgtE10+7 ; HgtE10 = HgtE10+22   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                            
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 0 and patE10 >= 55 and patE10 <= 56 and st3E10 == 3 
 and st1E10 == 32 and st2E10 == 16 and st3E10 == 3 and st4E10 == 2 
  or OIe10 == 255 and Ehp10 == 3 and LRE10 == 0 and patE10 >= 55 and patE10 <= 56 and st3E10 == 3 
 and st1E10 == 32 and st2E10 == 0 and st3E10 == 3 and st4E10 == 2 then                                                          --Magician                             
X_pos_E10 = X_pos_E10-3 ; Y_pos_E10 = Y_pos_E10-16 ; WgtE10 = WgtE10+7 ; HgtE10 = HgtE10+22  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf) 
elseif OIe10 == 255 and Ehp10 == 1 and LRE10 == 1 and patE10 == 57 and st3E10 == 1 then                                 --Knife                                        
X_pos_E10 = X_pos_E10-2 ; Y_pos_E10 = Y_pos_E10-16 ; WgtE10 = WgtE10 ; HgtE10 = HgtE10   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                            
elseif OIe10 == 255 and Ehp10 == 1 and LRE10 == 0 and patE10 == 57 and st3E10 == 1 then                                 --Knife                            
X_pos_E10 = X_pos_E10-2 ; Y_pos_E10 = Y_pos_E10-16 ; WgtE10 = WgtE10 ; HgtE10 = HgtE10   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf) 
elseif OIe10 == 255 and Ehp10 == 2 and LRE10 == 1 and patE10 == 57 and st3E10 == 3 then                                 --Chair                                       
X_pos_E10 = X_pos_E10-1 ; Y_pos_E10 = Y_pos_E10-14 ; WgtE10 = WgtE10+9 ; HgtE10 = HgtE10+20   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                            
elseif OIe10 == 255 and Ehp10 == 2 and LRE10 == 0 and patE10 == 57 and st3E10 == 3 then                                 --Chair                            
X_pos_E10 = X_pos_E10-2 ; Y_pos_E10 = Y_pos_E10-14 ; WgtE10 = WgtE10+9 ; HgtE10 = HgtE10+20   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 1 and patE10 == 57 and st3E10 == 4
  or OIe10 == 255 and Ehp10 == 3 and LRE10 == 1 and patE10 == 56 and st3E10 == 4 then                                   --falcon                                       
X_pos_E10 = X_pos_E10-1 ; Y_pos_E10 = Y_pos_E10-16 ; WgtE10 = WgtE10+24 ; HgtE10 = HgtE10+16   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                            
elseif OIe10 == 255 and Ehp10 == 3 and LRE10 == 0 and patE10 == 57 and st3E10 == 4 
  or OIe10 == 255 and Ehp10 == 3 and LRE10 == 0 and patE10 == 56 and st3E10 == 4 then                                   --falcon                             
X_pos_E10 = X_pos_E10-2 ; Y_pos_E10 = Y_pos_E10-16 ; WgtE10 = WgtE10+24 ; HgtE10 = HgtE10+16   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)
elseif OIe10 == 255 and Ehp10 == 2 and LRE10 == 1 and patE10 == 58 and st3E10 == 3 then                                 --Painting pictures                                       
X_pos_E10 = X_pos_E10-2 ; Y_pos_E10 = Y_pos_E10-15 ; WgtE10 = WgtE10+12 ; HgtE10 = HgtE10+19  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                            
elseif OIe10 == 255 and Ehp10 == 2 and LRE10 == 0 and patE10 == 58 and st3E10 == 3 then                                 --Painting pictures                            
X_pos_E10 = X_pos_E10 ; Y_pos_E10 = Y_pos_E10-15 ; WgtE10 = WgtE10+12 ; HgtE10 = HgtE10+19   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf) 
elseif OIe10 == 255 and Ehp10 == 2 and LRE10 == 1 and patE10 == 58 and st3E10 == 4 then                                 --Table doomed                                        
X_pos_E10 = X_pos_E10-1 ; Y_pos_E10 = Y_pos_E10-15 ; WgtE10 = WgtE10+20 ; HgtE10 = HgtE10+12   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                            
elseif OIe10 == 255 and Ehp10 == 2 and LRE10 == 0 and patE10 == 58 and st3E10 == 4 then                                 --Table doomed                           
X_pos_E10 = X_pos_E10-2 ; Y_pos_E10 = Y_pos_E10-15 ; WgtE10 = WgtE10+20 ; HgtE10 = HgtE10+12  
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf) 
elseif OIe10 == 255 and Ehp10 == 1 and LRE10 == 1 and patE10 == 58 and st3E10 == 2 then                                 --Candle                                      
X_pos_E10 = X_pos_E10-1 ; Y_pos_E10 = Y_pos_E10-16 ; WgtE10 = WgtE10+8 ; HgtE10 = HgtE10+4   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                            
elseif OIe10 == 255 and Ehp10 == 1 and LRE10 == 0 and patE10 == 58 and st3E10 == 2 then                                 --Candle                          
X_pos_E10 = X_pos_E10-2 ; Y_pos_E10 = Y_pos_E10-16 ; WgtE10 = WgtE10+8 ; HgtE10 = HgtE10+4   
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,greenf)                      

end

if Ehp10 == 0 then                              -- stop hitbox enemy10
X_pos_E10 = X_pos_E10+1 ; Y_pos_E10 = Y_pos_E10-14       
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,NO10)
elseif Ehp10 > 0 and OIe10 == 0 then
gui.drawRectangle(X_pos_E10,Y_pos_E10,WgtE10,HgtE10,NO10)

end
end

local function Enemy11_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX11 = mainmemory.read_u8              --X coordinate
local YY11 = mainmemory.read_u8              --Y coordinate
local enemy11_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E11 = mainmemory.read_u8         --state1 
local stat2_E11 = mainmemory.read_u8         --state2 
local stat3_E11 = mainmemory.read_u8         --state3 
local stat4_E11 = mainmemory.read_u8         --state4 
local pat_E11 = mainmemory.read_u8           --pattern select
local pat_count_E11 = mainmemory.read_u8     --pattern start count
local RES_pat_E11 = mainmemory.read_u8       --result pattern
local LR_E11 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E11 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp11 = enemy11_hp(0x0CA1)
local st1E11 = stat1_E11(0x0CB8)
local st2E11 = stat2_E11(0x0CB9)
local st3E11 = stat3_E11(0x0CBA)
local st4E11 = stat4_E11(0x0CBB)
local patE11 = pat_E11(0x0CA7)
local PATcE11 = pat_count_E11(0x0CBF)
local RpatE11 = RES_pat_E11(0x0CBE)
local LRE11 = LR_E11(0x0CB0)
local OIe11 = OI_E11(0x0CA0)
local X_pos_E11 = XX11(0x0CA4)
local Y_pos_E11 = YY11(0x0CA2)
local WgtE11 = 10
local HgtE11 = 10
local brown = 0xFF663300
local NO11 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,NO11)

elseif OIe11 == 255 and Ehp11 == 1 and LRE11 == 1 and patE11 == 50 and st3E11 == 1 then                       --Bat                                        
X_pos_E11 = X_pos_E11-1 ; Y_pos_E11 = Y_pos_E11-16 ; WgtE11 = WgtE11+8 ; HgtE11 = HgtE11+4   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                            
elseif OIe11 == 255 and Ehp11 == 1 and LRE11 == 0 and patE11 == 50 and st3E11 == 1 then                   --Bat                             
X_pos_E11 = X_pos_E11-2 ; Y_pos_E11 = Y_pos_E11-16 ; WgtE11 = WgtE11+8 ; HgtE11 = HgtE11+4   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                                                   
elseif OIe11 == 255 and Ehp11 == 2 and LRE11 == 1 and st1E11 == 16 and st2E11 == 32 and st3E11 == 2 and st4E11 == 2 
  or OIe11 == 255 and Ehp11 == 2 and LRE11 == 1 and st1E11 == 16 and st2E11 == 0 and st3E11 == 2 and st4E11 == 2 then  --Dog                           
X_pos_E11 = X_pos_E11+1 ; Y_pos_E11 = Y_pos_E11-17 ; WgtE11 = WgtE11+20 ; HgtE11 = HgtE11+7  
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                                  
elseif OIe11 == 255 and Ehp11 == 2 and LRE11 == 0 and st1E11 == 16 and st2E11 == 32 and st3E11 == 2 and st4E11 == 2 
  or OIe11 == 255 and Ehp11 == 2 and LRE11 == 0 and st1E11 == 16 and st2E11 == 0 and st3E11 == 2 and st4E11 == 2 then  --Dog                             
X_pos_E11 = X_pos_E11+1 ; Y_pos_E11 = Y_pos_E11-17 ; WgtE11 = WgtE11+20 ; HgtE11 = HgtE11+7  
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                                  
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 1 and st1E11 == 16 and st2E11 == 32 and st3E11 == 3 and st4E11 == 3 then  --super dog       
X_pos_E11 = X_pos_E11 ; Y_pos_E11 = Y_pos_E11-17 ; WgtE11 = WgtE11+20 ; HgtE11 = HgtE11+7  
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 0 and st1E11 == 16 and st2E11 == 32 and st3E11 == 3 and st4E11 == 3 then  --super dog       
X_pos_E11 = X_pos_E11 ; Y_pos_E11 = Y_pos_E11-17 ; WgtE11 = WgtE11+20 ; HgtE11 = HgtE11+7  
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)
elseif OIe11 == 255 and Ehp11 == 2 and LRE11 == 1 and patE11 >= 52 and st3E11 == 2 then                                 --ghost girl                             
X_pos_E11 = X_pos_E11-4 ; Y_pos_E11 = Y_pos_E11-17 ; WgtE11 = WgtE11+12 ; HgtE11 = HgtE11+23  
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                                  
elseif OIe11 == 255 and Ehp11 == 2 and LRE11 == 0 and patE11 == 52 and st3E11 == 2 then                                 --ghost girl             
X_pos_E11 = X_pos_E11-3 ; Y_pos_E11 = Y_pos_E11-17 ; WgtE11 = WgtE11+12 ; HgtE11 = HgtE11+23  
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 1 and patE11 >= 52  
and st1E11 == 32 and st2E11 == 16 and st3E11 == 3 and st4E11 == 3 then                                                 --Super ghost girl                             
X_pos_E11 = X_pos_E11-4 ; Y_pos_E11 = Y_pos_E11-17 ; WgtE11 = WgtE11+12 ; HgtE11 = HgtE11+23  
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                                 
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 0 and patE11 == 52 
and st1E11 == 32 and st2E11 == 16 and st3E11 == 3 and st4E11 == 3 then                                                 --Super ghost girl             
X_pos_E11 = X_pos_E11-3 ; Y_pos_E11 = Y_pos_E11-17 ; WgtE11 = WgtE11+12 ; HgtE11 = HgtE11+23  
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                    
elseif OIe11 == 255 and Ehp11 >= 2 and LRE11 == 1 and patE11 == 53 and st3E11 >= 3 then                                 --Goblin , super goblin                            
X_pos_E11 = X_pos_E11-4 ; Y_pos_E11 = Y_pos_E11-17 ; WgtE11 = WgtE11+10 ; HgtE11 = HgtE11+23  
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                                  
elseif OIe11 == 255 and Ehp11 >= 2 and LRE11 == 0 and patE11 == 53 and st3E11 >= 3 then                                 --Goblin , super goblin            
X_pos_E11 = X_pos_E11 ; Y_pos_E11 = Y_pos_E11-17 ; WgtE11 = WgtE11+10 ; HgtE11 = HgtE11+23  
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                     
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 1 and patE11 <= 52 and st3E11 == 3 
and st1E11 == 40 and st2E11 == 16 and st3E11 == 3 and st4E11 == 2 
  or OIe11 == 255 and Ehp11 == 3 and LRE11 == 1 and patE11 <= 52 and st3E11 == 3 
and st1E11 == 40 and st2E11 == 0 and st3E11 == 3 and st4E11 == 2 then                                                      --Strange man                               
X_pos_E11 = X_pos_E11 ; Y_pos_E11 = Y_pos_E11-16 ; WgtE11 = WgtE11+7 ; HgtE11 = HgtE11+30 
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                            
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 0 and patE11 == 51 and st3E11 == 3 
and st1E11 == 40 and st2E11 == 16 and st3E11 == 3 and st4E11 == 2 
  or OIe11 == 255 and Ehp11 == 3 and LRE11 == 0 and patE11 <= 52 and st3E11 == 3 
and st1E11 == 40 and st2E11 == 0 and st3E11 == 3 and st4E11 == 2 then                                                      --Strange man                            
X_pos_E11 = X_pos_E11-1 ; Y_pos_E11 = Y_pos_E11-16 ; WgtE11 = WgtE11+7 ; HgtE11 = HgtE11+30 
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                           
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 1 and patE11 == 55 and st3E11 == 4 then                                 --Skeleton                              
X_pos_E11 = X_pos_E11-8 ; Y_pos_E11 = Y_pos_E11-17 ; WgtE11 = WgtE11+15 ; HgtE11 = HgtE11+30 
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                            
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 0 and patE11 == 55 and st3E11 == 4 then                                 --Skeleton                              
X_pos_E11 = X_pos_E11-1 ; Y_pos_E11 = Y_pos_E11-17 ; WgtE11 = WgtE11+15 ; HgtE11 = HgtE11+30 
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 1 and patE11 == 54 and st3E11 == 3 then                                 --Wax dolls                           
X_pos_E11 = X_pos_E11-2 ; Y_pos_E11 = Y_pos_E11-14 ; WgtE11 = WgtE11+11 ; HgtE11 = HgtE11+28 
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                            
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 0 and patE11 == 54 and st3E11 == 3 then                                 --Wax dolls                           
X_pos_E11 = X_pos_E11-2 ; Y_pos_E11 = Y_pos_E11-14 ; WgtE11 = WgtE11+11 ; HgtE11 = HgtE11+28 
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 1 and patE11 >= 55 and patE11 <= 56 and st3E11 == 3 
 and st1E11 == 32 and st2E11 == 16 and st3E11 == 3 and st4E11 == 2 
  or OIe11 == 255 and Ehp11 == 3 and LRE11 == 1 and patE11 >= 55 and patE11 <= 56 and st3E11 == 3 
 and st1E11 == 32 and st2E11 == 0 and st3E11 == 3 and st4E11 == 2 then                                                          --Magician                                       
X_pos_E11 = X_pos_E11-1 ; Y_pos_E11 = Y_pos_E11-16 ; WgtE11 = WgtE11+7 ; HgtE11 = HgtE11+22   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                            
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 0 and patE11 >= 55 and patE11 <= 56 and st3E11 == 3 
 and st1E11 == 32 and st2E11 == 16 and st3E11 == 3 and st4E11 == 2 
  or OIe11 == 255 and Ehp11 == 3 and LRE11 == 0 and patE11 >= 55 and patE11 <= 56 and st3E11 == 3 
 and st1E11 == 32 and st2E11 == 0 and st3E11 == 3 and st4E11 == 2 then                                                           --Magician                             
X_pos_E11 = X_pos_E11-3 ; Y_pos_E11 = Y_pos_E11-16 ; WgtE11 = WgtE11+7 ; HgtE11 = HgtE11+22  
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown) 
elseif OIe11 == 255 and Ehp11 == 1 and LRE11 == 1 and patE11 == 57 and st3E11 == 1 then                                 --Knife                                        
X_pos_E11 = X_pos_E11-2 ; Y_pos_E11 = Y_pos_E11-16 ; WgtE11 = WgtE11 ; HgtE11 = HgtE11   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                            
elseif OIe11 == 255 and Ehp11 == 1 and LRE11 == 0 and patE11 == 57 and st3E11 == 1 then                                 --Knife                            
X_pos_E11 = X_pos_E11-2 ; Y_pos_E11 = Y_pos_E11-16 ; WgtE11 = WgtE11 ; HgtE11 = HgtE11   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown) 
elseif OIe11 == 255 and Ehp11 == 2 and LRE11 == 1 and patE11 == 57 and st3E11 == 3 then                                 --Chair                                       
X_pos_E11 = X_pos_E11-1 ; Y_pos_E11 = Y_pos_E11-14 ; WgtE11 = WgtE11+9 ; HgtE11 = HgtE11+20   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                            
elseif OIe11 == 255 and Ehp11 == 2 and LRE11 == 0 and patE11 == 57 and st3E11 == 3 then                                 --Chair                            
X_pos_E11 = X_pos_E11-2 ; Y_pos_E11 = Y_pos_E11-14 ; WgtE11 = WgtE11+9 ; HgtE11 = HgtE11+20   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 1 and patE11 == 57 and st3E11 == 4
  or OIe11 == 255 and Ehp11 == 3 and LRE11 == 1 and patE11 == 56 and st3E11 == 4 then                                   --falcon                                       
X_pos_E11 = X_pos_E11-1 ; Y_pos_E11 = Y_pos_E11-16 ; WgtE11 = WgtE11+24 ; HgtE11 = HgtE11+16   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                            
elseif OIe11 == 255 and Ehp11 == 3 and LRE11 == 0 and patE11 == 57 and st3E11 == 4 
  or OIe11 == 255 and Ehp11 == 3 and LRE11 == 0 and patE11 == 56 and st3E11 == 4 then                                   --falcon                             
X_pos_E11 = X_pos_E11-2 ; Y_pos_E11 = Y_pos_E11-16 ; WgtE11 = WgtE11+24 ; HgtE11 = HgtE11+16   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)
elseif OIe11 == 255 and Ehp11 == 2 and LRE11 == 1 and patE11 == 58 and st3E11 == 3 then                                 --Painting pictures                                       
X_pos_E11 = X_pos_E11-2 ; Y_pos_E11 = Y_pos_E11-15 ; WgtE11 = WgtE11+12 ; HgtE11 = HgtE11+19  
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                            
elseif OIe11 == 255 and Ehp11 == 2 and LRE11 == 0 and patE11 == 58 and st3E11 == 3 then                                 --Painting pictures                            
X_pos_E11 = X_pos_E11 ; Y_pos_E11 = Y_pos_E11-15 ; WgtE11 = WgtE11+12 ; HgtE11 = HgtE11+19   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown) 
elseif OIe11 == 255 and Ehp11 == 2 and LRE11 == 1 and patE11 == 58 and st3E11 == 4 then                                 --Table doomed                                        
X_pos_E11 = X_pos_E11-1 ; Y_pos_E11 = Y_pos_E11-15 ; WgtE11 = WgtE11+20 ; HgtE11 = HgtE11+12   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                            
elseif OIe11 == 255 and Ehp11 == 2 and LRE11 == 0 and patE11 == 58 and st3E11 == 4 then                                 --Table doomed                           
X_pos_E11 = X_pos_E11-2 ; Y_pos_E11 = Y_pos_E11-15 ; WgtE11 = WgtE11+20 ; HgtE11 = HgtE11+12   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown) 
elseif OIe11 == 255 and Ehp11 == 1 and LRE11 == 1 and patE11 == 58 and st3E11 == 2 then                                 --Candle                                      
X_pos_E11 = X_pos_E11-1 ; Y_pos_E11 = Y_pos_E11-16 ; WgtE11 = WgtE11+8 ; HgtE11 = HgtE11+4   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                            
elseif OIe11 == 255 and Ehp11 == 1 and LRE11 == 0 and patE11 == 58 and st3E11 == 2 then                                 --Candle                          
X_pos_E11 = X_pos_E11-2 ; Y_pos_E11 = Y_pos_E11-16 ; WgtE11 = WgtE11+8 ; HgtE11 = HgtE11+4   
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,brown)                      

end

if Ehp11 == 0 then                              -- stop hitbox enemy11
X_pos_E11 = X_pos_E11+1 ; Y_pos_E11 = Y_pos_E11-14       
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,NO11)
elseif Ehp11 > 0 and OIe11 == 0 then
gui.drawRectangle(X_pos_E11,Y_pos_E11,WgtE11,HgtE11,NO11)

end
end

local function Enemy12_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX12 = mainmemory.read_u8              --X coordinate
local YY12 = mainmemory.read_u8              --Y coordinate
local enemy12_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E12 = mainmemory.read_u8         --state1 
local stat2_E12 = mainmemory.read_u8         --state2 
local stat3_E12 = mainmemory.read_u8         --state3 
local stat4_E12 = mainmemory.read_u8         --state4 
local pat_E12 = mainmemory.read_u8           --pattern select
local pat_count_E12 = mainmemory.read_u8     --pattern start count
local RES_pat_E12 = mainmemory.read_u8       --result pattern
local LR_E12 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E12 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp12 = enemy12_hp(0x0CC1)
local st1E12 = stat1_E12(0x0CD8)
local st2E12 = stat2_E12(0x0CD9)
local st3E12 = stat3_E12(0x0CDA)
local st4E12 = stat4_E12(0x0CDB)
local patE12 = pat_E12(0x0CC7)
local PATcE12 = pat_count_E12(0x0CDF)
local RpatE12 = RES_pat_E12(0x0CDE)
local LRE12 = LR_E12(0x0CD0)
local OIe12 = OI_E12(0x0CC0)
local X_pos_E12 = XX12(0x0CC4)
local Y_pos_E12 = YY12(0x0CC2)
local WgtE12 = 10
local HgtE12 = 10
local antgrey = 0xFF888888
local NO12 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,NO12)

elseif OIe12 == 255 and Ehp12 == 1 and LRE12 == 1 and patE12 == 50 and st3E12 == 1 then                       --Bat                                        
X_pos_E12 = X_pos_E12-1 ; Y_pos_E12 = Y_pos_E12-16 ; WgtE12 = WgtE12+8 ; HgtE12 = HgtE12+4   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                            
elseif OIe12 == 255 and Ehp12 == 1 and LRE12 == 0 and patE12 == 50 and st3E12 == 1 then                   --Bat                             
X_pos_E12 = X_pos_E12-2 ; Y_pos_E12 = Y_pos_E12-16 ; WgtE12 = WgtE12+8 ; HgtE12 = HgtE12+4   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                                                   
elseif OIe12 == 255 and Ehp12 == 2 and LRE12 == 1 and st1E12 == 16 and st2E12 == 32 and st3E12 == 2 and st4E12 == 2 
  or OIe12 == 255 and Ehp12 == 2 and LRE12 == 1 and st1E12 == 16 and st2E12 == 0 and st3E12 == 2 and st4E12 == 2 then  --Dog                           
X_pos_E12 = X_pos_E12+1 ; Y_pos_E12 = Y_pos_E12-17 ; WgtE12 = WgtE12+20 ; HgtE12 = HgtE12+7  
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                                  
elseif OIe12 == 255 and Ehp12 == 2 and LRE12 == 0 and st1E12 == 16 and st2E12 == 32 and st3E12 == 2 and st4E12 == 2 
  or OIe12 == 255 and Ehp12 == 2 and LRE12 == 0 and st1E12 == 16 and st2E12 == 0 and st3E12 == 2 and st4E12 == 2 then  --Dog                             
X_pos_E12 = X_pos_E12+1 ; Y_pos_E12 = Y_pos_E12-17 ; WgtE12 = WgtE12+20 ; HgtE12 = HgtE12+7  
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                                  
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 1 and st1E12 == 16 and st2E12 == 32 and st3E12 == 3 and st4E12 == 3 then  --super dog       
X_pos_E12 = X_pos_E12 ; Y_pos_E12 = Y_pos_E12-17 ; WgtE12 = WgtE12+20 ; HgtE12 = HgtE12+7  
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 0 and st1E12 == 16 and st2E12 == 32 and st3E12 == 3 and st4E12 == 3 then  --super dog       
X_pos_E12 = X_pos_E12 ; Y_pos_E12 = Y_pos_E12-17 ; WgtE12 = WgtE12+20 ; HgtE12 = HgtE12+7  
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)
elseif OIe12 == 255 and Ehp12 == 2 and LRE12 == 1 and patE12 >= 52 and st3E12 == 2 then                                 --ghost girl                             
X_pos_E12 = X_pos_E12-4 ; Y_pos_E12 = Y_pos_E12-17 ; WgtE12 = WgtE12+12 ; HgtE12 = HgtE12+23  
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                                  
elseif OIe12 == 255 and Ehp12 == 2 and LRE12 == 0 and patE12 == 52 and st3E12 == 2 then                                 --ghost girl             
X_pos_E12 = X_pos_E12-3 ; Y_pos_E12 = Y_pos_E12-17 ; WgtE12 = WgtE12+12 ; HgtE12 = HgtE12+23  
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 1 and patE12 >= 52  
and st1E12 == 32 and st2E12 == 16 and st3E12 == 3 and st4E12 == 3 then                                                 --Super ghost girl                             
X_pos_E12 = X_pos_E12-4 ; Y_pos_E12 = Y_pos_E12-17 ; WgtE12 = WgtE12+12 ; HgtE12 = HgtE12+23  
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                                 
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 0 and patE12 == 52 
and st1E12 == 32 and st2E12 == 16 and st3E12 == 3 and st4E12 == 3 then                                                 --Super ghost girl             
X_pos_E12 = X_pos_E12-3 ; Y_pos_E12 = Y_pos_E12-17 ; WgtE12 = WgtE12+12 ; HgtE12 = HgtE12+23  
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                    
elseif OIe12 == 255 and Ehp12 >= 2 and LRE12 == 1 and patE12 == 53 and st3E12 >= 3 then                                 --Goblin , super goblin                            
X_pos_E12 = X_pos_E12-4 ; Y_pos_E12 = Y_pos_E12-17 ; WgtE12 = WgtE12+10 ; HgtE12 = HgtE12+23  
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                                  
elseif OIe12 == 255 and Ehp12 >= 2 and LRE12 == 0 and patE12 == 53 and st3E12 >= 3 then                                 --Goblin , super goblin            
X_pos_E12 = X_pos_E12 ; Y_pos_E12 = Y_pos_E12-17 ; WgtE12 = WgtE12+10 ; HgtE12 = HgtE12+23  
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                     
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 1 and patE12 <= 52 and st3E12 == 3 
and st1E12 == 40 and st2E12 == 16 and st3E12 == 3 and st4E12 == 2 
  or OIe12 == 255 and Ehp12 == 3 and LRE12 == 1 and patE12 <= 52 and st3E12 == 3 
and st1E12 == 40 and st2E12 == 0 and st3E12 == 3 and st4E12 == 2 then                                                      --Strange man                               
X_pos_E12 = X_pos_E12 ; Y_pos_E12 = Y_pos_E12-16 ; WgtE12 = WgtE12+7 ; HgtE12 = HgtE12+30 
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                            
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 0 and patE12 == 51 and st3E12 == 3 
and st1E12 == 40 and st2E12 == 16 and st3E12 == 3 and st4E12 == 2 
  or OIe12 == 255 and Ehp12 == 3 and LRE12 == 0 and patE12 <= 52 and st3E12 == 3 
and st1E12 == 40 and st2E12 == 0 and st3E12 == 3 and st4E12 == 2 then                                                      --Strange man                            
X_pos_E12 = X_pos_E12-1 ; Y_pos_E12 = Y_pos_E12-16 ; WgtE12 = WgtE12+7 ; HgtE12 = HgtE12+30 
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                           
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 1 and patE12 == 55 and st3E12 == 4 then                                 --Skeleton                              
X_pos_E12 = X_pos_E12-8 ; Y_pos_E12 = Y_pos_E12-17 ; WgtE12 = WgtE12+15 ; HgtE12 = HgtE12+30 
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                            
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 0 and patE12 == 55 and st3E12 == 4 then                                 --Skeleton                              
X_pos_E12 = X_pos_E12-1 ; Y_pos_E12 = Y_pos_E12-17 ; WgtE12 = WgtE12+15 ; HgtE12 = HgtE12+30 
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 1 and patE12 == 54 and st3E12 == 3 then                                 --Wax dolls                           
X_pos_E12 = X_pos_E12-2 ; Y_pos_E12 = Y_pos_E12-14 ; WgtE12 = WgtE12+11 ; HgtE12 = HgtE12+28 
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                            
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 0 and patE12 == 54 and st3E12 == 3 then                                 --Wax dolls                           
X_pos_E12 = X_pos_E12-2 ; Y_pos_E12 = Y_pos_E12-14 ; WgtE12 = WgtE12+11 ; HgtE12 = HgtE12+28 
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 1 and patE12 >= 55 and patE12 <= 56 and st3E12 == 3 
 and st1E12 == 32 and st2E12 == 16 and st3E12 == 3 and st4E12 == 2 
  or OIe12 == 255 and Ehp12 == 3 and LRE12 == 1 and patE12 >= 55 and patE12 <= 56 and st3E12 == 3 
 and st1E12 == 32 and st2E12 == 0 and st3E12 == 3 and st4E12 == 2 then                                                          --Magician                                       
X_pos_E12 = X_pos_E12-1 ; Y_pos_E12 = Y_pos_E12-16 ; WgtE12 = WgtE12+7 ; HgtE12 = HgtE12+22   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                            
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 0 and patE12 >= 55 and patE12 <= 56 and st3E12 == 3 
 and st1E12 == 32 and st2E12 == 16 and st3E12 == 3 and st4E12 == 2 
  or OIe12 == 255 and Ehp12 == 3 and LRE12 == 0 and patE12 >= 55 and patE12 <= 56 and st3E12 == 3 
 and st1E12 == 32 and st2E12 == 0 and st3E12 == 3 and st4E12 == 2 then                                                           --Magician                             
X_pos_E12 = X_pos_E12-3 ; Y_pos_E12 = Y_pos_E12-16 ; WgtE12 = WgtE12+7 ; HgtE12 = HgtE12+22  
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey) 
elseif OIe12 == 255 and Ehp12 == 1 and LRE12 == 1 and patE12 == 57 and st3E12 == 1 then                                 --Knife                                        
X_pos_E12 = X_pos_E12-2 ; Y_pos_E12 = Y_pos_E12-16 ; WgtE12 = WgtE12 ; HgtE12 = HgtE12   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                            
elseif OIe12 == 255 and Ehp12 == 1 and LRE12 == 0 and patE12 == 57 and st3E12 == 1 then                                 --Knife                            
X_pos_E12 = X_pos_E12-2 ; Y_pos_E12 = Y_pos_E12-16 ; WgtE12 = WgtE12 ; HgtE12 = HgtE12   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey) 
elseif OIe12 == 255 and Ehp12 == 2 and LRE12 == 1 and patE12 == 57 and st3E12 == 3 then                                 --Chair                                       
X_pos_E12 = X_pos_E12-1 ; Y_pos_E12 = Y_pos_E12-14 ; WgtE12 = WgtE12+9 ; HgtE12 = HgtE12+20   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                            
elseif OIe12 == 255 and Ehp12 == 2 and LRE12 == 0 and patE12 == 57 and st3E12 == 3 then                                 --Chair                            
X_pos_E12 = X_pos_E12-2 ; Y_pos_E12 = Y_pos_E12-14 ; WgtE12 = WgtE12+9 ; HgtE12 = HgtE12+20   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 1 and patE12 == 57 and st3E12 == 4
  or OIe12 == 255 and Ehp12 == 3 and LRE12 == 1 and patE12 == 56 and st3E12 == 4 then                                   --falcon                                       
X_pos_E12 = X_pos_E12-1 ; Y_pos_E12 = Y_pos_E12-16 ; WgtE12 = WgtE12+24 ; HgtE12 = HgtE12+16   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                            
elseif OIe12 == 255 and Ehp12 == 3 and LRE12 == 0 and patE12 == 57 and st3E12 == 4 
  or OIe12 == 255 and Ehp12 == 3 and LRE12 == 0 and patE12 == 56 and st3E12 == 4 then                                   --falcon                             
X_pos_E12 = X_pos_E12-2 ; Y_pos_E12 = Y_pos_E12-16 ; WgtE12 = WgtE12+24 ; HgtE12 = HgtE12+16   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)
elseif OIe12 == 255 and Ehp12 == 2 and LRE12 == 1 and patE12 == 58 and st3E12 == 3 then                                 --Painting pictures                                       
X_pos_E12 = X_pos_E12-2 ; Y_pos_E12 = Y_pos_E12-15 ; WgtE12 = WgtE12+12 ; HgtE12 = HgtE12+19  
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                            
elseif OIe12 == 255 and Ehp12 == 2 and LRE12 == 0 and patE12 == 58 and st3E12 == 3 then                                 --Painting pictures                            
X_pos_E12 = X_pos_E12 ; Y_pos_E12 = Y_pos_E12-15 ; WgtE12 = WgtE12+12 ; HgtE12 = HgtE12+19   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey) 
elseif OIe12 == 255 and Ehp12 == 2 and LRE12 == 1 and patE12 == 58 and st3E12 == 4 then                                 --Table doomed                                        
X_pos_E12 = X_pos_E12-1 ; Y_pos_E12 = Y_pos_E12-15 ; WgtE12 = WgtE12+20 ; HgtE12 = HgtE12+12   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                            
elseif OIe12 == 255 and Ehp12 == 2 and LRE12 == 0 and patE12 == 58 and st3E12 == 4 then                                 --Table doomed                           
X_pos_E12 = X_pos_E12-2 ; Y_pos_E12 = Y_pos_E12-15 ; WgtE12 = WgtE12+20 ; HgtE12 = HgtE12+12   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey) 
elseif OIe12 == 255 and Ehp12 == 1 and LRE12 == 1 and patE12 == 58 and st3E12 == 2 then                                 --Candle                                      
X_pos_E12 = X_pos_E12-1 ; Y_pos_E12 = Y_pos_E12-16 ; WgtE12 = WgtE12+8 ; HgtE12 = HgtE12+4   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                            
elseif OIe12 == 255 and Ehp12 == 1 and LRE12 == 0 and patE12 == 58 and st3E12 == 2 then                                 --Candle                          
X_pos_E12 = X_pos_E12-2 ; Y_pos_E12 = Y_pos_E12-16 ; WgtE12 = WgtE12+8 ; HgtE12 = HgtE12+4   
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,antgrey)                      

end

if Ehp12 == 0 then                              -- stop hitbox enemy12
X_pos_E12 = X_pos_E12+1 ; Y_pos_E12 = Y_pos_E12-14       
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,NO12)
elseif Ehp12 > 0 and OIe12 == 0 then
gui.drawRectangle(X_pos_E12,Y_pos_E12,WgtE12,HgtE12,NO12)

end
end

local function Enemy13_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX13 = mainmemory.read_u8              --X coordinate
local YY13 = mainmemory.read_u8              --Y coordinate
local enemy13_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E13 = mainmemory.read_u8         --state1 
local stat2_E13 = mainmemory.read_u8         --state2 
local stat3_E13 = mainmemory.read_u8         --state3 
local stat4_E13 = mainmemory.read_u8         --state4 
local pat_E13 = mainmemory.read_u8           --pattern select
local pat_count_E13 = mainmemory.read_u8     --pattern start count
local RES_pat_E13 = mainmemory.read_u8       --result pattern
local LR_E13 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E13 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp13 = enemy13_hp(0x0B21)
local st1E13 = stat1_E13(0x0B38)
local st2E13 = stat2_E13(0x0B39)
local st3E13 = stat3_E13(0x0B3A)
local st4E13 = stat4_E13(0x0B3B)
local patE13 = pat_E13(0x0B27)
local PATcE13 = pat_count_E13(0x0B3F)
local RpatE13 = RES_pat_E13(0x0B3E)
local LRE13 = LR_E13(0x0B30)
local OIe13 = OI_E13(0x0B20)
local X_pos_E13 = XX13(0x0B24)
local Y_pos_E13 = YY13(0x0B22)
local WgtE13 = 10
local HgtE13 = 10
local darkred = 0xFF770000
local NO13 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,NO13)

elseif OIe13 == 255 and Ehp13 == 1 and LRE13 == 1 and patE13 == 50 and st3E13 == 1 then                       --Bat                                        
X_pos_E13 = X_pos_E13-1 ; Y_pos_E13 = Y_pos_E13-16 ; WgtE13 = WgtE13+8 ; HgtE13 = HgtE13+4   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                            
elseif OIe13 == 255 and Ehp13 == 1 and LRE13 == 0 and patE13 == 50 and st3E13 == 1 then                   --Bat                             
X_pos_E13 = X_pos_E13-2 ; Y_pos_E13 = Y_pos_E13-16 ; WgtE13 = WgtE13+8 ; HgtE13 = HgtE13+4   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                                                   
elseif OIe13 == 255 and Ehp13 == 2 and LRE13 == 1 and st1E13 == 16 and st2E13 == 32 and st3E13 == 2 and st4E13 == 2 
  or OIe13 == 255 and Ehp13 == 2 and LRE13 == 1 and st1E13 == 16 and st2E13 == 0 and st3E13 == 2 and st4E13 == 2 then  --Dog                           
X_pos_E13 = X_pos_E13+1 ; Y_pos_E13 = Y_pos_E13-17 ; WgtE13 = WgtE13+20 ; HgtE13 = HgtE13+7  
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                                  
elseif OIe13 == 255 and Ehp13 == 2 and LRE13 == 0 and st1E13 == 16 and st2E13 == 32 and st3E13 == 2 and st4E13 == 2 
  or OIe13 == 255 and Ehp13 == 2 and LRE13 == 0 and st1E13 == 16 and st2E13 == 0 and st3E13 == 2 and st4E13 == 2 then  --Dog                             
X_pos_E13 = X_pos_E13+1 ; Y_pos_E13 = Y_pos_E13-17 ; WgtE13 = WgtE13+20 ; HgtE13 = HgtE13+7  
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                                  
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 1 and st1E13 == 16 and st2E13 == 32 and st3E13 == 3 and st4E13 == 3 then  --super dog       
X_pos_E13 = X_pos_E13 ; Y_pos_E13 = Y_pos_E13-17 ; WgtE13 = WgtE13+20 ; HgtE13 = HgtE13+7  
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 0 and st1E13 == 16 and st2E13 == 32 and st3E13 == 3 and st4E13 == 3 then  --super dog       
X_pos_E13 = X_pos_E13 ; Y_pos_E13 = Y_pos_E13-17 ; WgtE13 = WgtE13+20 ; HgtE13 = HgtE13+7  
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)
elseif OIe13 == 255 and Ehp13 == 2 and LRE13 == 1 and patE13 >= 52 and st3E13 == 2 then                                 --ghost girl                             
X_pos_E13 = X_pos_E13-4 ; Y_pos_E13 = Y_pos_E13-17 ; WgtE13 = WgtE13+12 ; HgtE13 = HgtE13+23  
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                                  
elseif OIe13 == 255 and Ehp13 == 2 and LRE13 == 0 and patE13 == 52 and st3E13 == 2 then                                 --ghost girl             
X_pos_E13 = X_pos_E13-3 ; Y_pos_E13 = Y_pos_E13-17 ; WgtE13 = WgtE13+12 ; HgtE13 = HgtE13+23  
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 1 and patE13 >= 52  
and st1E13 == 32 and st2E13 == 16 and st3E13 == 3 and st4E13 == 3 then                                                 --Super ghost girl                             
X_pos_E13 = X_pos_E13-4 ; Y_pos_E13 = Y_pos_E13-17 ; WgtE13 = WgtE13+12 ; HgtE13 = HgtE13+23  
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                                 
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 0 and patE13 == 52 
and st1E13 == 32 and st2E13 == 16 and st3E13 == 3 and st4E13 == 3 then                                                 --Super ghost girl             
X_pos_E13 = X_pos_E13-3 ; Y_pos_E13 = Y_pos_E13-17 ; WgtE13 = WgtE13+12 ; HgtE13 = HgtE13+23  
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                    
elseif OIe13 == 255 and Ehp13 >= 2 and LRE13 == 1 and patE13 == 53 and st3E13 >= 3 then                                 --Goblin , super goblin                            
X_pos_E13 = X_pos_E13-4 ; Y_pos_E13 = Y_pos_E13-17 ; WgtE13 = WgtE13+10 ; HgtE13 = HgtE13+23  
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                                  
elseif OIe13 == 255 and Ehp13 >= 2 and LRE13 == 0 and patE13 == 53 and st3E13 >= 3 then                                 --Goblin , super goblin            
X_pos_E13 = X_pos_E13 ; Y_pos_E13 = Y_pos_E13-17 ; WgtE13 = WgtE13+10 ; HgtE13 = HgtE13+23  
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                     
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 1 and patE13 <= 52 and st3E13 == 3 
and st1E13 == 40 and st2E13 == 16 and st3E13 == 3 and st4E13 == 2 
  or OIe13 == 255 and Ehp13 == 3 and LRE13 == 1 and patE13 <= 52 and st3E13 == 3 
and st1E13 == 40 and st2E13 == 0 and st3E13 == 3 and st4E13 == 2 then                                                      --Strange man                               
X_pos_E13 = X_pos_E13 ; Y_pos_E13 = Y_pos_E13-16 ; WgtE13 = WgtE13+7 ; HgtE13 = HgtE13+30 
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                            
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 0 and patE13 == 51 and st3E13 == 3 
and st1E13 == 40 and st2E13 == 16 and st3E13 == 3 and st4E13 == 2 
  or OIe13 == 255 and Ehp13 == 3 and LRE13 == 0 and patE13 <= 52 and st3E13 == 3 
and st1E13 == 40 and st2E13 == 0 and st3E13 == 3 and st4E13 == 2 then                                                      --Strange man                            
X_pos_E13 = X_pos_E13-1 ; Y_pos_E13 = Y_pos_E13-16 ; WgtE13 = WgtE13+7 ; HgtE13 = HgtE13+30 
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                           
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 1 and patE13 == 55 and st3E13 == 4 then                                 --Skeleton                              
X_pos_E13 = X_pos_E13-8 ; Y_pos_E13 = Y_pos_E13-17 ; WgtE13 = WgtE13+15 ; HgtE13 = HgtE13+30 
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                            
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 0 and patE13 == 55 and st3E13 == 4 then                                 --Skeleton                              
X_pos_E13 = X_pos_E13-1 ; Y_pos_E13 = Y_pos_E13-17 ; WgtE13 = WgtE13+15 ; HgtE13 = HgtE13+30 
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 1 and patE13 == 54 and st3E13 == 3 then                                 --Wax dolls                           
X_pos_E13 = X_pos_E13-2 ; Y_pos_E13 = Y_pos_E13-14 ; WgtE13 = WgtE13+11 ; HgtE13 = HgtE13+28 
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                            
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 0 and patE13 == 54 and st3E13 == 3 then                                 --Wax dolls                           
X_pos_E13 = X_pos_E13-2 ; Y_pos_E13 = Y_pos_E13-14 ; WgtE13 = WgtE13+11 ; HgtE13 = HgtE13+28 
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 1 and patE13 >= 55 and patE13 <= 56 and st3E13 == 3 
 and st1E13 == 32 and st2E13 == 16 and st3E13 == 3 and st4E13 == 2 
  or OIe13 == 255 and Ehp13 == 3 and LRE13 == 1 and patE13 >= 55 and patE13 <= 56 and st3E13 == 3 
 and st1E13 == 32 and st2E13 == 0 and st3E13 == 3 and st4E13 == 2 then                                                          --Magician                                       
X_pos_E13 = X_pos_E13-1 ; Y_pos_E13 = Y_pos_E13-16 ; WgtE13 = WgtE13+7 ; HgtE13 = HgtE13+22   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                            
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 0 and patE13 >= 55 and patE13 <= 56 and st3E13 == 3 
 and st1E13 == 32 and st2E13 == 16 and st3E13 == 3 and st4E13 == 2 
  or OIe13 == 255 and Ehp13 == 3 and LRE13 == 0 and patE13 >= 55 and patE13 <= 56 and st3E13 == 3 
 and st1E13 == 32 and st2E13 == 0 and st3E13 == 3 and st4E13 == 2 then                                                           --Magician                             
X_pos_E13 = X_pos_E13-3 ; Y_pos_E13 = Y_pos_E13-16 ; WgtE13 = WgtE13+7 ; HgtE13 = HgtE13+22  
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred) 
elseif OIe13 == 255 and Ehp13 == 1 and LRE13 == 1 and patE13 == 57 and st3E13 == 1 then                                 --Knife                                        
X_pos_E13 = X_pos_E13-2 ; Y_pos_E13 = Y_pos_E13-16 ; WgtE13 = WgtE13 ; HgtE13 = HgtE13   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                            
elseif OIe13 == 255 and Ehp13 == 1 and LRE13 == 0 and patE13 == 57 and st3E13 == 1 then                                 --Knife                            
X_pos_E13 = X_pos_E13-2 ; Y_pos_E13 = Y_pos_E13-16 ; WgtE13 = WgtE13 ; HgtE13 = HgtE13   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred) 
elseif OIe13 == 255 and Ehp13 == 2 and LRE13 == 1 and patE13 == 57 and st3E13 == 3 then                                 --Chair                                       
X_pos_E13 = X_pos_E13-1 ; Y_pos_E13 = Y_pos_E13-14 ; WgtE13 = WgtE13+9 ; HgtE13 = HgtE13+20   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                            
elseif OIe13 == 255 and Ehp13 == 2 and LRE13 == 0 and patE13 == 57 and st3E13 == 3 then                                 --Chair                            
X_pos_E13 = X_pos_E13-2 ; Y_pos_E13 = Y_pos_E13-14 ; WgtE13 = WgtE13+9 ; HgtE13 = HgtE13+20   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 1 and patE13 == 57 and st3E13 == 4
  or OIe13 == 255 and Ehp13 == 3 and LRE13 == 1 and patE13 == 56 and st3E13 == 4 then                                   --falcon                                       
X_pos_E13 = X_pos_E13-1 ; Y_pos_E13 = Y_pos_E13-16 ; WgtE13 = WgtE13+24 ; HgtE13 = HgtE13+16   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                            
elseif OIe13 == 255 and Ehp13 == 3 and LRE13 == 0 and patE13 == 57 and st3E13 == 4 
  or OIe13 == 255 and Ehp13 == 3 and LRE13 == 0 and patE13 == 56 and st3E13 == 4 then                                   --falcon                             
X_pos_E13 = X_pos_E13-2 ; Y_pos_E13 = Y_pos_E13-16 ; WgtE13 = WgtE13+24 ; HgtE13 = HgtE13+16   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)
elseif OIe13 == 255 and Ehp13 == 2 and LRE13 == 1 and patE13 == 58 and st3E13 == 3 then                                 --Painting pictures                                       
X_pos_E13 = X_pos_E13-2 ; Y_pos_E13 = Y_pos_E13-15 ; WgtE13 = WgtE13+12 ; HgtE13 = HgtE13+19  
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                            
elseif OIe13 == 255 and Ehp13 == 2 and LRE13 == 0 and patE13 == 58 and st3E13 == 3 then                                 --Painting pictures                            
X_pos_E13 = X_pos_E13 ; Y_pos_E13 = Y_pos_E13-15 ; WgtE13 = WgtE13+12 ; HgtE13 = HgtE13+19   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred) 
elseif OIe13 == 255 and Ehp13 == 2 and LRE13 == 1 and patE13 == 58 and st3E13 == 4 then                                 --Table doomed                                        
X_pos_E13 = X_pos_E13-1 ; Y_pos_E13 = Y_pos_E13-15 ; WgtE13 = WgtE13+20 ; HgtE13 = HgtE13+12   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                            
elseif OIe13 == 255 and Ehp13 == 2 and LRE13 == 0 and patE13 == 58 and st3E13 == 4 then                                 --Table doomed                           
X_pos_E13 = X_pos_E13-2 ; Y_pos_E13 = Y_pos_E13-15 ; WgtE13 = WgtE13+20 ; HgtE13 = HgtE13+12   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred) 
elseif OIe13 == 255 and Ehp13 == 1 and LRE13 == 1 and patE13 == 58 and st3E13 == 2 then                                 --Candle                                      
X_pos_E13 = X_pos_E13-1 ; Y_pos_E13 = Y_pos_E13-16 ; WgtE13 = WgtE13+8 ; HgtE13 = HgtE13+4   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                            
elseif OIe13 == 255 and Ehp13 == 1 and LRE13 == 0 and patE13 == 58 and st3E13 == 2 then                                 --Candle                          
X_pos_E13 = X_pos_E13-2 ; Y_pos_E13 = Y_pos_E13-16 ; WgtE13 = WgtE13+8 ; HgtE13 = HgtE13+4   
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,darkred)                      

end

if Ehp13 == 0 then                              -- stop hitbox enemy13
X_pos_E13 = X_pos_E13+1 ; Y_pos_E13 = Y_pos_E13-14       
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,NO13)
elseif Ehp13 > 0 and OIe13 == 0 then
gui.drawRectangle(X_pos_E13,Y_pos_E13,WgtE13,HgtE13,NO13)

end
end

local function Enemy14_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX14 = mainmemory.read_u8              --X coordinate
local YY14 = mainmemory.read_u8              --Y coordinate
local enemy14_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E14 = mainmemory.read_u8         --state1 
local stat2_E14 = mainmemory.read_u8         --state2 
local stat3_E14 = mainmemory.read_u8         --state3 
local stat4_E14 = mainmemory.read_u8         --state4 
local pat_E14 = mainmemory.read_u8           --pattern select
local pat_count_E14 = mainmemory.read_u8     --pattern start count
local RES_pat_E14 = mainmemory.read_u8       --result pattern
local LR_E14 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E14 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp14 = enemy14_hp(0x0CE1)
local st1E14 = stat1_E14(0x0CF8)
local st2E14 = stat2_E14(0x0CF9)
local st3E14 = stat3_E14(0x0CFA)
local st4E14 = stat4_E14(0x0CFB)
local patE14 = pat_E14(0x0CE7)
local PATcE14 = pat_count_E14(0x0CFF)
local RpatE14 = RES_pat_E14(0x0CFE)
local LRE14 = LR_E14(0x0CF0)
local OIe14 = OI_E14(0x0CE0)
local X_pos_E14 = XX14(0x0CE4)
local Y_pos_E14 = YY14(0x0CE2)
local WgtE14 = 10
local HgtE14 = 10
local coolpurp = 0xFF6633FF
local NO14 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,NO14)

elseif OIe14 == 255 and Ehp14 == 1 and LRE14 == 1 and patE14 == 50 and st3E14 == 1 then                       --Bat                                        
X_pos_E14 = X_pos_E14-1 ; Y_pos_E14 = Y_pos_E14-16 ; WgtE14 = WgtE14+8 ; HgtE14 = HgtE14+4   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                            
elseif OIe14 == 255 and Ehp14 == 1 and LRE14 == 0 and patE14 == 50 and st3E14 == 1 then                   --Bat                             
X_pos_E14 = X_pos_E14-2 ; Y_pos_E14 = Y_pos_E14-16 ; WgtE14 = WgtE14+8 ; HgtE14 = HgtE14+4   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                                                   
elseif OIe14 == 255 and Ehp14 == 2 and LRE14 == 1 and st1E14 == 16 and st2E14 == 32 and st3E14 == 2 and st4E14 == 2 
  or OIe14 == 255 and Ehp14 == 2 and LRE14 == 1 and st1E14 == 16 and st2E14 == 0 and st3E14 == 2 and st4E14 == 2 then  --Dog                           
X_pos_E14 = X_pos_E14+1 ; Y_pos_E14 = Y_pos_E14-17 ; WgtE14 = WgtE14+20 ; HgtE14 = HgtE14+7  
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                                  
elseif OIe14 == 255 and Ehp14 == 2 and LRE14 == 0 and st1E14 == 16 and st2E14 == 32 and st3E14 == 2 and st4E14 == 2 
  or OIe14 == 255 and Ehp14 == 2 and LRE14 == 0 and st1E14 == 16 and st2E14 == 0 and st3E14 == 2 and st4E14 == 2 then  --Dog                             
X_pos_E14 = X_pos_E14+1 ; Y_pos_E14 = Y_pos_E14-17 ; WgtE14 = WgtE14+20 ; HgtE14 = HgtE14+7  
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                                  
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 1 and st1E14 == 16 and st2E14 == 32 and st3E14 == 3 and st4E14 == 3 then  --super dog       
X_pos_E14 = X_pos_E14 ; Y_pos_E14 = Y_pos_E14-17 ; WgtE14 = WgtE14+20 ; HgtE14 = HgtE14+7  
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 0 and st1E14 == 16 and st2E14 == 32 and st3E14 == 3 and st4E14 == 3 then  --super dog       
X_pos_E14 = X_pos_E14 ; Y_pos_E14 = Y_pos_E14-17 ; WgtE14 = WgtE14+20 ; HgtE14 = HgtE14+7  
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)
elseif OIe14 == 255 and Ehp14 == 2 and LRE14 == 1 and patE14 >= 52 and st3E14 == 2 then                                 --ghost girl                             
X_pos_E14 = X_pos_E14-4 ; Y_pos_E14 = Y_pos_E14-17 ; WgtE14 = WgtE14+12 ; HgtE14 = HgtE14+23  
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                                  
elseif OIe14 == 255 and Ehp14 == 2 and LRE14 == 0 and patE14 == 52 and st3E14 == 2 then                                 --ghost girl             
X_pos_E14 = X_pos_E14-3 ; Y_pos_E14 = Y_pos_E14-17 ; WgtE14 = WgtE14+12 ; HgtE14 = HgtE14+23  
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 1 and patE14 >= 52  
and st1E14 == 32 and st2E14 == 16 and st3E14 == 3 and st4E14 == 3 then                                                 --Super ghost girl                             
X_pos_E14 = X_pos_E14-4 ; Y_pos_E14 = Y_pos_E14-17 ; WgtE14 = WgtE14+12 ; HgtE14 = HgtE14+23  
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                                 
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 0 and patE14 == 52 
and st1E14 == 32 and st2E14 == 16 and st3E14 == 3 and st4E14 == 3 then                                                 --Super ghost girl             
X_pos_E14 = X_pos_E14-3 ; Y_pos_E14 = Y_pos_E14-17 ; WgtE14 = WgtE14+12 ; HgtE14 = HgtE14+23  
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                    
elseif OIe14 == 255 and Ehp14 >= 2 and LRE14 == 1 and patE14 == 53 and st3E14 >= 3 then                                 --Goblin , super goblin                            
X_pos_E14 = X_pos_E14-4 ; Y_pos_E14 = Y_pos_E14-17 ; WgtE14 = WgtE14+10 ; HgtE14 = HgtE14+23  
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                                  
elseif OIe14 == 255 and Ehp14 >= 2 and LRE14 == 0 and patE14 == 53 and st3E14 >= 3 then                                 --Goblin , super goblin            
X_pos_E14 = X_pos_E14 ; Y_pos_E14 = Y_pos_E14-17 ; WgtE14 = WgtE14+10 ; HgtE14 = HgtE14+23  
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                     
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 1 and patE14 <= 52 and st3E14 == 3 
and st1E14 == 40 and st2E14 == 16 and st3E14 == 3 and st4E14 == 2 
  or OIe14 == 255 and Ehp14 == 3 and LRE14 == 1 and patE14 <= 52 and st3E14 == 3 
and st1E14 == 40 and st2E14 == 0 and st3E14 == 3 and st4E14 == 2 then                                                      --Strange man                               
X_pos_E14 = X_pos_E14 ; Y_pos_E14 = Y_pos_E14-16 ; WgtE14 = WgtE14+7 ; HgtE14 = HgtE14+30 
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                            
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 0 and patE14 == 51 and st3E14 == 3 
and st1E14 == 40 and st2E14 == 16 and st3E14 == 3 and st4E14 == 2 
  or OIe14 == 255 and Ehp14 == 3 and LRE14 == 0 and patE14 <= 52 and st3E14 == 3 
and st1E14 == 40 and st2E14 == 0 and st3E14 == 3 and st4E14 == 2 then                                                      --Strange man                            
X_pos_E14 = X_pos_E14-1 ; Y_pos_E14 = Y_pos_E14-16 ; WgtE14 = WgtE14+7 ; HgtE14 = HgtE14+30 
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                           
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 1 and patE14 == 55 and st3E14 == 4 then                                 --Skeleton                              
X_pos_E14 = X_pos_E14-8 ; Y_pos_E14 = Y_pos_E14-17 ; WgtE14 = WgtE14+15 ; HgtE14 = HgtE14+30 
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                            
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 0 and patE14 == 55 and st3E14 == 4 then                                 --Skeleton                              
X_pos_E14 = X_pos_E14-1 ; Y_pos_E14 = Y_pos_E14-17 ; WgtE14 = WgtE14+15 ; HgtE14 = HgtE14+30 
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 1 and patE14 == 54 and st3E14 == 3 then                                 --Wax dolls                           
X_pos_E14 = X_pos_E14-2 ; Y_pos_E14 = Y_pos_E14-14 ; WgtE14 = WgtE14+11 ; HgtE14 = HgtE14+28 
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                            
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 0 and patE14 == 54 and st3E14 == 3 then                                 --Wax dolls                           
X_pos_E14 = X_pos_E14-2 ; Y_pos_E14 = Y_pos_E14-14 ; WgtE14 = WgtE14+11 ; HgtE14 = HgtE14+28 
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 1 and patE14 >= 55 and patE14 <= 56 and st3E14 == 3 
 and st1E14 == 32 and st2E14 == 16 and st3E14 == 3 and st4E14 == 2 
  or OIe14 == 255 and Ehp14 == 3 and LRE14 == 1 and patE14 >= 55 and patE14 <= 56 and st3E14 == 3 
 and st1E14 == 32 and st2E14 == 0 and st3E14 == 3 and st4E14 == 2 then                                                          --Magician                                       
X_pos_E14 = X_pos_E14-1 ; Y_pos_E14 = Y_pos_E14-16 ; WgtE14 = WgtE14+7 ; HgtE14 = HgtE14+22   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                            
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 0 and patE14 >= 55 and patE14 <= 56 and st3E14 == 3 
 and st1E14 == 32 and st2E14 == 16 and st3E14 == 3 and st4E14 == 2 
  or OIe14 == 255 and Ehp14 == 3 and LRE14 == 0 and patE14 >= 55 and patE14 <= 56 and st3E14 == 3 
 and st1E14 == 32 and st2E14 == 0 and st3E14 == 3 and st4E14 == 2 then                                                           --Magician                             
X_pos_E14 = X_pos_E14-3 ; Y_pos_E14 = Y_pos_E14-16 ; WgtE14 = WgtE14+7 ; HgtE14 = HgtE14+22  
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp) 
elseif OIe14 == 255 and Ehp14 == 1 and LRE14 == 1 and patE14 == 57 and st3E14 == 1 then                                 --Knife                                        
X_pos_E14 = X_pos_E14-2 ; Y_pos_E14 = Y_pos_E14-16 ; WgtE14 = WgtE14 ; HgtE14 = HgtE14   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                            
elseif OIe14 == 255 and Ehp14 == 1 and LRE14 == 0 and patE14 == 57 and st3E14 == 1 then                                 --Knife                            
X_pos_E14 = X_pos_E14-2 ; Y_pos_E14 = Y_pos_E14-16 ; WgtE14 = WgtE14 ; HgtE14 = HgtE14   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp) 
elseif OIe14 == 255 and Ehp14 == 2 and LRE14 == 1 and patE14 == 57 and st3E14 == 3 then                                 --Chair                                       
X_pos_E14 = X_pos_E14-1 ; Y_pos_E14 = Y_pos_E14-14 ; WgtE14 = WgtE14+9 ; HgtE14 = HgtE14+20   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                            
elseif OIe14 == 255 and Ehp14 == 2 and LRE14 == 0 and patE14 == 57 and st3E14 == 3 then                                 --Chair                            
X_pos_E14 = X_pos_E14-2 ; Y_pos_E14 = Y_pos_E14-14 ; WgtE14 = WgtE14+9 ; HgtE14 = HgtE14+20   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 1 and patE14 == 57 and st3E14 == 4
  or OIe14 == 255 and Ehp14 == 3 and LRE14 == 1 and patE14 == 56 and st3E14 == 4 then                                   --falcon                                       
X_pos_E14 = X_pos_E14-1 ; Y_pos_E14 = Y_pos_E14-16 ; WgtE14 = WgtE14+24 ; HgtE14 = HgtE14+16   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                            
elseif OIe14 == 255 and Ehp14 == 3 and LRE14 == 0 and patE14 == 57 and st3E14 == 4 
  or OIe14 == 255 and Ehp14 == 3 and LRE14 == 0 and patE14 == 56 and st3E14 == 4 then                                   --falcon                             
X_pos_E14 = X_pos_E14-2 ; Y_pos_E14 = Y_pos_E14-16 ; WgtE14 = WgtE14+24 ; HgtE14 = HgtE14+16   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)
elseif OIe14 == 255 and Ehp14 == 2 and LRE14 == 1 and patE14 == 58 and st3E14 == 3 then                                 --Painting pictures                                       
X_pos_E14 = X_pos_E14-2 ; Y_pos_E14 = Y_pos_E14-15 ; WgtE14 = WgtE14+12 ; HgtE14 = HgtE14+19  
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                            
elseif OIe14 == 255 and Ehp14 == 2 and LRE14 == 0 and patE14 == 58 and st3E14 == 3 then                                 --Painting pictures                            
X_pos_E14 = X_pos_E14 ; Y_pos_E14 = Y_pos_E14-15 ; WgtE14 = WgtE14+12 ; HgtE14 = HgtE14+19   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp) 
elseif OIe14 == 255 and Ehp14 == 2 and LRE14 == 1 and patE14 == 58 and st3E14 == 4 then                                 --Table doomed                                        
X_pos_E14 = X_pos_E14-1 ; Y_pos_E14 = Y_pos_E14-15 ; WgtE14 = WgtE14+20 ; HgtE14 = HgtE14+12   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                            
elseif OIe14 == 255 and Ehp14 == 2 and LRE14 == 0 and patE14 == 58 and st3E14 == 4 then                                 --Table doomed                           
X_pos_E14 = X_pos_E14-2 ; Y_pos_E14 = Y_pos_E14-15 ; WgtE14 = WgtE14+20 ; HgtE14 = HgtE14+12   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp) 
elseif OIe14 == 255 and Ehp14 == 1 and LRE14 == 1 and patE14 == 58 and st3E14 == 2 then                                 --Candle                                      
X_pos_E14 = X_pos_E14-1 ; Y_pos_E14 = Y_pos_E14-16 ; WgtE14 = WgtE14+8 ; HgtE14 = HgtE14+4   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                            
elseif OIe14 == 255 and Ehp14 == 1 and LRE14 == 0 and patE14 == 58 and st3E14 == 2 then                                 --Candle                          
X_pos_E14 = X_pos_E14-2 ; Y_pos_E14 = Y_pos_E14-16 ; WgtE14 = WgtE14+8 ; HgtE14 = HgtE14+4   
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,coolpurp)                      

end

if Ehp14 == 0 then                              -- stop hitbox enemy14
X_pos_E14 = X_pos_E14+1 ; Y_pos_E14 = Y_pos_E14-14       
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,NO14)
elseif Ehp14 > 0 and OIe14 == 0 then
gui.drawRectangle(X_pos_E14,Y_pos_E14,WgtE14,HgtE14,NO14)

end
end

local function Enemy15_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX15 = mainmemory.read_u8              --X coordinate
local YY15 = mainmemory.read_u8              --Y coordinate
local enemy15_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E15 = mainmemory.read_u8         --state1 
local stat2_E15 = mainmemory.read_u8         --state2 
local stat3_E15 = mainmemory.read_u8         --state3 
local stat4_E15 = mainmemory.read_u8         --state4 
local pat_E15 = mainmemory.read_u8           --pattern select
local pat_count_E15 = mainmemory.read_u8     --pattern start count
local RES_pat_E15 = mainmemory.read_u8       --result pattern
local LR_E15 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E15 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp15 = enemy15_hp(0x0D01)
local st1E15 = stat1_E15(0x0D18)
local st2E15 = stat2_E15(0x0D19)
local st3E15 = stat3_E15(0x0D1A)
local st4E15 = stat4_E15(0x0D1B)
local patE15 = pat_E15(0x0D07)
local PATcE15 = pat_count_E15(0x0D1F)
local RpatE15 = RES_pat_E15(0x0D1E)
local LRE15 = LR_E15(0x0D10)
local OIe15 = OI_E15(0x0D00)
local X_pos_E15 = XX15(0x0D04)
local Y_pos_E15 = YY15(0x0D02)
local WgtE15 = 10
local HgtE15 = 10
local greenk = 0xFF333300
local NO15 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,NO15)

elseif OIe15 == 255 and Ehp15 == 1 and LRE15 == 1 and patE15 == 50 and st3E15 == 1 then                       --Bat                                        
X_pos_E15 = X_pos_E15-1 ; Y_pos_E15 = Y_pos_E15-16 ; WgtE15 = WgtE15+8 ; HgtE15 = HgtE15+4   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                            
elseif OIe15 == 255 and Ehp15 == 1 and LRE15 == 0 and patE15 == 50 and st3E15 == 1 then                   --Bat                             
X_pos_E15 = X_pos_E15-2 ; Y_pos_E15 = Y_pos_E15-16 ; WgtE15 = WgtE15+8 ; HgtE15 = HgtE15+4   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                                                   
elseif OIe15 == 255 and Ehp15 == 2 and LRE15 == 1 and st1E15 == 16 and st2E15 == 32 and st3E15 == 2 and st4E15 == 2 
  or OIe15 == 255 and Ehp15 == 2 and LRE15 == 1 and st1E15 == 16 and st2E15 == 0 and st3E15 == 2 and st4E15 == 2 then  --Dog                           
X_pos_E15 = X_pos_E15+1 ; Y_pos_E15 = Y_pos_E15-17 ; WgtE15 = WgtE15+20 ; HgtE15 = HgtE15+7  
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                                  
elseif OIe15 == 255 and Ehp15 == 2 and LRE15 == 0 and st1E15 == 16 and st2E15 == 32 and st3E15 == 2 and st4E15 == 2 
  or OIe15 == 255 and Ehp15 == 2 and LRE15 == 0 and st1E15 == 16 and st2E15 == 0 and st3E15 == 2 and st4E15 == 2 then  --Dog                             
X_pos_E15 = X_pos_E15+1 ; Y_pos_E15 = Y_pos_E15-17 ; WgtE15 = WgtE15+20 ; HgtE15 = HgtE15+7  
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                                  
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 1 and st1E15 == 16 and st2E15 == 32 and st3E15 == 3 and st4E15 == 3 then  --super dog       
X_pos_E15 = X_pos_E15 ; Y_pos_E15 = Y_pos_E15-17 ; WgtE15 = WgtE15+20 ; HgtE15 = HgtE15+7  
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 0 and st1E15 == 16 and st2E15 == 32 and st3E15 == 3 and st4E15 == 3 then  --super dog       
X_pos_E15 = X_pos_E15 ; Y_pos_E15 = Y_pos_E15-17 ; WgtE15 = WgtE15+20 ; HgtE15 = HgtE15+7  
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)
elseif OIe15 == 255 and Ehp15 == 2 and LRE15 == 1 and patE15 >= 52 and st3E15 == 2 then                                 --ghost girl                             
X_pos_E15 = X_pos_E15-4 ; Y_pos_E15 = Y_pos_E15-17 ; WgtE15 = WgtE15+12 ; HgtE15 = HgtE15+23  
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                                  
elseif OIe15 == 255 and Ehp15 == 2 and LRE15 == 0 and patE15 == 52 and st3E15 == 2 then                                 --ghost girl             
X_pos_E15 = X_pos_E15-3 ; Y_pos_E15 = Y_pos_E15-17 ; WgtE15 = WgtE15+12 ; HgtE15 = HgtE15+23  
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 1 and patE15 >= 52  
and st1E15 == 32 and st2E15 == 16 and st3E15 == 3 and st4E15 == 3 then                                                 --Super ghost girl                             
X_pos_E15 = X_pos_E15-4 ; Y_pos_E15 = Y_pos_E15-17 ; WgtE15 = WgtE15+12 ; HgtE15 = HgtE15+23  
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                                 
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 0 and patE15 == 52 
and st1E15 == 32 and st2E15 == 16 and st3E15 == 3 and st4E15 == 3 then                                                 --Super ghost girl             
X_pos_E15 = X_pos_E15-3 ; Y_pos_E15 = Y_pos_E15-17 ; WgtE15 = WgtE15+12 ; HgtE15 = HgtE15+23  
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                    
elseif OIe15 == 255 and Ehp15 >= 2 and LRE15 == 1 and patE15 == 53 and st3E15 >= 3 then                                 --Goblin , super goblin                            
X_pos_E15 = X_pos_E15-4 ; Y_pos_E15 = Y_pos_E15-17 ; WgtE15 = WgtE15+10 ; HgtE15 = HgtE15+23  
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                                  
elseif OIe15 == 255 and Ehp15 >= 2 and LRE15 == 0 and patE15 == 53 and st3E15 >= 3 then                                 --Goblin , super goblin            
X_pos_E15 = X_pos_E15 ; Y_pos_E15 = Y_pos_E15-17 ; WgtE15 = WgtE15+10 ; HgtE15 = HgtE15+23  
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                     
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 1 and patE15 <= 52 and st3E15 == 3 
and st1E15 == 40 and st2E15 == 16 and st3E15 == 3 and st4E15 == 2 
  or OIe15 == 255 and Ehp15 == 3 and LRE15 == 1 and patE15 <= 52 and st3E15 == 3 
and st1E15 == 40 and st2E15 == 0 and st3E15 == 3 and st4E15 == 2 then                                                      --Strange man                               
X_pos_E15 = X_pos_E15 ; Y_pos_E15 = Y_pos_E15-16 ; WgtE15 = WgtE15+7 ; HgtE15 = HgtE15+30 
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                            
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 0 and patE15 == 51 and st3E15 == 3 
and st1E15 == 40 and st2E15 == 16 and st3E15 == 3 and st4E15 == 2 
  or OIe15 == 255 and Ehp15 == 3 and LRE15 == 0 and patE15 <= 52 and st3E15 == 3 
and st1E15 == 40 and st2E15 == 0 and st3E15 == 3 and st4E15 == 2 then                                                      --Strange man                            
X_pos_E15 = X_pos_E15-1 ; Y_pos_E15 = Y_pos_E15-16 ; WgtE15 = WgtE15+7 ; HgtE15 = HgtE15+30 
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                           
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 1 and patE15 == 55 and st3E15 == 4 then                                 --Skeleton                              
X_pos_E15 = X_pos_E15-8 ; Y_pos_E15 = Y_pos_E15-17 ; WgtE15 = WgtE15+15 ; HgtE15 = HgtE15+30 
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                            
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 0 and patE15 == 55 and st3E15 == 4 then                                 --Skeleton                              
X_pos_E15 = X_pos_E15-1 ; Y_pos_E15 = Y_pos_E15-17 ; WgtE15 = WgtE15+15 ; HgtE15 = HgtE15+30 
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 1 and patE15 == 54 and st3E15 == 3 then                                 --Wax dolls                           
X_pos_E15 = X_pos_E15-2 ; Y_pos_E15 = Y_pos_E15-14 ; WgtE15 = WgtE15+11 ; HgtE15 = HgtE15+28 
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                            
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 0 and patE15 == 54 and st3E15 == 3 then                                 --Wax dolls                           
X_pos_E15 = X_pos_E15-2 ; Y_pos_E15 = Y_pos_E15-14 ; WgtE15 = WgtE15+11 ; HgtE15 = HgtE15+28 
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 1 and patE15 >= 55 and patE15 <= 56 and st3E15 == 3 
 and st1E15 == 32 and st2E15 == 16 and st3E15 == 3 and st4E15 == 2 
  or OIe15 == 255 and Ehp15 == 3 and LRE15 == 1 and patE15 >= 55 and patE15 <= 56 and st3E15 == 3 
 and st1E15 == 32 and st2E15 == 0 and st3E15 == 3 and st4E15 == 2 then                                                          --Magician                                       
X_pos_E15 = X_pos_E15-1 ; Y_pos_E15 = Y_pos_E15-16 ; WgtE15 = WgtE15+7 ; HgtE15 = HgtE15+22   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                            
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 0 and patE15 >= 55 and patE15 <= 56 and st3E15 == 3 
 and st1E15 == 32 and st2E15 == 16 and st3E15 == 3 and st4E15 == 2 
  or OIe15 == 255 and Ehp15 == 3 and LRE15 == 0 and patE15 >= 55 and patE15 <= 56 and st3E15 == 3 
 and st1E15 == 32 and st2E15 == 0 and st3E15 == 3 and st4E15 == 2 then                                                           --Magician                             
X_pos_E15 = X_pos_E15-3 ; Y_pos_E15 = Y_pos_E15-16 ; WgtE15 = WgtE15+7 ; HgtE15 = HgtE15+22  
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk) 
elseif OIe15 == 255 and Ehp15 == 1 and LRE15 == 1 and patE15 == 57 and st3E15 == 1 then                                 --Knife                                        
X_pos_E15 = X_pos_E15-2 ; Y_pos_E15 = Y_pos_E15-16 ; WgtE15 = WgtE15 ; HgtE15 = HgtE15   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                            
elseif OIe15 == 255 and Ehp15 == 1 and LRE15 == 0 and patE15 == 57 and st3E15 == 1 then                                 --Knife                            
X_pos_E15 = X_pos_E15-2 ; Y_pos_E15 = Y_pos_E15-16 ; WgtE15 = WgtE15 ; HgtE15 = HgtE15   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk) 
elseif OIe15 == 255 and Ehp15 == 2 and LRE15 == 1 and patE15 == 57 and st3E15 == 3 then                                 --Chair                                       
X_pos_E15 = X_pos_E15-1 ; Y_pos_E15 = Y_pos_E15-14 ; WgtE15 = WgtE15+9 ; HgtE15 = HgtE15+20   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                            
elseif OIe15 == 255 and Ehp15 == 2 and LRE15 == 0 and patE15 == 57 and st3E15 == 3 then                                 --Chair                            
X_pos_E15 = X_pos_E15-2 ; Y_pos_E15 = Y_pos_E15-14 ; WgtE15 = WgtE15+9 ; HgtE15 = HgtE15+20   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 1 and patE15 == 57 and st3E15 == 4
  or OIe15 == 255 and Ehp15 == 3 and LRE15 == 1 and patE15 == 56 and st3E15 == 4 then                                   --falcon                                       
X_pos_E15 = X_pos_E15-1 ; Y_pos_E15 = Y_pos_E15-16 ; WgtE15 = WgtE15+24 ; HgtE15 = HgtE15+16   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                            
elseif OIe15 == 255 and Ehp15 == 3 and LRE15 == 0 and patE15 == 57 and st3E15 == 4 
  or OIe15 == 255 and Ehp15 == 3 and LRE15 == 0 and patE15 == 56 and st3E15 == 4 then                                   --falcon                             
X_pos_E15 = X_pos_E15-2 ; Y_pos_E15 = Y_pos_E15-16 ; WgtE15 = WgtE15+24 ; HgtE15 = HgtE15+16   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)
elseif OIe15 == 255 and Ehp15 == 2 and LRE15 == 1 and patE15 == 58 and st3E15 == 3 then                                 --Painting pictures                                       
X_pos_E15 = X_pos_E15-2 ; Y_pos_E15 = Y_pos_E15-15 ; WgtE15 = WgtE15+12 ; HgtE15 = HgtE15+19  
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                            
elseif OIe15 == 255 and Ehp15 == 2 and LRE15 == 0 and patE15 == 58 and st3E15 == 3 then                                 --Painting pictures                            
X_pos_E15 = X_pos_E15 ; Y_pos_E15 = Y_pos_E15-15 ; WgtE15 = WgtE15+12 ; HgtE15 = HgtE15+19   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk) 
elseif OIe15 == 255 and Ehp15 == 2 and LRE15 == 1 and patE15 == 58 and st3E15 == 4 then                                 --Table doomed                                        
X_pos_E15 = X_pos_E15-1 ; Y_pos_E15 = Y_pos_E15-15 ; WgtE15 = WgtE15+20 ; HgtE15 = HgtE15+12   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                            
elseif OIe15 == 255 and Ehp15 == 2 and LRE15 == 0 and patE15 == 58 and st3E15 == 4 then                                 --Table doomed                           
X_pos_E15 = X_pos_E15-2 ; Y_pos_E15 = Y_pos_E15-15 ; WgtE15 = WgtE15+20 ; HgtE15 = HgtE15+12   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk) 
elseif OIe15 == 255 and Ehp15 == 1 and LRE15 == 1 and patE15 == 58 and st3E15 == 2 then                                 --Candle                                      
X_pos_E15 = X_pos_E15-1 ; Y_pos_E15 = Y_pos_E15-16 ; WgtE15 = WgtE15+8 ; HgtE15 = HgtE15+4   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                            
elseif OIe15 == 255 and Ehp15 == 1 and LRE15 == 0 and patE15 == 58 and st3E15 == 2 then                                 --Candle                          
X_pos_E15 = X_pos_E15-2 ; Y_pos_E15 = Y_pos_E15-16 ; WgtE15 = WgtE15+8 ; HgtE15 = HgtE15+4   
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,greenk)                      

end

if Ehp15 == 0 then                              -- stop hitbox enemy15
X_pos_E15 = X_pos_E15+1 ; Y_pos_E15 = Y_pos_E15-14       
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,NO15)
elseif Ehp15 > 0 and OIe15 == 0 then
gui.drawRectangle(X_pos_E15,Y_pos_E15,WgtE15,HgtE15,NO15)

end
end

local function Enemy16_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX16 = mainmemory.read_u8              --X coordinate
local YY16 = mainmemory.read_u8              --Y coordinate
local enemy16_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E16 = mainmemory.read_u8         --state1 
local stat2_E16 = mainmemory.read_u8         --state2 
local stat3_E16 = mainmemory.read_u8         --state3 
local stat4_E16 = mainmemory.read_u8         --state4 
local pat_E16 = mainmemory.read_u8           --pattern select
local pat_count_E16 = mainmemory.read_u8     --pattern start count
local RES_pat_E16 = mainmemory.read_u8       --result pattern
local LR_E16 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E16 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp16 = enemy16_hp(0x0D21)
local st1E16 = stat1_E16(0x0D38)
local st2E16 = stat2_E16(0x0D39)
local st3E16 = stat3_E16(0x0D3A)
local st4E16 = stat4_E16(0x0D3B)
local patE16 = pat_E16(0x0D27)
local PATcE16 = pat_count_E16(0x0D3F)
local RpatE16 = RES_pat_E16(0x0D3E)
local LRE16 = LR_E16(0x0D30)
local OIe16 = OI_E16(0x0D20)
local X_pos_E16 = XX16(0x0D24)
local Y_pos_E16 = YY16(0x0D22)
local WgtE16 = 10
local HgtE16 = 10
local pinky = 0xFFFFCCFF
local NO16 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,NO16)

elseif OIe16 == 255 and Ehp16 == 1 and LRE16 == 1 and patE16 == 50 and st3E16 == 1 then                       --Bat                                        
X_pos_E16 = X_pos_E16-1 ; Y_pos_E16 = Y_pos_E16-16 ; WgtE16 = WgtE16+8 ; HgtE16 = HgtE16+4   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                            
elseif OIe16 == 255 and Ehp16 == 1 and LRE16 == 0 and patE16 == 50 and st3E16 == 1 then                   --Bat                             
X_pos_E16 = X_pos_E16-2 ; Y_pos_E16 = Y_pos_E16-16 ; WgtE16 = WgtE16+8 ; HgtE16 = HgtE16+4   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                                                   
elseif OIe16 == 255 and Ehp16 == 2 and LRE16 == 1 and st1E16 == 16 and st2E16 == 32 and st3E16 == 2 and st4E16 == 2 
  or OIe16 == 255 and Ehp16 == 2 and LRE16 == 1 and st1E16 == 16 and st2E16 == 0 and st3E16 == 2 and st4E16 == 2 then  --Dog                           
X_pos_E16 = X_pos_E16+1 ; Y_pos_E16 = Y_pos_E16-17 ; WgtE16 = WgtE16+20 ; HgtE16 = HgtE16+7  
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                                  
elseif OIe16 == 255 and Ehp16 == 2 and LRE16 == 0 and st1E16 == 16 and st2E16 == 32 and st3E16 == 2 and st4E16 == 2 
  or OIe16 == 255 and Ehp16 == 2 and LRE16 == 0 and st1E16 == 16 and st2E16 == 0 and st3E16 == 2 and st4E16 == 2 then  --Dog                             
X_pos_E16 = X_pos_E16+1 ; Y_pos_E16 = Y_pos_E16-17 ; WgtE16 = WgtE16+20 ; HgtE16 = HgtE16+7  
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                                  
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 1 and st1E16 == 16 and st2E16 == 32 and st3E16 == 3 and st4E16 == 3 then  --super dog       
X_pos_E16 = X_pos_E16 ; Y_pos_E16 = Y_pos_E16-17 ; WgtE16 = WgtE16+20 ; HgtE16 = HgtE16+7  
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 0 and st1E16 == 16 and st2E16 == 32 and st3E16 == 3 and st4E16 == 3 then  --super dog       
X_pos_E16 = X_pos_E16 ; Y_pos_E16 = Y_pos_E16-17 ; WgtE16 = WgtE16+20 ; HgtE16 = HgtE16+7  
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)
elseif OIe16 == 255 and Ehp16 == 2 and LRE16 == 1 and patE16 >= 52 and st3E16 == 2 then                                 --ghost girl                             
X_pos_E16 = X_pos_E16-4 ; Y_pos_E16 = Y_pos_E16-17 ; WgtE16 = WgtE16+12 ; HgtE16 = HgtE16+23  
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                                  
elseif OIe16 == 255 and Ehp16 == 2 and LRE16 == 0 and patE16 == 52 and st3E16 == 2 then                                 --ghost girl             
X_pos_E16 = X_pos_E16-3 ; Y_pos_E16 = Y_pos_E16-17 ; WgtE16 = WgtE16+12 ; HgtE16 = HgtE16+23  
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 1 and patE16 >= 52  
and st1E16 == 32 and st2E16 == 16 and st3E16 == 3 and st4E16 == 3 then                                                 --Super ghost girl                             
X_pos_E16 = X_pos_E16-4 ; Y_pos_E16 = Y_pos_E16-17 ; WgtE16 = WgtE16+12 ; HgtE16 = HgtE16+23  
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                                 
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 0 and patE16 == 52 
and st1E16 == 32 and st2E16 == 16 and st3E16 == 3 and st4E16 == 3 then                                                 --Super ghost girl             
X_pos_E16 = X_pos_E16-3 ; Y_pos_E16 = Y_pos_E16-17 ; WgtE16 = WgtE16+12 ; HgtE16 = HgtE16+23  
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                    
elseif OIe16 == 255 and Ehp16 >= 2 and LRE16 == 1 and patE16 == 53 and st3E16 >= 3 then                                 --Goblin , super goblin                            
X_pos_E16 = X_pos_E16-4 ; Y_pos_E16 = Y_pos_E16-17 ; WgtE16 = WgtE16+10 ; HgtE16 = HgtE16+23  
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                                  
elseif OIe16 == 255 and Ehp16 >= 2 and LRE16 == 0 and patE16 == 53 and st3E16 >= 3 then                                 --Goblin , super goblin            
X_pos_E16 = X_pos_E16 ; Y_pos_E16 = Y_pos_E16-17 ; WgtE16 = WgtE16+10 ; HgtE16 = HgtE16+23  
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                     
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 1 and patE16 <= 52 and st3E16 == 3 
and st1E16 == 40 and st2E16 == 16 and st3E16 == 3 and st4E16 == 2 
  or OIe16 == 255 and Ehp16 == 3 and LRE16 == 1 and patE16 <= 52 and st3E16 == 3 
and st1E16 == 40 and st2E16 == 0 and st3E16 == 3 and st4E16 == 2 then                                                      --Strange man                               
X_pos_E16 = X_pos_E16 ; Y_pos_E16 = Y_pos_E16-16 ; WgtE16 = WgtE16+7 ; HgtE16 = HgtE16+30 
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                            
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 0 and patE16 == 51 and st3E16 == 3 
and st1E16 == 40 and st2E16 == 16 and st3E16 == 3 and st4E16 == 2 
  or OIe16 == 255 and Ehp16 == 3 and LRE16 == 0 and patE16 <= 52 and st3E16 == 3 
and st1E16 == 40 and st2E16 == 0 and st3E16 == 3 and st4E16 == 2 then                                                      --Strange man                            
X_pos_E16 = X_pos_E16-1 ; Y_pos_E16 = Y_pos_E16-16 ; WgtE16 = WgtE16+7 ; HgtE16 = HgtE16+30 
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                           
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 1 and patE16 == 55 and st3E16 == 4 then                                 --Skeleton                              
X_pos_E16 = X_pos_E16-8 ; Y_pos_E16 = Y_pos_E16-17 ; WgtE16 = WgtE16+15 ; HgtE16 = HgtE16+30 
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                            
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 0 and patE16 == 55 and st3E16 == 4 then                                 --Skeleton                              
X_pos_E16 = X_pos_E16-1 ; Y_pos_E16 = Y_pos_E16-17 ; WgtE16 = WgtE16+15 ; HgtE16 = HgtE16+30 
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 1 and patE16 == 54 and st3E16 == 3 then                                 --Wax dolls                           
X_pos_E16 = X_pos_E16-2 ; Y_pos_E16 = Y_pos_E16-14 ; WgtE16 = WgtE16+11 ; HgtE16 = HgtE16+28 
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                            
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 0 and patE16 == 54 and st3E16 == 3 then                                 --Wax dolls                           
X_pos_E16 = X_pos_E16-2 ; Y_pos_E16 = Y_pos_E16-14 ; WgtE16 = WgtE16+11 ; HgtE16 = HgtE16+28 
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 1 and patE16 >= 55 and patE16 <= 56 and st3E16 == 3 
 and st1E16 == 32 and st2E16 == 16 and st3E16 == 3 and st4E16 == 2 
  or OIe16 == 255 and Ehp16 == 3 and LRE16 == 1 and patE16 >= 55 and patE16 <= 56 and st3E16 == 3 
 and st1E16 == 32 and st2E16 == 0 and st3E16 == 3 and st4E16 == 2 then                                                          --Magician                                       
X_pos_E16 = X_pos_E16-1 ; Y_pos_E16 = Y_pos_E16-16 ; WgtE16 = WgtE16+7 ; HgtE16 = HgtE16+22   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                            
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 0 and patE16 >= 55 and patE16 <= 56 and st3E16 == 3 
 and st1E16 == 32 and st2E16 == 16 and st3E16 == 3 and st4E16 == 2 
  or OIe16 == 255 and Ehp16 == 3 and LRE16 == 0 and patE16 >= 55 and patE16 <= 56 and st3E16 == 3 
 and st1E16 == 32 and st2E16 == 0 and st3E16 == 3 and st4E16 == 2 then                                                           --Magician                             
X_pos_E16 = X_pos_E16-3 ; Y_pos_E16 = Y_pos_E16-16 ; WgtE16 = WgtE16+7 ; HgtE16 = HgtE16+22  
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky) 
elseif OIe16 == 255 and Ehp16 == 1 and LRE16 == 1 and patE16 == 57 and st3E16 == 1 then                                 --Knife                                        
X_pos_E16 = X_pos_E16-2 ; Y_pos_E16 = Y_pos_E16-16 ; WgtE16 = WgtE16 ; HgtE16 = HgtE16   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                            
elseif OIe16 == 255 and Ehp16 == 1 and LRE16 == 0 and patE16 == 57 and st3E16 == 1 then                                 --Knife                            
X_pos_E16 = X_pos_E16-2 ; Y_pos_E16 = Y_pos_E16-16 ; WgtE16 = WgtE16 ; HgtE16 = HgtE16   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky) 
elseif OIe16 == 255 and Ehp16 == 2 and LRE16 == 1 and patE16 == 57 and st3E16 == 3 then                                 --Chair                                       
X_pos_E16 = X_pos_E16-1 ; Y_pos_E16 = Y_pos_E16-14 ; WgtE16 = WgtE16+9 ; HgtE16 = HgtE16+20   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                            
elseif OIe16 == 255 and Ehp16 == 2 and LRE16 == 0 and patE16 == 57 and st3E16 == 3 then                                 --Chair                            
X_pos_E16 = X_pos_E16-2 ; Y_pos_E16 = Y_pos_E16-14 ; WgtE16 = WgtE16+9 ; HgtE16 = HgtE16+20   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 1 and patE16 == 57 and st3E16 == 4
  or OIe16 == 255 and Ehp16 == 3 and LRE16 == 1 and patE16 == 56 and st3E16 == 4 then                                   --falcon                                       
X_pos_E16 = X_pos_E16-1 ; Y_pos_E16 = Y_pos_E16-16 ; WgtE16 = WgtE16+24 ; HgtE16 = HgtE16+16   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                            
elseif OIe16 == 255 and Ehp16 == 3 and LRE16 == 0 and patE16 == 57 and st3E16 == 4 
  or OIe16 == 255 and Ehp16 == 3 and LRE16 == 0 and patE16 == 56 and st3E16 == 4 then                                   --falcon                             
X_pos_E16 = X_pos_E16-2 ; Y_pos_E16 = Y_pos_E16-16 ; WgtE16 = WgtE16+24 ; HgtE16 = HgtE16+16   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)
elseif OIe16 == 255 and Ehp16 == 2 and LRE16 == 1 and patE16 == 58 and st3E16 == 3 then                                 --Painting pictures                                       
X_pos_E16 = X_pos_E16-2 ; Y_pos_E16 = Y_pos_E16-15 ; WgtE16 = WgtE16+12 ; HgtE16 = HgtE16+19  
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                            
elseif OIe16 == 255 and Ehp16 == 2 and LRE16 == 0 and patE16 == 58 and st3E16 == 3 then                                 --Painting pictures                            
X_pos_E16 = X_pos_E16 ; Y_pos_E16 = Y_pos_E16-15 ; WgtE16 = WgtE16+12 ; HgtE16 = HgtE16+19   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky) 
elseif OIe16 == 255 and Ehp16 == 2 and LRE16 == 1 and patE16 == 58 and st3E16 == 4 then                                 --Table doomed                                        
X_pos_E16 = X_pos_E16-1 ; Y_pos_E16 = Y_pos_E16-15 ; WgtE16 = WgtE16+20 ; HgtE16 = HgtE16+12   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                            
elseif OIe16 == 255 and Ehp16 == 2 and LRE16 == 0 and patE16 == 58 and st3E16 == 4 then                                 --Table doomed                           
X_pos_E16 = X_pos_E16-2 ; Y_pos_E16 = Y_pos_E16-15 ; WgtE16 = WgtE16+20 ; HgtE16 = HgtE16+12   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky) 
elseif OIe16 == 255 and Ehp16 == 1 and LRE16 == 1 and patE16 == 58 and st3E16 == 2 then                                 --Candle                                      
X_pos_E16 = X_pos_E16-1 ; Y_pos_E16 = Y_pos_E16-16 ; WgtE16 = WgtE16+8 ; HgtE16 = HgtE16+4   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                            
elseif OIe16 == 255 and Ehp16 == 1 and LRE16 == 0 and patE16 == 58 and st3E16 == 2 then                                 --Candle                          
X_pos_E16 = X_pos_E16-2 ; Y_pos_E16 = Y_pos_E16-16 ; WgtE16 = WgtE16+8 ; HgtE16 = HgtE16+4   
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,pinky)                      

end

if Ehp16 == 0 then                              -- stop hitbox enemy16
X_pos_E16 = X_pos_E16+1 ; Y_pos_E16 = Y_pos_E16-14       
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,NO16)
elseif Ehp16 > 0 and OIe16 == 0 then
gui.drawRectangle(X_pos_E16,Y_pos_E16,WgtE16,HgtE16,NO16)

end
end

local function Enemy17_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX17 = mainmemory.read_u8              --X coordinate
local YY17 = mainmemory.read_u8              --Y coordinate
local enemy17_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E17 = mainmemory.read_u8         --state1 
local stat2_E17 = mainmemory.read_u8         --state2 
local stat3_E17 = mainmemory.read_u8         --state3 
local stat4_E17 = mainmemory.read_u8         --state4 
local pat_E17 = mainmemory.read_u8           --pattern select
local pat_count_E17 = mainmemory.read_u8     --pattern start count
local RES_pat_E17 = mainmemory.read_u8       --result pattern
local LR_E17 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E17 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp17 = enemy17_hp(0x0D41)
local st1E17 = stat1_E17(0x0D58)
local st2E17 = stat2_E17(0x0D59)
local st3E17 = stat3_E17(0x0D5A)
local st4E17 = stat4_E17(0x0D5B)
local patE17 = pat_E17(0x0D47)
local PATcE17 = pat_count_E17(0x0D5F)
local RpatE17 = RES_pat_E17(0x0D5E)
local LRE17 = LR_E17(0x0D50)
local OIe17 = OI_E17(0x0D40)
local X_pos_E17 = XX17(0x0D44)
local Y_pos_E17 = YY17(0x0D42)
local WgtE17 = 10
local HgtE17 = 10
local violleta = 0xFFCC0066
local NO17 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,NO17)

elseif OIe17 == 255 and Ehp17 == 1 and LRE17 == 1 and patE17 == 50 and st3E17 == 1 then                       --Bat                                        
X_pos_E17 = X_pos_E17-1 ; Y_pos_E17 = Y_pos_E17-16 ; WgtE17 = WgtE17+8 ; HgtE17 = HgtE17+4   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                            
elseif OIe17 == 255 and Ehp17 == 1 and LRE17 == 0 and patE17 == 50 and st3E17 == 1 then                   --Bat                             
X_pos_E17 = X_pos_E17-2 ; Y_pos_E17 = Y_pos_E17-16 ; WgtE17 = WgtE17+8 ; HgtE17 = HgtE17+4   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                                                   
elseif OIe17 == 255 and Ehp17 == 2 and LRE17 == 1 and st1E17 == 16 and st2E17 == 32 and st3E17 == 2 and st4E17 == 2 
  or OIe17 == 255 and Ehp17 == 2 and LRE17 == 1 and st1E17 == 16 and st2E17 == 0 and st3E17 == 2 and st4E17 == 2 then  --Dog                           
X_pos_E17 = X_pos_E17+1 ; Y_pos_E17 = Y_pos_E17-17 ; WgtE17 = WgtE17+20 ; HgtE17 = HgtE17+7  
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                                  
elseif OIe17 == 255 and Ehp17 == 2 and LRE17 == 0 and st1E17 == 16 and st2E17 == 32 and st3E17 == 2 and st4E17 == 2 
  or OIe17 == 255 and Ehp17 == 2 and LRE17 == 0 and st1E17 == 16 and st2E17 == 0 and st3E17 == 2 and st4E17 == 2 then  --Dog                             
X_pos_E17 = X_pos_E17+1 ; Y_pos_E17 = Y_pos_E17-17 ; WgtE17 = WgtE17+20 ; HgtE17 = HgtE17+7  
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                                  
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 1 and st1E17 == 16 and st2E17 == 32 and st3E17 == 3 and st4E17 == 3 then  --super dog       
X_pos_E17 = X_pos_E17 ; Y_pos_E17 = Y_pos_E17-17 ; WgtE17 = WgtE17+20 ; HgtE17 = HgtE17+7  
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 0 and st1E17 == 16 and st2E17 == 32 and st3E17 == 3 and st4E17 == 3 then  --super dog       
X_pos_E17 = X_pos_E17 ; Y_pos_E17 = Y_pos_E17-17 ; WgtE17 = WgtE17+20 ; HgtE17 = HgtE17+7  
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)
elseif OIe17 == 255 and Ehp17 == 2 and LRE17 == 1 and patE17 >= 52 and st3E17 == 2 then                                 --ghost girl                             
X_pos_E17 = X_pos_E17-4 ; Y_pos_E17 = Y_pos_E17-17 ; WgtE17 = WgtE17+12 ; HgtE17 = HgtE17+23  
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                                  
elseif OIe17 == 255 and Ehp17 == 2 and LRE17 == 0 and patE17 == 52 and st3E17 == 2 then                                 --ghost girl             
X_pos_E17 = X_pos_E17-3 ; Y_pos_E17 = Y_pos_E17-17 ; WgtE17 = WgtE17+12 ; HgtE17 = HgtE17+23  
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 1 and patE17 >= 52  
and st1E17 == 32 and st2E17 == 16 and st3E17 == 3 and st4E17 == 3 then                                                 --Super ghost girl                             
X_pos_E17 = X_pos_E17-4 ; Y_pos_E17 = Y_pos_E17-17 ; WgtE17 = WgtE17+12 ; HgtE17 = HgtE17+23  
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                                 
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 0 and patE17 == 52 
and st1E17 == 32 and st2E17 == 16 and st3E17 == 3 and st4E17 == 3 then                                                 --Super ghost girl             
X_pos_E17 = X_pos_E17-3 ; Y_pos_E17 = Y_pos_E17-17 ; WgtE17 = WgtE17+12 ; HgtE17 = HgtE17+23  
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                    
elseif OIe17 == 255 and Ehp17 >= 2 and LRE17 == 1 and patE17 == 53 and st3E17 >= 3 then                                 --Goblin , super goblin                            
X_pos_E17 = X_pos_E17-4 ; Y_pos_E17 = Y_pos_E17-17 ; WgtE17 = WgtE17+10 ; HgtE17 = HgtE17+23  
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                                  
elseif OIe17 == 255 and Ehp17 >= 2 and LRE17 == 0 and patE17 == 53 and st3E17 >= 3 then                                 --Goblin , super goblin            
X_pos_E17 = X_pos_E17 ; Y_pos_E17 = Y_pos_E17-17 ; WgtE17 = WgtE17+10 ; HgtE17 = HgtE17+23  
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                     
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 1 and patE17 <= 52 and st3E17 == 3 
and st1E17 == 40 and st2E17 == 16 and st3E17 == 3 and st4E17 == 2 
  or OIe17 == 255 and Ehp17 == 3 and LRE17 == 1 and patE17 <= 52 and st3E17 == 3 
and st1E17 == 40 and st2E17 == 0 and st3E17 == 3 and st4E17 == 2 then                                                      --Strange man                               
X_pos_E17 = X_pos_E17 ; Y_pos_E17 = Y_pos_E17-16 ; WgtE17 = WgtE17+7 ; HgtE17 = HgtE17+30 
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                            
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 0 and patE17 == 51 and st3E17 == 3 
and st1E17 == 40 and st2E17 == 16 and st3E17 == 3 and st4E17 == 2 
  or OIe17 == 255 and Ehp17 == 3 and LRE17 == 0 and patE17 <= 52 and st3E17 == 3 
and st1E17 == 40 and st2E17 == 0 and st3E17 == 3 and st4E17 == 2 then                                                      --Strange man                            
X_pos_E17 = X_pos_E17-1 ; Y_pos_E17 = Y_pos_E17-16 ; WgtE17 = WgtE17+7 ; HgtE17 = HgtE17+30 
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                           
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 1 and patE17 == 55 and st3E17 == 4 then                                 --Skeleton                              
X_pos_E17 = X_pos_E17-8 ; Y_pos_E17 = Y_pos_E17-17 ; WgtE17 = WgtE17+15 ; HgtE17 = HgtE17+30 
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                            
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 0 and patE17 == 55 and st3E17 == 4 then                                 --Skeleton                              
X_pos_E17 = X_pos_E17-1 ; Y_pos_E17 = Y_pos_E17-17 ; WgtE17 = WgtE17+15 ; HgtE17 = HgtE17+30 
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 1 and patE17 == 54 and st3E17 == 3 then                                 --Wax dolls                           
X_pos_E17 = X_pos_E17-2 ; Y_pos_E17 = Y_pos_E17-14 ; WgtE17 = WgtE17+11 ; HgtE17 = HgtE17+28 
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                            
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 0 and patE17 == 54 and st3E17 == 3 then                                 --Wax dolls                           
X_pos_E17 = X_pos_E17-2 ; Y_pos_E17 = Y_pos_E17-14 ; WgtE17 = WgtE17+11 ; HgtE17 = HgtE17+28 
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 1 and patE17 >= 55 and patE17 <= 56 and st3E17 == 3 
 and st1E17 == 32 and st2E17 == 16 and st3E17 == 3 and st4E17 == 2 
  or OIe17 == 255 and Ehp17 == 3 and LRE17 == 1 and patE17 >= 55 and patE17 <= 56 and st3E17 == 3 
 and st1E17 == 32 and st2E17 == 0 and st3E17 == 3 and st4E17 == 2 then                                                          --Magician                                       
X_pos_E17 = X_pos_E17-1 ; Y_pos_E17 = Y_pos_E17-16 ; WgtE17 = WgtE17+7 ; HgtE17 = HgtE17+22   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                            
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 0 and patE17 >= 55 and patE17 <= 56 and st3E17 == 3 
 and st1E17 == 32 and st2E17 == 16 and st3E17 == 3 and st4E17 == 2 
  or OIe17 == 255 and Ehp17 == 3 and LRE17 == 0 and patE17 >= 55 and patE17 <= 56 and st3E17 == 3 
 and st1E17 == 32 and st2E17 == 0 and st3E17 == 3 and st4E17 == 2 then                                                           --Magician                             
X_pos_E17 = X_pos_E17-3 ; Y_pos_E17 = Y_pos_E17-16 ; WgtE17 = WgtE17+7 ; HgtE17 = HgtE17+22  
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta) 
elseif OIe17 == 255 and Ehp17 == 1 and LRE17 == 1 and patE17 == 57 and st3E17 == 1 then                                 --Knife                                        
X_pos_E17 = X_pos_E17-2 ; Y_pos_E17 = Y_pos_E17-16 ; WgtE17 = WgtE17 ; HgtE17 = HgtE17   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                            
elseif OIe17 == 255 and Ehp17 == 1 and LRE17 == 0 and patE17 == 57 and st3E17 == 1 then                                 --Knife                            
X_pos_E17 = X_pos_E17-2 ; Y_pos_E17 = Y_pos_E17-16 ; WgtE17 = WgtE17 ; HgtE17 = HgtE17   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta) 
elseif OIe17 == 255 and Ehp17 == 2 and LRE17 == 1 and patE17 == 57 and st3E17 == 3 then                                 --Chair                                       
X_pos_E17 = X_pos_E17-1 ; Y_pos_E17 = Y_pos_E17-14 ; WgtE17 = WgtE17+9 ; HgtE17 = HgtE17+20   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                            
elseif OIe17 == 255 and Ehp17 == 2 and LRE17 == 0 and patE17 == 57 and st3E17 == 3 then                                 --Chair                            
X_pos_E17 = X_pos_E17-2 ; Y_pos_E17 = Y_pos_E17-14 ; WgtE17 = WgtE17+9 ; HgtE17 = HgtE17+20   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 1 and patE17 == 57 and st3E17 == 4
  or OIe17 == 255 and Ehp17 == 3 and LRE17 == 1 and patE17 == 56 and st3E17 == 4 then                                   --falcon                                       
X_pos_E17 = X_pos_E17-1 ; Y_pos_E17 = Y_pos_E17-16 ; WgtE17 = WgtE17+24 ; HgtE17 = HgtE17+16   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                            
elseif OIe17 == 255 and Ehp17 == 3 and LRE17 == 0 and patE17 == 57 and st3E17 == 4 
  or OIe17 == 255 and Ehp17 == 3 and LRE17 == 0 and patE17 == 56 and st3E17 == 4 then                                   --falcon                             
X_pos_E17 = X_pos_E17-2 ; Y_pos_E17 = Y_pos_E17-16 ; WgtE17 = WgtE17+24 ; HgtE17 = HgtE17+16   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)
elseif OIe17 == 255 and Ehp17 == 2 and LRE17 == 1 and patE17 == 58 and st3E17 == 3 then                                 --Painting pictures                                       
X_pos_E17 = X_pos_E17-2 ; Y_pos_E17 = Y_pos_E17-15 ; WgtE17 = WgtE17+12 ; HgtE17 = HgtE17+19  
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                            
elseif OIe17 == 255 and Ehp17 == 2 and LRE17 == 0 and patE17 == 58 and st3E17 == 3 then                                 --Painting pictures                            
X_pos_E17 = X_pos_E17 ; Y_pos_E17 = Y_pos_E17-15 ; WgtE17 = WgtE17+12 ; HgtE17 = HgtE17+19   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta) 
elseif OIe17 == 255 and Ehp17 == 2 and LRE17 == 1 and patE17 == 58 and st3E17 == 4 then                                 --Table doomed                                        
X_pos_E17 = X_pos_E17-1 ; Y_pos_E17 = Y_pos_E17-15 ; WgtE17 = WgtE17+20 ; HgtE17 = HgtE17+12   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                            
elseif OIe17 == 255 and Ehp17 == 2 and LRE17 == 0 and patE17 == 58 and st3E17 == 4 then                                 --Table doomed                           
X_pos_E17 = X_pos_E17-2 ; Y_pos_E17 = Y_pos_E17-15 ; WgtE17 = WgtE17+20 ; HgtE17 = HgtE17+12   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta) 
elseif OIe17 == 255 and Ehp17 == 1 and LRE17 == 1 and patE17 == 58 and st3E17 == 2 then                                 --Candle                                      
X_pos_E17 = X_pos_E17-1 ; Y_pos_E17 = Y_pos_E17-16 ; WgtE17 = WgtE17+8 ; HgtE17 = HgtE17+4   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                            
elseif OIe17 == 255 and Ehp17 == 1 and LRE17 == 0 and patE17 == 58 and st3E17 == 2 then                                 --Candle                          
X_pos_E17 = X_pos_E17-2 ; Y_pos_E17 = Y_pos_E17-16 ; WgtE17 = WgtE17+8 ; HgtE17 = HgtE17+4   
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,violleta)                      

end

if Ehp17 == 0 then                              -- stop hitbox enemy17
X_pos_E17 = X_pos_E17+1 ; Y_pos_E17 = Y_pos_E17-14       
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,NO17)
elseif Ehp17 > 0 and OIe17 == 0 then
gui.drawRectangle(X_pos_E17,Y_pos_E17,WgtE17,HgtE17,NO17)

end
end

local function Enemy18_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX18 = mainmemory.read_u8              --X coordinate
local YY18 = mainmemory.read_u8              --Y coordinate
local enemy18_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E18 = mainmemory.read_u8         --state1 
local stat2_E18 = mainmemory.read_u8         --state2 
local stat3_E18 = mainmemory.read_u8         --state3 
local stat4_E18 = mainmemory.read_u8         --state4 
local pat_E18 = mainmemory.read_u8           --pattern select
local pat_count_E18 = mainmemory.read_u8     --pattern start count
local RES_pat_E18 = mainmemory.read_u8       --result pattern
local LR_E18 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E18 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp18 = enemy18_hp(0x0D61)
local st1E18 = stat1_E18(0x0D78)
local st2E18 = stat2_E18(0x0D79)
local st3E18 = stat3_E18(0x0D7A)
local st4E18 = stat4_E18(0x0D7B)
local patE18 = pat_E18(0x0D67)
local PATcE18 = pat_count_E18(0x0D7F)
local RpatE18 = RES_pat_E18(0x0D7E)
local LRE18 = LR_E18(0x0D70)
local OIe18 = OI_E18(0x0D60)
local X_pos_E18 = XX18(0x0D64)
local Y_pos_E18 = YY18(0x0D62)
local WgtE18 = 10
local HgtE18 = 10
local pigreen = 0xFF99FF33
local NO18 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,NO18)

elseif OIe18 == 255 and Ehp18 == 1 and LRE18 == 1 and patE18 == 50 and st3E18 == 1 then                       --Bat                                        
X_pos_E18 = X_pos_E18-1 ; Y_pos_E18 = Y_pos_E18-16 ; WgtE18 = WgtE18+8 ; HgtE18 = HgtE18+4   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                            
elseif OIe18 == 255 and Ehp18 == 1 and LRE18 == 0 and patE18 == 50 and st3E18 == 1 then                   --Bat                             
X_pos_E18 = X_pos_E18-2 ; Y_pos_E18 = Y_pos_E18-16 ; WgtE18 = WgtE18+8 ; HgtE18 = HgtE18+4   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                                                   
elseif OIe18 == 255 and Ehp18 == 2 and LRE18 == 1 and st1E18 == 16 and st2E18 == 32 and st3E18 == 2 and st4E18 == 2 
  or OIe18 == 255 and Ehp18 == 2 and LRE18 == 1 and st1E18 == 16 and st2E18 == 0 and st3E18 == 2 and st4E18 == 2 then  --Dog                           
X_pos_E18 = X_pos_E18+1 ; Y_pos_E18 = Y_pos_E18-17 ; WgtE18 = WgtE18+20 ; HgtE18 = HgtE18+7  
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                                  
elseif OIe18 == 255 and Ehp18 == 2 and LRE18 == 0 and st1E18 == 16 and st2E18 == 32 and st3E18 == 2 and st4E18 == 2 
  or OIe18 == 255 and Ehp18 == 2 and LRE18 == 0 and st1E18 == 16 and st2E18 == 0 and st3E18 == 2 and st4E18 == 2 then  --Dog                             
X_pos_E18 = X_pos_E18+1 ; Y_pos_E18 = Y_pos_E18-17 ; WgtE18 = WgtE18+20 ; HgtE18 = HgtE18+7  
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                                  
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 1 and st1E18 == 16 and st2E18 == 32 and st3E18 == 3 and st4E18 == 3 then  --super dog       
X_pos_E18 = X_pos_E18 ; Y_pos_E18 = Y_pos_E18-17 ; WgtE18 = WgtE18+20 ; HgtE18 = HgtE18+7  
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 0 and st1E18 == 16 and st2E18 == 32 and st3E18 == 3 and st4E18 == 3 then  --super dog       
X_pos_E18 = X_pos_E18 ; Y_pos_E18 = Y_pos_E18-17 ; WgtE18 = WgtE18+20 ; HgtE18 = HgtE18+7  
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)
elseif OIe18 == 255 and Ehp18 == 2 and LRE18 == 1 and patE18 >= 52 and st3E18 == 2 then                                 --ghost girl                             
X_pos_E18 = X_pos_E18-4 ; Y_pos_E18 = Y_pos_E18-17 ; WgtE18 = WgtE18+12 ; HgtE18 = HgtE18+23  
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                                  
elseif OIe18 == 255 and Ehp18 == 2 and LRE18 == 0 and patE18 == 52 and st3E18 == 2 then                                 --ghost girl             
X_pos_E18 = X_pos_E18-3 ; Y_pos_E18 = Y_pos_E18-17 ; WgtE18 = WgtE18+12 ; HgtE18 = HgtE18+23  
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 1 and patE18 >= 52  
and st1E18 == 32 and st2E18 == 16 and st3E18 == 3 and st4E18 == 3 then                                                 --Super ghost girl                             
X_pos_E18 = X_pos_E18-4 ; Y_pos_E18 = Y_pos_E18-17 ; WgtE18 = WgtE18+12 ; HgtE18 = HgtE18+23  
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                                 
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 0 and patE18 == 52 
and st1E18 == 32 and st2E18 == 16 and st3E18 == 3 and st4E18 == 3 then                                                 --Super ghost girl             
X_pos_E18 = X_pos_E18-3 ; Y_pos_E18 = Y_pos_E18-17 ; WgtE18 = WgtE18+12 ; HgtE18 = HgtE18+23  
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                    
elseif OIe18 == 255 and Ehp18 >= 2 and LRE18 == 1 and patE18 == 53 and st3E18 >= 3 then                                 --Goblin , super goblin                            
X_pos_E18 = X_pos_E18-4 ; Y_pos_E18 = Y_pos_E18-17 ; WgtE18 = WgtE18+10 ; HgtE18 = HgtE18+23  
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                                  
elseif OIe18 == 255 and Ehp18 >= 2 and LRE18 == 0 and patE18 == 53 and st3E18 >= 3 then                                 --Goblin , super goblin            
X_pos_E18 = X_pos_E18 ; Y_pos_E18 = Y_pos_E18-17 ; WgtE18 = WgtE18+10 ; HgtE18 = HgtE18+23  
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                     
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 1 and patE18 <= 52 and st3E18 == 3 
and st1E18 == 40 and st2E18 == 16 and st3E18 == 3 and st4E18 == 2 
  or OIe18 == 255 and Ehp18 == 3 and LRE18 == 1 and patE18 <= 52 and st3E18 == 3 
and st1E18 == 40 and st2E18 == 0 and st3E18 == 3 and st4E18 == 2 then                                                      --Strange man                               
X_pos_E18 = X_pos_E18 ; Y_pos_E18 = Y_pos_E18-16 ; WgtE18 = WgtE18+7 ; HgtE18 = HgtE18+30 
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                            
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 0 and patE18 == 51 and st3E18 == 3 
and st1E18 == 40 and st2E18 == 16 and st3E18 == 3 and st4E18 == 2 
  or OIe18 == 255 and Ehp18 == 3 and LRE18 == 0 and patE18 <= 52 and st3E18 == 3 
and st1E18 == 40 and st2E18 == 0 and st3E18 == 3 and st4E18 == 2 then                                                      --Strange man                            
X_pos_E18 = X_pos_E18-1 ; Y_pos_E18 = Y_pos_E18-16 ; WgtE18 = WgtE18+7 ; HgtE18 = HgtE18+30 
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                           
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 1 and patE18 == 55 and st3E18 == 4 then                                 --Skeleton                              
X_pos_E18 = X_pos_E18-8 ; Y_pos_E18 = Y_pos_E18-17 ; WgtE18 = WgtE18+15 ; HgtE18 = HgtE18+30 
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                            
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 0 and patE18 == 55 and st3E18 == 4 then                                 --Skeleton                              
X_pos_E18 = X_pos_E18-1 ; Y_pos_E18 = Y_pos_E18-17 ; WgtE18 = WgtE18+15 ; HgtE18 = HgtE18+30 
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 1 and patE18 == 54 and st3E18 == 3 then                                 --Wax dolls                           
X_pos_E18 = X_pos_E18-2 ; Y_pos_E18 = Y_pos_E18-14 ; WgtE18 = WgtE18+11 ; HgtE18 = HgtE18+28 
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                            
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 0 and patE18 == 54 and st3E18 == 3 then                                 --Wax dolls                           
X_pos_E18 = X_pos_E18-2 ; Y_pos_E18 = Y_pos_E18-14 ; WgtE18 = WgtE18+11 ; HgtE18 = HgtE18+28 
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 1 and patE18 >= 55 and patE18 <= 56 and st3E18 == 3 
 and st1E18 == 32 and st2E18 == 16 and st3E18 == 3 and st4E18 == 2 
  or OIe18 == 255 and Ehp18 == 3 and LRE18 == 1 and patE18 >= 55 and patE18 <= 56 and st3E18 == 3 
 and st1E18 == 32 and st2E18 == 0 and st3E18 == 3 and st4E18 == 2 then                                                          --Magician                                       
X_pos_E18 = X_pos_E18-1 ; Y_pos_E18 = Y_pos_E18-16 ; WgtE18 = WgtE18+7 ; HgtE18 = HgtE18+22   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                            
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 0 and patE18 >= 55 and patE18 <= 56 and st3E18 == 3 
 and st1E18 == 32 and st2E18 == 16 and st3E18 == 3 and st4E18 == 2 
  or OIe18 == 255 and Ehp18 == 3 and LRE18 == 0 and patE18 >= 55 and patE18 <= 56 and st3E18 == 3 
 and st1E18 == 32 and st2E18 == 0 and st3E18 == 3 and st4E18 == 2 then                                                           --Magician                             
X_pos_E18 = X_pos_E18-3 ; Y_pos_E18 = Y_pos_E18-16 ; WgtE18 = WgtE18+7 ; HgtE18 = HgtE18+22  
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen) 
elseif OIe18 == 255 and Ehp18 == 1 and LRE18 == 1 and patE18 == 57 and st3E18 == 1 then                                 --Knife                                        
X_pos_E18 = X_pos_E18-2 ; Y_pos_E18 = Y_pos_E18-16 ; WgtE18 = WgtE18 ; HgtE18 = HgtE18   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                            
elseif OIe18 == 255 and Ehp18 == 1 and LRE18 == 0 and patE18 == 57 and st3E18 == 1 then                                 --Knife                            
X_pos_E18 = X_pos_E18-2 ; Y_pos_E18 = Y_pos_E18-16 ; WgtE18 = WgtE18 ; HgtE18 = HgtE18   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen) 
elseif OIe18 == 255 and Ehp18 == 2 and LRE18 == 1 and patE18 == 57 and st3E18 == 3 then                                 --Chair                                       
X_pos_E18 = X_pos_E18-1 ; Y_pos_E18 = Y_pos_E18-14 ; WgtE18 = WgtE18+9 ; HgtE18 = HgtE18+20   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                            
elseif OIe18 == 255 and Ehp18 == 2 and LRE18 == 0 and patE18 == 57 and st3E18 == 3 then                                 --Chair                            
X_pos_E18 = X_pos_E18-2 ; Y_pos_E18 = Y_pos_E18-14 ; WgtE18 = WgtE18+9 ; HgtE18 = HgtE18+20   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 1 and patE18 == 57 and st3E18 == 4
  or OIe18 == 255 and Ehp18 == 3 and LRE18 == 1 and patE18 == 56 and st3E18 == 4 then                                   --falcon                                       
X_pos_E18 = X_pos_E18-1 ; Y_pos_E18 = Y_pos_E18-16 ; WgtE18 = WgtE18+24 ; HgtE18 = HgtE18+16   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                            
elseif OIe18 == 255 and Ehp18 == 3 and LRE18 == 0 and patE18 == 57 and st3E18 == 4 
  or OIe18 == 255 and Ehp18 == 3 and LRE18 == 0 and patE18 == 56 and st3E18 == 4 then                                   --falcon                             
X_pos_E18 = X_pos_E18-2 ; Y_pos_E18 = Y_pos_E18-16 ; WgtE18 = WgtE18+24 ; HgtE18 = HgtE18+16   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)
elseif OIe18 == 255 and Ehp18 == 2 and LRE18 == 1 and patE18 == 58 and st3E18 == 3 then                                 --Painting pictures                                       
X_pos_E18 = X_pos_E18-2 ; Y_pos_E18 = Y_pos_E18-15 ; WgtE18 = WgtE18+12 ; HgtE18 = HgtE18+19  
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                            
elseif OIe18 == 255 and Ehp18 == 2 and LRE18 == 0 and patE18 == 58 and st3E18 == 3 then                                 --Painting pictures                            
X_pos_E18 = X_pos_E18 ; Y_pos_E18 = Y_pos_E18-15 ; WgtE18 = WgtE18+12 ; HgtE18 = HgtE18+19   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen) 
elseif OIe18 == 255 and Ehp18 == 2 and LRE18 == 1 and patE18 == 58 and st3E18 == 4 then                                 --Table doomed                                        
X_pos_E18 = X_pos_E18-1 ; Y_pos_E18 = Y_pos_E18-15 ; WgtE18 = WgtE18+20 ; HgtE18 = HgtE18+12   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                            
elseif OIe18 == 255 and Ehp18 == 2 and LRE18 == 0 and patE18 == 58 and st3E18 == 4 then                                 --Table doomed                           
X_pos_E18 = X_pos_E18-2 ; Y_pos_E18 = Y_pos_E18-15 ; WgtE18 = WgtE18+20 ; HgtE18 = HgtE18+12   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen) 
elseif OIe18 == 255 and Ehp18 == 1 and LRE18 == 1 and patE18 == 58 and st3E18 == 2 then                                 --Candle                                      
X_pos_E18 = X_pos_E18-1 ; Y_pos_E18 = Y_pos_E18-16 ; WgtE18 = WgtE18+8 ; HgtE18 = HgtE18+4   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                            
elseif OIe18 == 255 and Ehp18 == 1 and LRE18 == 0 and patE18 == 58 and st3E18 == 2 then                                 --Candle                          
X_pos_E18 = X_pos_E18-2 ; Y_pos_E18 = Y_pos_E18-16 ; WgtE18 = WgtE18+8 ; HgtE18 = HgtE18+4   
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,pigreen)                      

end

if Ehp18 == 0 then                              -- stop hitbox enemy18
X_pos_E18 = X_pos_E18+1 ; Y_pos_E18 = Y_pos_E18-14       
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,NO18)
elseif Ehp18 > 0 and OIe18 == 0 then
gui.drawRectangle(X_pos_E18,Y_pos_E18,WgtE18,HgtE18,NO18)

end
end

local function Enemy19_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX19 = mainmemory.read_u8              --X coordinate
local YY19 = mainmemory.read_u8              --Y coordinate
local enemy19_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E19 = mainmemory.read_u8         --state1 
local stat2_E19 = mainmemory.read_u8         --state2 
local stat3_E19 = mainmemory.read_u8         --state3 
local stat4_E19 = mainmemory.read_u8         --state4 
local pat_E19 = mainmemory.read_u8           --pattern select
local pat_count_E19 = mainmemory.read_u8     --pattern start count
local RES_pat_E19 = mainmemory.read_u8       --result pattern
local LR_E19 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E19 = mainmemory.read_u8
local Scon = score_ONoff(0x00FD)
local Ehp19 = enemy19_hp(0x0D81)
local st1E19 = stat1_E19(0x0D98)
local st2E19 = stat2_E19(0x0D99)
local st3E19 = stat3_E19(0x0D9A)
local st4E19 = stat4_E19(0x0D9B)
local patE19 = pat_E19(0x0D87)
local PATcE19 = pat_count_E19(0x0D9F)
local RpatE19 = RES_pat_E19(0x0D9E)
local LRE19 = LR_E19(0x0D90)
local OIe19 = OI_E19(0x0D80)
local X_pos_E19 = XX19(0x0D84)
local Y_pos_E19 = YY19(0x0D82)
local WgtE19 = 10
local HgtE19 = 10
local naranja = 0xFFFF9933
local NO19 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,NO19)

elseif OIe19 == 255 and Ehp19 == 1 and LRE19 == 1 and patE19 == 50 and st3E19 == 1 then                       --Bat                                        
X_pos_E19 = X_pos_E19-1 ; Y_pos_E19 = Y_pos_E19-16 ; WgtE19 = WgtE19+8 ; HgtE19 = HgtE19+4   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                            
elseif OIe19 == 255 and Ehp19 == 1 and LRE19 == 0 and patE19 == 50 and st3E19 == 1 then                   --Bat                             
X_pos_E19 = X_pos_E19-2 ; Y_pos_E19 = Y_pos_E19-16 ; WgtE19 = WgtE19+8 ; HgtE19 = HgtE19+4   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                                                   
elseif OIe19 == 255 and Ehp19 == 2 and LRE19 == 1 and st1E19 == 16 and st2E19 == 32 and st3E19 == 2 and st4E19 == 2 
  or OIe19 == 255 and Ehp19 == 2 and LRE19 == 1 and st1E19 == 16 and st2E19 == 0 and st3E19 == 2 and st4E19 == 2 then  --Dog                           
X_pos_E19 = X_pos_E19+1 ; Y_pos_E19 = Y_pos_E19-17 ; WgtE19 = WgtE19+20 ; HgtE19 = HgtE19+7  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                                  
elseif OIe19 == 255 and Ehp19 == 2 and LRE19 == 0 and st1E19 == 16 and st2E19 == 32 and st3E19 == 2 and st4E19 == 2 
  or OIe19 == 255 and Ehp19 == 2 and LRE19 == 0 and st1E19 == 16 and st2E19 == 0 and st3E19 == 2 and st4E19 == 2 then  --Dog                             
X_pos_E19 = X_pos_E19+1 ; Y_pos_E19 = Y_pos_E19-17 ; WgtE19 = WgtE19+20 ; HgtE19 = HgtE19+7  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                                  
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 1 and st1E19 == 16 and st2E19 == 32 and st3E19 == 3 and st4E19 == 3 then  --super dog       
X_pos_E19 = X_pos_E19 ; Y_pos_E19 = Y_pos_E19-17 ; WgtE19 = WgtE19+20 ; HgtE19 = HgtE19+7  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 0 and st1E19 == 16 and st2E19 == 32 and st3E19 == 3 and st4E19 == 3 then  --super dog       
X_pos_E19 = X_pos_E19 ; Y_pos_E19 = Y_pos_E19-17 ; WgtE19 = WgtE19+20 ; HgtE19 = HgtE19+7  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)
elseif OIe19 == 255 and Ehp19 == 2 and LRE19 == 1 and patE19 >= 52 and st3E19 == 2 then                                 --ghost girl                             
X_pos_E19 = X_pos_E19-4 ; Y_pos_E19 = Y_pos_E19-17 ; WgtE19 = WgtE19+12 ; HgtE19 = HgtE19+23  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                                  
elseif OIe19 == 255 and Ehp19 == 2 and LRE19 == 0 and patE19 == 52 and st3E19 == 2 then                                 --ghost girl             
X_pos_E19 = X_pos_E19-3 ; Y_pos_E19 = Y_pos_E19-17 ; WgtE19 = WgtE19+12 ; HgtE19 = HgtE19+23  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 1 and patE19 >= 52  
and st1E19 == 32 and st2E19 == 16 and st3E19 == 3 and st4E19 == 3 then                                                 --Super ghost girl                             
X_pos_E19 = X_pos_E19-4 ; Y_pos_E19 = Y_pos_E19-17 ; WgtE19 = WgtE19+12 ; HgtE19 = HgtE19+23  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                                 
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 0 and patE19 == 52 
and st1E19 == 32 and st2E19 == 16 and st3E19 == 3 and st4E19 == 3 then                                                 --Super ghost girl             
X_pos_E19 = X_pos_E19-3 ; Y_pos_E19 = Y_pos_E19-17 ; WgtE19 = WgtE19+12 ; HgtE19 = HgtE19+23  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                    
elseif OIe19 == 255 and Ehp19 >= 2 and LRE19 == 1 and patE19 == 53 and st3E19 >= 3 then                                 --Goblin , super goblin                            
X_pos_E19 = X_pos_E19-4 ; Y_pos_E19 = Y_pos_E19-17 ; WgtE19 = WgtE19+10 ; HgtE19 = HgtE19+23  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                                  
elseif OIe19 == 255 and Ehp19 >= 2 and LRE19 == 0 and patE19 == 53 and st3E19 >= 3 then                                 --Goblin , super goblin            
X_pos_E19 = X_pos_E19 ; Y_pos_E19 = Y_pos_E19-17 ; WgtE19 = WgtE19+10 ; HgtE19 = HgtE19+23  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                     
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 1 and patE19 <= 52 and st3E19 == 3 
and st1E19 == 40 and st2E19 == 16 and st3E19 == 3 and st4E19 == 2 
  or OIe19 == 255 and Ehp19 == 3 and LRE19 == 1 and patE19 <= 52 and st3E19 == 3 
and st1E19 == 40 and st2E19 == 0 and st3E19 == 3 and st4E19 == 2 then                                                      --Strange man                               
X_pos_E19 = X_pos_E19 ; Y_pos_E19 = Y_pos_E19-16 ; WgtE19 = WgtE19+7 ; HgtE19 = HgtE19+30 
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                            
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 0 and patE19 == 51 and st3E19 == 3 
and st1E19 == 40 and st2E19 == 16 and st3E19 == 3 and st4E19 == 2 
  or OIe19 == 255 and Ehp19 == 3 and LRE19 == 0 and patE19 <= 52 and st3E19 == 3 
and st1E19 == 40 and st2E19 == 0 and st3E19 == 3 and st4E19 == 2 then                                                      --Strange man                            
X_pos_E19 = X_pos_E19-1 ; Y_pos_E19 = Y_pos_E19-16 ; WgtE19 = WgtE19+7 ; HgtE19 = HgtE19+30 
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                           
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 1 and patE19 == 55 and st3E19 == 4 then                                 --Skeleton                              
X_pos_E19 = X_pos_E19-8 ; Y_pos_E19 = Y_pos_E19-17 ; WgtE19 = WgtE19+15 ; HgtE19 = HgtE19+30 
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                            
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 0 and patE19 == 55 and st3E19 == 4 then                                 --Skeleton                              
X_pos_E19 = X_pos_E19-1 ; Y_pos_E19 = Y_pos_E19-17 ; WgtE19 = WgtE19+15 ; HgtE19 = HgtE19+30 
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 1 and patE19 == 54 and st3E19 == 3 then                                 --Wax dolls                           
X_pos_E19 = X_pos_E19-2 ; Y_pos_E19 = Y_pos_E19-14 ; WgtE19 = WgtE19+11 ; HgtE19 = HgtE19+28 
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                            
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 0 and patE19 == 54 and st3E19 == 3 then                                 --Wax dolls                           
X_pos_E19 = X_pos_E19-2 ; Y_pos_E19 = Y_pos_E19-14 ; WgtE19 = WgtE19+11 ; HgtE19 = HgtE19+28 
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 1 and patE19 >= 55 and patE19 <= 56 and st3E19 == 3 
 and st1E19 == 32 and st2E19 == 16 and st3E19 == 3 and st4E19 == 2 
  or OIe19 == 255 and Ehp19 == 3 and LRE19 == 1 and patE19 >= 55 and patE19 <= 56 and st3E19 == 3 
 and st1E19 == 32 and st2E19 == 0 and st3E19 == 3 and st4E19 == 2 then                                                          --Magician                                       
X_pos_E19 = X_pos_E19-1 ; Y_pos_E19 = Y_pos_E19-16 ; WgtE19 = WgtE19+7 ; HgtE19 = HgtE19+22   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                            
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 0 and patE19 >= 55 and patE19 <= 56 and st3E19 == 3 
 and st1E19 == 32 and st2E19 == 16 and st3E19 == 3 and st4E19 == 2 
   or OIe19 == 255 and Ehp19 == 3 and LRE19 == 0 and patE19 >= 55 and patE19 <= 56 and st3E19 == 3 
 and st1E19 == 32 and st2E19 == 0 and st3E19 == 3 and st4E19 == 2 then                                                           --Magician                             
X_pos_E19 = X_pos_E19-3 ; Y_pos_E19 = Y_pos_E19-16 ; WgtE19 = WgtE19+7 ; HgtE19 = HgtE19+22  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja) 
elseif OIe19 == 255 and Ehp19 == 1 and LRE19 == 1 and patE19 == 57 and st3E19 == 1 then                                 --Knife                                        
X_pos_E19 = X_pos_E19-2 ; Y_pos_E19 = Y_pos_E19-16 ; WgtE19 = WgtE19 ; HgtE19 = HgtE19   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                            
elseif OIe19 == 255 and Ehp19 == 1 and LRE19 == 0 and patE19 == 57 and st3E19 == 1 then                                 --Knife                            
X_pos_E19 = X_pos_E19-2 ; Y_pos_E19 = Y_pos_E19-16 ; WgtE19 = WgtE19 ; HgtE19 = HgtE19   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja) 
elseif OIe19 == 255 and Ehp19 == 2 and LRE19 == 1 and patE19 == 57 and st3E19 == 3 then                                 --Chair                                       
X_pos_E19 = X_pos_E19-1 ; Y_pos_E19 = Y_pos_E19-14 ; WgtE19 = WgtE19+9 ; HgtE19 = HgtE19+20   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                            
elseif OIe19 == 255 and Ehp19 == 2 and LRE19 == 0 and patE19 == 57 and st3E19 == 3 then                                 --Chair                            
X_pos_E19 = X_pos_E19-2 ; Y_pos_E19 = Y_pos_E19-14 ; WgtE19 = WgtE19+9 ; HgtE19 = HgtE19+20   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 1 and patE19 == 57 and st3E19 == 4
  or OIe19 == 255 and Ehp19 == 3 and LRE19 == 1 and patE19 == 56 and st3E19 == 4 then                                   --falcon                                       
X_pos_E19 = X_pos_E19-1 ; Y_pos_E19 = Y_pos_E19-16 ; WgtE19 = WgtE19+24 ; HgtE19 = HgtE19+16   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                            
elseif OIe19 == 255 and Ehp19 == 3 and LRE19 == 0 and patE19 == 57 and st3E19 == 4 
  or OIe19 == 255 and Ehp19 == 3 and LRE19 == 0 and patE19 == 56 and st3E19 == 4 then                                   --falcon                             
X_pos_E19 = X_pos_E19-2 ; Y_pos_E19 = Y_pos_E19-16 ; WgtE19 = WgtE19+24 ; HgtE19 = HgtE19+16   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)
elseif OIe19 == 255 and Ehp19 == 2 and LRE19 == 1 and patE19 == 58 and st3E19 == 3 then                                 --Painting pictures                                       
X_pos_E19 = X_pos_E19-2 ; Y_pos_E19 = Y_pos_E19-15 ; WgtE19 = WgtE19+12 ; HgtE19 = HgtE19+19  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                            
elseif OIe19 == 255 and Ehp19 == 2 and LRE19 == 0 and patE19 == 58 and st3E19 == 3 then                                 --Painting pictures                            
X_pos_E19 = X_pos_E19 ; Y_pos_E19 = Y_pos_E19-15 ; WgtE19 = WgtE19+12 ; HgtE19 = HgtE19+19   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja) 
elseif OIe19 == 255 and Ehp19 == 2 and LRE19 == 1 and patE19 == 58 and st3E19 == 4 then                                 --Table doomed                                        
X_pos_E19 = X_pos_E19-1 ; Y_pos_E19 = Y_pos_E19-15 ; WgtE19 = WgtE19+20 ; HgtE19 = HgtE19+12  
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                            
elseif OIe19 == 255 and Ehp19 == 2 and LRE19 == 0 and patE19 == 58 and st3E19 == 4 then                                 --Table doomed                           
X_pos_E19 = X_pos_E19-2 ; Y_pos_E19 = Y_pos_E19-15 ; WgtE19 = WgtE19+20 ; HgtE19 = HgtE19+12   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja) 
elseif OIe19 == 255 and Ehp19 == 1 and LRE19 == 1 and patE19 == 58 and st3E19 == 2 then                                 --Candle                                      
X_pos_E19 = X_pos_E19-1 ; Y_pos_E19 = Y_pos_E19-16 ; WgtE19 = WgtE19+8 ; HgtE19 = HgtE19+4   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                            
elseif OIe19 == 255 and Ehp19 == 1 and LRE19 == 0 and patE19 == 58 and st3E19 == 2 then                                 --Candle                          
X_pos_E19 = X_pos_E19-2 ; Y_pos_E19 = Y_pos_E19-16 ; WgtE19 = WgtE19+8 ; HgtE19 = HgtE19+4   
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,naranja)                      

end

if Ehp19 == 0 then                              -- stop hitbox enemy19
X_pos_E19 = X_pos_E19+1 ; Y_pos_E19 = Y_pos_E19-14       
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,NO19)
elseif Ehp19 > 0 and OIe19 == 0 then
gui.drawRectangle(X_pos_E19,Y_pos_E19,WgtE19,HgtE19,NO19)

end
end

local function Enemy20_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX20 = mainmemory.read_u8              --X coordinate
local YY20 = mainmemory.read_u8              --Y coordinate
local enemy20_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E20 = mainmemory.read_u8         --state1 
local stat2_E20 = mainmemory.read_u8         --state2 
local stat3_E20= mainmemory.read_u8          --state3 
local stat4_E20= mainmemory.read_u8          --state4 
local pat_E20 = mainmemory.read_u8           --pattern select
local pat_count_E20 = mainmemory.read_u8     --pattern start count
local RES_pat_E20 = mainmemory.read_u8       --result pattern
local LR_E20 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E20 = mainmemory.read_u8            --check if enemy20 is loaded 
local Scon = score_ONoff(0x00FD)
local Ehp20 = enemy20_hp(0x0DA1)
local st1E20 = stat1_E20(0x0DB8)
local st2E20 = stat2_E20(0x0DB9)
local st3E20 = stat3_E20(0x0DBA)
local st4E20 = stat4_E20(0x0DBB)
local patE20 = pat_E20(0x0DA7)
local PATcE20 = pat_count_E20(0x0DBF)
local RpatE20 = RES_pat_E20(0x0DBE)
local LRE20 = LR_E20(0x0DB0)
local OIe20 = OI_E20(0x0DA0)
local X_pos_E20 = XX20(0x0DA4)
local Y_pos_E20 = YY20(0x0DA2)
local WgtE20 = 10
local HgtE20 = 10
local redx = 0xFFCC0000
local NO20 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,NO20)

elseif OIe20 == 255 and Ehp20 == 1 and LRE20 == 1 and patE20 == 50 and st3E20 == 1 then                                        --Bat                                        
X_pos_E20 = X_pos_E20-1 ; Y_pos_E20 = Y_pos_E20-16 ; WgtE20 = WgtE20+8 ; HgtE20 = HgtE20+4   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                            
elseif OIe20 == 255 and Ehp20 == 1 and LRE20 == 0 and patE20 == 50 and st3E20 == 1 then                                    --Bat                             
X_pos_E20 = X_pos_E20-2 ; Y_pos_E20 = Y_pos_E20-16 ; WgtE20 = WgtE20+8 ; HgtE20 = HgtE20+4   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                                                   
elseif OIe20 == 255 and Ehp20 == 2 and LRE20 == 1 and st1E20 == 16 and st2E20 == 32 and st3E20 == 2 and st4E20 == 2 
  or OIe20 == 255 and Ehp20 == 2 and LRE20 == 1 and st1E20 == 16 and st2E20 == 0 and st3E20 == 2 and st4E20 == 2 then      --Dog                           
X_pos_E20 = X_pos_E20+1 ; Y_pos_E20 = Y_pos_E20-17 ; WgtE20 = WgtE20+20 ; HgtE20 = HgtE20+7  
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                                  
elseif OIe20 == 255 and Ehp20 == 2 and LRE20 == 0 and st1E20 == 16 and st2E20 == 32 and st3E20 == 2 and st4E20 == 2 
  or OIe20 == 255 and Ehp20 == 2 and LRE20 == 0 and st1E20 == 16 and st2E20 == 0 and st3E20 == 2 and st4E20 == 2 then      --Dog                             
X_pos_E20 = X_pos_E20+1 ; Y_pos_E20 = Y_pos_E20-17 ; WgtE20 = WgtE20+20 ; HgtE20 = HgtE20+7  
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                                  
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 1 and st1E20 == 16 and st2E20 == 32 and st3E20 == 3 and st4E20 == 3 then   --super dog       
X_pos_E20 = X_pos_E20 ; Y_pos_E20 = Y_pos_E20-17 ; WgtE20 = WgtE20+20 ; HgtE20 = HgtE20+7  
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 0 and st1E20 == 16 and st2E20 == 32 and st3E20 == 3 and st4E20 == 3 then   --super dog       
X_pos_E20 = X_pos_E20 ; Y_pos_E20 = Y_pos_E20-17 ; WgtE20 = WgtE20+20 ; HgtE20 = HgtE20+7  
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)
elseif OIe20 == 255 and Ehp20 == 2 and LRE20 == 1 and patE20 >= 52 and st3E20 == 2 then                                    --ghost girl                             
X_pos_E20 = X_pos_E20-4 ; Y_pos_E20 = Y_pos_E20-17 ; WgtE20 = WgtE20+12 ; HgtE20 = HgtE20+23  
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                                  
elseif OIe20 == 255 and Ehp20 == 2 and LRE20 == 0 and patE20 == 52 and st3E20 == 2 then                                    --ghost girl             
X_pos_E20 = X_pos_E20-3 ; Y_pos_E20 = Y_pos_E20-17 ; WgtE20 = WgtE20+12 ; HgtE20 = HgtE20+23  
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 1 and patE20 >= 52  
and st1E20 == 32 and st2E20 == 16 and st3E20 == 3 and st4E20 == 3 then                                                     --Super ghost girl                             
X_pos_E20 = X_pos_E20-4 ; Y_pos_E20 = Y_pos_E20-17 ; WgtE20 = WgtE20+12 ; HgtE20 = HgtE20+23  
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                                 
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 0 and patE20 == 52 
and st1E20 == 32 and st2E20 == 16 and st3E20 == 3 and st4E20 == 3 then                                                     --Super ghost girl             
X_pos_E20 = X_pos_E20-3 ; Y_pos_E20 = Y_pos_E20-17 ; WgtE20 = WgtE20+12 ; HgtE20 = HgtE20+23  
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                    
elseif OIe20 == 255 and Ehp20 >= 2 and LRE20 == 1 and patE20 == 53 and st3E20 >= 3 then                                    --Goblin , super goblin                            
X_pos_E20 = X_pos_E20-4 ; Y_pos_E20 = Y_pos_E20-17 ; WgtE20 = WgtE20+10 ; HgtE20 = HgtE20+23  
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                                  
elseif OIe20 == 255 and Ehp20 >= 2 and LRE20 == 0 and patE20 == 53 and st3E20 >= 3 then                                    --Goblin , super goblin            
X_pos_E20 = X_pos_E20 ; Y_pos_E20 = Y_pos_E20-17 ; WgtE20 = WgtE20+10 ; HgtE20 = HgtE20+23  
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                     
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 1 and patE20 <= 52 and st3E20 == 3 
and st1E20 == 40 and st2E20 == 16 and st3E20 == 3 and st4E20 == 2 
  or OIe20 == 255 and Ehp20 == 3 and LRE20 == 1 and patE20 <= 52 and st3E20 == 3 
and st1E20 == 40 and st2E20 == 0 and st3E20 == 3 and st4E20 == 2 then                                                      --Strange man                               
X_pos_E20 = X_pos_E20 ; Y_pos_E20 = Y_pos_E20-16 ; WgtE20 = WgtE20+7 ; HgtE20 = HgtE20+30 
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                            
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 0 and patE20 == 51 and st3E20 == 3 
and st1E20 == 40 and st2E20 == 16 and st3E20 == 3 and st4E20 == 2 
  or OIe20 == 255 and Ehp20 == 3 and LRE20 == 0 and patE20 <= 52 and st3E20 == 3 
and st1E20 == 40 and st2E20 == 0 and st3E20 == 3 and st4E20 == 2 then                                                      --Strange man                            
X_pos_E20 = X_pos_E20-1 ; Y_pos_E20 = Y_pos_E20-16 ; WgtE20 = WgtE20+7 ; HgtE20 = HgtE20+30 
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                           
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 1 and patE20 == 55 and st3E20 == 4 then                                    --Skeleton                              
X_pos_E20 = X_pos_E20-8 ; Y_pos_E20 = Y_pos_E20-17 ; WgtE20 = WgtE20+15 ; HgtE20 = HgtE20+30 
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                            
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 0 and patE20 == 55 and st3E20 == 4 then                                    --Skeleton                              
X_pos_E20 = X_pos_E20-1 ; Y_pos_E20 = Y_pos_E20-17 ; WgtE20 = WgtE20+15 ; HgtE20 = HgtE20+30 
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 1 and patE20 == 54 and st3E20 == 3 then                                    --Wax dolls                           
X_pos_E20 = X_pos_E20-2 ; Y_pos_E20 = Y_pos_E20-14 ; WgtE20 = WgtE20+11 ; HgtE20 = HgtE20+28 
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                            
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 0 and patE20 == 54 and st3E20 == 3 then                                    --Wax dolls                           
X_pos_E20 = X_pos_E20-2 ; Y_pos_E20 = Y_pos_E20-14 ; WgtE20 = WgtE20+11 ; HgtE20 = HgtE20+28 
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 1 and patE20 >= 55 and patE20 <= 56 and st3E20 == 3 
 and st1E20 == 32 and st2E20 == 16 and st3E20 == 3 and st4E20 == 2 
  or OIe20 == 255 and Ehp20 == 3 and LRE20 == 1 and patE20 >= 55 and patE20 <= 56 and st3E20 == 3 
 and st1E20 == 32 and st2E20 == 0 and st3E20 == 3 and st4E20 == 2 then                                                     --Magician                                       
X_pos_E20 = X_pos_E20-1 ; Y_pos_E20 = Y_pos_E20-16 ; WgtE20 = WgtE20+7 ; HgtE20 = HgtE20+22   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                            
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 0 and patE20 >= 55 and patE20 <= 56 and st3E20 == 3 
 and st1E20 == 32 and st2E20 == 16 and st3E20 == 3 and st4E20 == 2 
  or OIe20 == 255 and Ehp20 == 3 and LRE20 == 0 and patE20 >= 55 and patE20 <= 56 and st3E20 == 3 
 and st1E20 == 32 and st2E20 == 0 and st3E20 == 3 and st4E20 == 2 then                                                     --Magician                             
X_pos_E20 = X_pos_E20-3 ; Y_pos_E20 = Y_pos_E20-16 ; WgtE20 = WgtE20+7 ; HgtE20 = HgtE20+22  
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx) 
elseif OIe20 == 255 and Ehp20 == 1 and LRE20 == 1 and patE20 == 57 and st3E20 == 1 then                                    --Knife                                        
X_pos_E20 = X_pos_E20-2 ; Y_pos_E20 = Y_pos_E20-16 ; WgtE20 = WgtE20 ; HgtE20 = HgtE20   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                            
elseif OIe20 == 255 and Ehp20 == 1 and LRE20 == 0 and patE20 == 57 and st3E20 == 1 then                                    --Knife                            
X_pos_E20 = X_pos_E20-2 ; Y_pos_E20 = Y_pos_E20-16 ; WgtE20 = WgtE20 ; HgtE20 = HgtE20   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx) 
elseif OIe20 == 255 and Ehp20 == 2 and LRE20 == 1 and patE20 == 57 and st3E20 == 3 then                                    --Chair                                       
X_pos_E20 = X_pos_E20-1 ; Y_pos_E20 = Y_pos_E20-14 ; WgtE20 = WgtE20+9 ; HgtE20 = HgtE20+20   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                            
elseif OIe20 == 255 and Ehp20 == 2 and LRE20 == 0 and patE20 == 57 and st3E20 == 3 then                                    --Chair                            
X_pos_E20 = X_pos_E20-2 ; Y_pos_E20 = Y_pos_E20-14 ; WgtE20 = WgtE20+9 ; HgtE20 = HgtE20+20   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 1 and patE20 == 57 and st3E20 == 4
  or OIe20 == 255 and Ehp20 == 3 and LRE20 == 1 and patE20 == 56 and st3E20 == 4 then                                      --falcon                                       
X_pos_E20 = X_pos_E20-1 ; Y_pos_E20 = Y_pos_E20-16 ; WgtE20 = WgtE20+24 ; HgtE20 = HgtE20+16   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                            
elseif OIe20 == 255 and Ehp20 == 3 and LRE20 == 0 and patE20 == 57 and st3E20 == 4 
  or OIe20 == 255 and Ehp20 == 3 and LRE20 == 0 and patE20 == 56 and st3E20 == 4 then                                      --falcon                             
X_pos_E20 = X_pos_E20-2 ; Y_pos_E20 = Y_pos_E20-16 ; WgtE20 = WgtE20+24 ; HgtE20 = HgtE20+16   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)
elseif OIe20 == 255 and Ehp20 == 2 and LRE20 == 1 and patE20 == 58 and st3E20 == 3 then                                    --Painting pictures                                       
X_pos_E20 = X_pos_E20-2 ; Y_pos_E20 = Y_pos_E20-15 ; WgtE20 = WgtE20+12 ; HgtE20 = HgtE20+19  
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                            
elseif OIe20 == 255 and Ehp20 == 2 and LRE20 == 0 and patE20 == 58 and st3E20 == 3 then                                    --Painting pictures                            
X_pos_E20 = X_pos_E20 ; Y_pos_E20 = Y_pos_E20-15 ; WgtE20 = WgtE20+12 ; HgtE20 = HgtE20+19   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx) 
elseif OIe20 == 255 and Ehp20 == 2 and LRE20 == 1 and patE20 == 58 and st3E20 == 4 then                                    --Table doomed                                        
X_pos_E20 = X_pos_E20-1 ; Y_pos_E20 = Y_pos_E20-15 ; WgtE20 = WgtE20+20 ; HgtE20 = HgtE20+12   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                            
elseif OIe20 == 255 and Ehp20 == 2 and LRE20 == 0 and patE20 == 58 and st3E20 == 4 then                                    --Table doomed                           
X_pos_E20 = X_pos_E20-2 ; Y_pos_E20 = Y_pos_E20-15 ; WgtE20 = WgtE20+20 ; HgtE20 = HgtE20+12   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx) 
elseif OIe20 == 255 and Ehp20 == 1 and LRE20 == 1 and patE20 == 58 and st3E20 == 2 then                                    --Candle                                      
X_pos_E20 = X_pos_E20-1 ; Y_pos_E20 = Y_pos_E20-16 ; WgtE20 = WgtE20+8 ; HgtE20 = HgtE20+4   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                            
elseif OIe20 == 255 and Ehp20 == 1 and LRE20 == 0 and patE20 == 58 and st3E20 == 2 then                                    --Candle                          
X_pos_E20 = X_pos_E20-2 ; Y_pos_E20 = Y_pos_E20-16 ; WgtE20 = WgtE20+8 ; HgtE20 = HgtE20+4   
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,redx)                      

end

if Ehp20 == 0 then                              -- stop hitbox enemy20
X_pos_E20 = X_pos_E20+1 ; Y_pos_E20 = Y_pos_E20-14       
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,NO20)
elseif Ehp20 > 0 and OIe20 == 0 then
gui.drawRectangle(X_pos_E20,Y_pos_E20,WgtE20,HgtE20,NO20)

end
end

local function Enemy21_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX21 = mainmemory.read_u8              --X coordinate
local YY21 = mainmemory.read_u8              --Y coordinate
local enemy21_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E21 = mainmemory.read_u8         --state1 
local stat2_E21 = mainmemory.read_u8         --state2 
local stat3_E21 = mainmemory.read_u8         --state3 
local stat4_E21 = mainmemory.read_u8         --state4 
local pat_E21 = mainmemory.read_u8           --pattern select
local pat_count_E21 = mainmemory.read_u8     --pattern start count
local RES_pat_E21 = mainmemory.read_u8       --result pattern
local LR_E21 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E21 = mainmemory.read_u8            --check if enemy21 is loaded 
local Scon = score_ONoff(0x00FD)
local Ehp21 = enemy21_hp(0x0DC1)
local st1E21 = stat1_E21(0x0DD8)
local st2E21 = stat2_E21(0x0DD9)
local st3E21 = stat3_E21(0x0DDA)
local st4E21 = stat4_E21(0x0DDB)
local patE21 = pat_E21(0x0DC7)
local PATcE21 = pat_count_E21(0x0DDF)
local RpatE21 = RES_pat_E21(0x0DDE)
local LRE21 = LR_E21(0x0DD0)
local OIe21 = OI_E21(0x0DC0)
local X_pos_E21 = XX21(0x0DC4)
local Y_pos_E21 = YY21(0x0DC2)
local WgtE21 = 10
local HgtE21 = 10
local hardblue = 0xFF0000FF
local NO21 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,NO21)

elseif OIe21 == 255 and Ehp21 == 1 and LRE21 == 1 and patE21 == 50 and st3E21 == 1 then                                        --Bat                                        
X_pos_E21 = X_pos_E21-1 ; Y_pos_E21 = Y_pos_E21-16 ; WgtE21 = WgtE21+8 ; HgtE21 = HgtE21+4   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                            
elseif OIe21 == 255 and Ehp21 == 1 and LRE21 == 0 and patE21 == 50 and st3E21 == 1 then                                    --Bat                             
X_pos_E21 = X_pos_E21-2 ; Y_pos_E21 = Y_pos_E21-16 ; WgtE21 = WgtE21+8 ; HgtE21 = HgtE21+4   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                                                   
elseif OIe21 == 255 and Ehp21 == 2 and LRE21 == 1 and st1E21 == 16 and st2E21 == 32 and st3E21 == 2 and st4E21 == 2 
  or OIe21 == 255 and Ehp21 == 2 and LRE21 == 1 and st1E21 == 16 and st2E21 == 0 and st3E21 == 2 and st4E21 == 2 then      --Dog                           
X_pos_E21 = X_pos_E21+1 ; Y_pos_E21 = Y_pos_E21-17 ; WgtE21 = WgtE21+20 ; HgtE21 = HgtE21+7  
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                                  
elseif OIe21 == 255 and Ehp21 == 2 and LRE21 == 0 and st1E21 == 16 and st2E21 == 32 and st3E21 == 2 and st4E21 == 2 
  or OIe21 == 255 and Ehp21 == 2 and LRE21 == 0 and st1E21 == 16 and st2E21 == 0 and st3E21 == 2 and st4E21 == 2 then      --Dog                             
X_pos_E21 = X_pos_E21+1 ; Y_pos_E21 = Y_pos_E21-17 ; WgtE21 = WgtE21+20 ; HgtE21 = HgtE21+7  
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                                  
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 1 and st1E21 == 16 and st2E21 == 32 and st3E21 == 3 and st4E21 == 3 then   --super dog       
X_pos_E21 = X_pos_E21 ; Y_pos_E21 = Y_pos_E21-17 ; WgtE21 = WgtE21+20 ; HgtE21 = HgtE21+7  
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 0 and st1E21 == 16 and st2E21 == 32 and st3E21 == 3 and st4E21 == 3 then   --super dog       
X_pos_E21 = X_pos_E21 ; Y_pos_E21 = Y_pos_E21-17 ; WgtE21 = WgtE21+20 ; HgtE21 = HgtE21+7  
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)
elseif OIe21 == 255 and Ehp21 == 2 and LRE21 == 1 and patE21 >= 52 and st3E21 == 2 then                                    --ghost girl                             
X_pos_E21 = X_pos_E21-4 ; Y_pos_E21 = Y_pos_E21-17 ; WgtE21 = WgtE21+12 ; HgtE21 = HgtE21+23  
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                                  
elseif OIe21 == 255 and Ehp21 == 2 and LRE21 == 0 and patE21 == 52 and st3E21 == 2 then                                    --ghost girl             
X_pos_E21 = X_pos_E21-3 ; Y_pos_E21 = Y_pos_E21-17 ; WgtE21 = WgtE21+12 ; HgtE21 = HgtE21+23  
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 1 and patE21 >= 52  
and st1E21 == 32 and st2E21 == 16 and st3E21 == 3 and st4E21 == 3 then                                                     --Super ghost girl                             
X_pos_E21 = X_pos_E21-4 ; Y_pos_E21 = Y_pos_E21-17 ; WgtE21 = WgtE21+12 ; HgtE21 = HgtE21+23  
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                                 
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 0 and patE21 == 52 
and st1E21 == 32 and st2E21 == 16 and st3E21 == 3 and st4E21 == 3 then                                                     --Super ghost girl             
X_pos_E21 = X_pos_E21-3 ; Y_pos_E21 = Y_pos_E21-17 ; WgtE21 = WgtE21+12 ; HgtE21 = HgtE21+23  
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                    
elseif OIe21 == 255 and Ehp21 >= 2 and LRE21 == 1 and patE21 == 53 and st3E21 >= 3 then                                    --Goblin , super goblin                            
X_pos_E21 = X_pos_E21-4 ; Y_pos_E21 = Y_pos_E21-17 ; WgtE21 = WgtE21+10 ; HgtE21 = HgtE21+23  
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                                  
elseif OIe21 == 255 and Ehp21 >= 2 and LRE21 == 0 and patE21 == 53 and st3E21 >= 3 then                                    --Goblin , super goblin            
X_pos_E21 = X_pos_E21 ; Y_pos_E21 = Y_pos_E21-17 ; WgtE21 = WgtE21+10 ; HgtE21 = HgtE21+23  
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                     
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 1 and patE21 <= 52 and st3E21 == 3 
and st1E21 == 40 and st2E21 == 16 and st3E21 == 3 and st4E21 == 2 
  or OIe21 == 255 and Ehp21 == 3 and LRE21 == 1 and patE21 <= 52 and st3E21 == 3 
and st1E21 == 40 and st2E21 == 0 and st3E21 == 3 and st4E21 == 2 then                                                      --Strange man                               
X_pos_E21 = X_pos_E21 ; Y_pos_E21 = Y_pos_E21-16 ; WgtE21 = WgtE21+7 ; HgtE21 = HgtE21+30 
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                            
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 0 and patE21 == 51 and st3E21 == 3
and st1E21 == 40 and st2E21 == 16 and st3E21 == 3 and st4E21 == 2 
  or OIe21 == 255 and Ehp21 == 3 and LRE21 == 0 and patE21 <= 52 and st3E21 == 3 
and st1E21 == 40 and st2E21 == 0 and st3E21 == 3 and st4E21 == 2 then                                                      --Strange man                            
X_pos_E21 = X_pos_E21-1 ; Y_pos_E21 = Y_pos_E21-16 ; WgtE21 = WgtE21+7 ; HgtE21 = HgtE21+30 
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                           
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 1 and patE21 == 55 and st3E21 == 4 then                                    --Skeleton                              
X_pos_E21 = X_pos_E21-8 ; Y_pos_E21 = Y_pos_E21-17 ; WgtE21 = WgtE21+15 ; HgtE21 = HgtE21+30 
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                            
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 0 and patE21 == 55 and st3E21 == 4 then                                    --Skeleton                              
X_pos_E21 = X_pos_E21-1 ; Y_pos_E21 = Y_pos_E21-17 ; WgtE21 = WgtE21+15 ; HgtE21 = HgtE21+30 
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 1 and patE21 == 54 and st3E21 == 3 then                                    --Wax dolls                           
X_pos_E21 = X_pos_E21-2 ; Y_pos_E21 = Y_pos_E21-14 ; WgtE21 = WgtE21+11 ; HgtE21 = HgtE21+28 
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                            
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 0 and patE21 == 54 and st3E21 == 3 then                                    --Wax dolls                           
X_pos_E21 = X_pos_E21-2 ; Y_pos_E21 = Y_pos_E21-14 ; WgtE21 = WgtE21+11 ; HgtE21 = HgtE21+28 
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 1 and patE21 >= 55 and patE21 <= 56 and st3E21 == 3 
 and st1E21 == 32 and st2E21 == 16 and st3E21 == 3 and st4E21 == 2 
 or OIe21 == 255 and Ehp21 == 3 and LRE21 == 1 and patE21 >= 55 and patE21 <= 56 and st3E21 == 3 
 and st1E21 == 32 and st2E21 == 0 and st3E21 == 3 and st4E21 == 2 then                                                     --Magician                                       
X_pos_E21 = X_pos_E21-1 ; Y_pos_E21 = Y_pos_E21-16 ; WgtE21 = WgtE21+7 ; HgtE21 = HgtE21+22   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                            
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 0 and patE21 >= 55 and patE21 <= 56 and st3E21 == 3 
 and st1E21 == 32 and st2E21 == 16 and st3E21 == 3 and st4E21 == 2 
  or OIe21 == 255 and Ehp21 == 3 and LRE21 == 0 and patE21 >= 55 and patE21 <= 56 and st3E21 == 3 
 and st1E21 == 32 and st2E21 == 0 and st3E21 == 3 and st4E21 == 2 then                                                     --Magician                             
X_pos_E21 = X_pos_E21-3 ; Y_pos_E21 = Y_pos_E21-16 ; WgtE21 = WgtE21+7 ; HgtE21 = HgtE21+22  
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue) 
elseif OIe21 == 255 and Ehp21 == 1 and LRE21 == 1 and patE21 == 57 and st3E21 == 1 then                                    --Knife                                        
X_pos_E21 = X_pos_E21-2 ; Y_pos_E21 = Y_pos_E21-16 ; WgtE21 = WgtE21 ; HgtE21 = HgtE21   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                            
elseif OIe21 == 255 and Ehp21 == 1 and LRE21 == 0 and patE21 == 57 and st3E21 == 1 then                                    --Knife                            
X_pos_E21 = X_pos_E21-2 ; Y_pos_E21 = Y_pos_E21-16 ; WgtE21 = WgtE21 ; HgtE21 = HgtE21   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue) 
elseif OIe21 == 255 and Ehp21 == 2 and LRE21 == 1 and patE21 == 57 and st3E21 == 3 then                                    --Chair                                       
X_pos_E21 = X_pos_E21-1 ; Y_pos_E21 = Y_pos_E21-14 ; WgtE21 = WgtE21+9 ; HgtE21 = HgtE21+20   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                            
elseif OIe21 == 255 and Ehp21 == 2 and LRE21 == 0 and patE21 == 57 and st3E21 == 3 then                                    --Chair                            
X_pos_E21 = X_pos_E21-2 ; Y_pos_E21 = Y_pos_E21-14 ; WgtE21 = WgtE21+9 ; HgtE21 = HgtE21+20   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 1 and patE21 == 57 and st3E21 == 4
  or OIe21 == 255 and Ehp21 == 3 and LRE21 == 1 and patE21 == 56 and st3E21 == 4 then                                      --falcon                                       
X_pos_E21 = X_pos_E21-1 ; Y_pos_E21 = Y_pos_E21-16 ; WgtE21 = WgtE21+24 ; HgtE21 = HgtE21+16   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                            
elseif OIe21 == 255 and Ehp21 == 3 and LRE21 == 0 and patE21 == 57 and st3E21 == 4 
  or OIe21 == 255 and Ehp21 == 3 and LRE21 == 0 and patE21 == 56 and st3E21 == 4 then                                      --falcon                             
X_pos_E21 = X_pos_E21-2 ; Y_pos_E21 = Y_pos_E21-16 ; WgtE21 = WgtE21+24 ; HgtE21 = HgtE21+16   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)
elseif OIe21 == 255 and Ehp21 == 2 and LRE21 == 1 and patE21 == 58 and st3E21 == 3 then                                    --Painting pictures                                       
X_pos_E21 = X_pos_E21-2 ; Y_pos_E21 = Y_pos_E21-15 ; WgtE21 = WgtE21+12 ; HgtE21 = HgtE21+19  
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                            
elseif OIe21 == 255 and Ehp21 == 2 and LRE21 == 0 and patE21 == 58 and st3E21 == 3 then                                    --Painting pictures                            
X_pos_E21 = X_pos_E21 ; Y_pos_E21 = Y_pos_E21-15 ; WgtE21 = WgtE21+12 ; HgtE21 = HgtE21+19   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue) 
elseif OIe21 == 255 and Ehp21 == 2 and LRE21 == 1 and patE21 == 58 and st3E21 == 4 then                                    --Table doomed                                        
X_pos_E21 = X_pos_E21-1 ; Y_pos_E21 = Y_pos_E21-15 ; WgtE21 = WgtE21+20 ; HgtE21 = HgtE21+12   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                            
elseif OIe21 == 255 and Ehp21 == 2 and LRE21 == 0 and patE21 == 58 and st3E21 == 4 then                                    --Table doomed                           
X_pos_E21 = X_pos_E21-2 ; Y_pos_E21 = Y_pos_E21-15 ; WgtE21 = WgtE21+20 ; HgtE21 = HgtE21+12   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue) 
elseif OIe21 == 255 and Ehp21 == 1 and LRE21 == 1 and patE21 == 58 and st3E21 == 2 then                                    --Candle                                      
X_pos_E21 = X_pos_E21-1 ; Y_pos_E21 = Y_pos_E21-16 ; WgtE21 = WgtE21+8 ; HgtE21 = HgtE21+4   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                            
elseif OIe21 == 255 and Ehp21 == 1 and LRE21 == 0 and patE21 == 58 and st3E21 == 2 then                                    --Candle                          
X_pos_E21 = X_pos_E21-2 ; Y_pos_E21 = Y_pos_E21-16 ; WgtE21 = WgtE21+8 ; HgtE21 = HgtE21+4   
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,hardblue)                      

end

if Ehp21 == 0 then                              -- stop hitbox enemy21
X_pos_E21 = X_pos_E21+1 ; Y_pos_E21 = Y_pos_E21-14       
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,NO21)
elseif Ehp21 > 0 and OIe21 == 0 then
gui.drawRectangle(X_pos_E21,Y_pos_E21,WgtE21,HgtE21,NO21)

end
end

local function Enemy22_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX22 = mainmemory.read_u8              --X coordinate
local YY22 = mainmemory.read_u8              --Y coordinate
local enemy22_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E22 = mainmemory.read_u8         --state1 
local stat2_E22 = mainmemory.read_u8         --state2 
local stat3_E22 = mainmemory.read_u8         --state3 
local stat4_E22 = mainmemory.read_u8         --state4 
local pat_E22 = mainmemory.read_u8           --pattern select
local pat_count_E22 = mainmemory.read_u8     --pattern start count
local RES_pat_E22 = mainmemory.read_u8       --result pattern
local LR_E22 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E22 = mainmemory.read_u8            --check if enemy22 is loaded
local Scon = score_ONoff(0x00FD)
local Ehp22 = enemy22_hp(0x0DE1)
local st1E22 = stat1_E22(0x0DF8)
local st2E22 = stat2_E22(0x0DF9)
local st3E22 = stat3_E22(0x0DFA)
local st4E22 = stat4_E22(0x0DFB)
local patE22 = pat_E22(0x0DE7)
local PATcE22 = pat_count_E22(0x0DFF)
local RpatE22 = RES_pat_E22(0x0DFE)
local LRE22 = LR_E22(0x0DF0)
local OIe22 = OI_E22(0x0DE0)
local X_pos_E22 = XX22(0x0DE4)
local Y_pos_E22 = YY22(0x0DE2)
local WgtE22 = 10
local HgtE22 = 10
local greenlight = 0xFFCCFFCC
local NO22 = 0x00FFFFFF

if Scon > 16 then
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,NO22)

elseif OIe22 == 255 and Ehp22 == 1 and LRE22 == 1 and patE22 == 50 and st3E22 == 1 then                                       --Bat                                        
X_pos_E22 = X_pos_E22-1 ; Y_pos_E22 = Y_pos_E22-16 ; WgtE22 = WgtE22+8 ; HgtE22 = HgtE22+4   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                            
elseif OIe22 == 255 and Ehp22 == 1 and LRE22 == 0 and patE22 == 50 and st3E22 == 1 then                                   --Bat                             
X_pos_E22 = X_pos_E22-2 ; Y_pos_E22 = Y_pos_E22-16 ; WgtE22 = WgtE22+8 ; HgtE22 = HgtE22+4   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                                                   
elseif OIe22 == 255 and Ehp22 == 2 and LRE22 == 1 and st1E22 == 16 and st2E22 == 32 and st3E22 == 2 and st4E22 == 2 
  or OIe22 == 255 and Ehp22 == 2 and LRE22 == 1 and st1E22 == 16 and st2E22 == 0 and st3E22 == 2 and st4E22 == 2 then     --Dog                           
X_pos_E22 = X_pos_E22+1 ; Y_pos_E22 = Y_pos_E22-17 ; WgtE22 = WgtE22+20 ; HgtE22 = HgtE22+7  
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                                  
elseif OIe22 == 255 and Ehp22 == 2 and LRE22 == 0 and st1E22 == 16 and st2E22 == 32 and st3E22 == 2 and st4E22 == 2 
  or OIe22 == 255 and Ehp22 == 2 and LRE22 == 0 and st1E22 == 16 and st2E22 == 0 and st3E22 == 2 and st4E22 == 2 then      --Dog                             
X_pos_E22 = X_pos_E22+1 ; Y_pos_E22 = Y_pos_E22-17 ; WgtE22 = WgtE22+20 ; HgtE22 = HgtE22+7  
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                                  
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 1 and st1E22 == 16 and st2E22 == 32 and st3E22 == 3 and st4E22 == 3 then   --super dog       
X_pos_E22 = X_pos_E22 ; Y_pos_E22 = Y_pos_E22-17 ; WgtE22 = WgtE22+20 ; HgtE22 = HgtE22+7  
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 0 and st1E22 == 16 and st2E22 == 32 and st3E22 == 3 and st4E22 == 3 then   --super dog       
X_pos_E22 = X_pos_E22 ; Y_pos_E22 = Y_pos_E22-17 ; WgtE22 = WgtE22+20 ; HgtE22 = HgtE22+7  
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)
elseif OIe22 == 255 and Ehp22 == 2 and LRE22 == 1 and patE22 >= 52 and st3E22 == 2 then                                    --ghost girl                             
X_pos_E22 = X_pos_E22-4 ; Y_pos_E22 = Y_pos_E22-17 ; WgtE22 = WgtE22+12 ; HgtE22 = HgtE22+23  
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                                  
elseif OIe22 == 255 and Ehp22 == 2 and LRE22 == 0 and patE22 == 52 and st3E22 == 2 then                                    --ghost girl             
X_pos_E22 = X_pos_E22-3 ; Y_pos_E22 = Y_pos_E22-17 ; WgtE22 = WgtE22+12 ; HgtE22 = HgtE22+23  
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 1 and patE22 >= 52  
and st1E22 == 32 and st2E22 == 16 and st3E22 == 3 and st4E22 == 3 then                                                     --Super ghost girl                             
X_pos_E22 = X_pos_E22-4 ; Y_pos_E22 = Y_pos_E22-17 ; WgtE22 = WgtE22+12 ; HgtE22 = HgtE22+23  
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                                 
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 0 and patE22 == 52 
and st1E22 == 32 and st2E22 == 16 and st3E22 == 3 and st4E22 == 3 then                                                     --Super ghost girl             
X_pos_E22 = X_pos_E22-3 ; Y_pos_E22 = Y_pos_E22-17 ; WgtE22 = WgtE22+12 ; HgtE22 = HgtE22+23  
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                    
elseif OIe22 == 255 and Ehp22 >= 2 and LRE22 == 1 and patE22 == 53 and st3E22 >= 3 then                                    --Goblin , super goblin                            
X_pos_E22 = X_pos_E22-4 ; Y_pos_E22 = Y_pos_E22-17 ; WgtE22 = WgtE22+10 ; HgtE22 = HgtE22+23  
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                                  
elseif OIe22 == 255 and Ehp22 >= 2 and LRE22 == 0 and patE22 == 53 and st3E22 >= 3 then                                    --Goblin , super goblin            
X_pos_E22 = X_pos_E22 ; Y_pos_E22 = Y_pos_E22-17 ; WgtE22 = WgtE22+10 ; HgtE22 = HgtE22+23  
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                     
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 1 and patE22 <= 52 and st3E22 == 3 
and st1E22 == 40 and st2E22 == 16 and st3E22 == 3 and st4E22 == 2 
  or OIe22 == 255 and Ehp22 == 3 and LRE22 == 1 and patE22 <= 52 and st3E22 == 3 
and st1E22 == 40 and st2E22 == 0 and st3E22 == 3 and st4E22 == 2 then                                                      --Strange man                               
X_pos_E22 = X_pos_E22 ; Y_pos_E22 = Y_pos_E22-16 ; WgtE22 = WgtE22+7 ; HgtE22 = HgtE22+30 
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                            
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 0 and patE22 == 51 and st3E22 == 3 
and st1E22 == 40 and st2E22 == 16 and st3E22 == 3 and st4E22 == 2 
  or OIe22 == 255 and Ehp22 == 3 and LRE22 == 0 and patE22 <= 52 and st3E22 == 3 
and st1E22 == 40 and st2E22 == 0 and st3E22 == 3 and st4E22 == 2 then                                                      --Strange man                            
X_pos_E22 = X_pos_E22-1 ; Y_pos_E22 = Y_pos_E22-16 ; WgtE22 = WgtE22+7 ; HgtE22 = HgtE22+30 
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                           
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 1 and patE22 == 55 and st3E22 == 4 then                                    --Skeleton                              
X_pos_E22 = X_pos_E22-8 ; Y_pos_E22 = Y_pos_E22-17 ; WgtE22 = WgtE22+15 ; HgtE22 = HgtE22+30 
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                            
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 0 and patE22 == 55 and st3E22 == 4 then                                    --Skeleton                              
X_pos_E22 = X_pos_E22-1 ; Y_pos_E22 = Y_pos_E22-17 ; WgtE22 = WgtE22+15 ; HgtE22 = HgtE22+30 
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 1 and patE22 == 54 and st3E22 == 3 then                                    --Wax dolls                           
X_pos_E22 = X_pos_E22-2 ; Y_pos_E22 = Y_pos_E22-14 ; WgtE22 = WgtE22+11 ; HgtE22 = HgtE22+28 
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                            
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 0 and patE22 == 54 and st3E22 == 3 then                                    --Wax dolls                           
X_pos_E22 = X_pos_E22-2 ; Y_pos_E22 = Y_pos_E22-14 ; WgtE22 = WgtE22+11 ; HgtE22 = HgtE22+28 
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 1 and patE22 >= 55 and patE22 <= 56 and st3E22 == 3 
 and st1E22 == 32 and st2E22 == 16 and st3E22 == 3 and st4E22 == 2 
  or OIe22 == 255 and Ehp22 == 3 and LRE22 == 1 and patE22 >= 55 and patE22 <= 56 and st3E22 == 3 
 and st1E22 == 32 and st2E22 == 0 and st3E22 == 3 and st4E22 == 2 then                                                     --Magician                                       
X_pos_E22 = X_pos_E22-1 ; Y_pos_E22 = Y_pos_E22-16 ; WgtE22 = WgtE22+7 ; HgtE22 = HgtE22+22   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                            
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 0 and patE22 >= 55 and patE22 <= 56 and st3E22 == 3 
 and st1E22 == 32 and st2E22 == 16 and st3E22 == 3 and st4E22 == 2 
  or OIe22 == 255 and Ehp22 == 3 and LRE22 == 0 and patE22 >= 55 and patE22 <= 56 and st3E22 == 3 
 and st1E22 == 32 and st2E22 == 0 and st3E22 == 3 and st4E22 == 2 then                                                     --Magician                             
X_pos_E22 = X_pos_E22-3 ; Y_pos_E22 = Y_pos_E22-16 ; WgtE22 = WgtE22+7 ; HgtE22 = HgtE22+22  
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight) 
elseif OIe22 == 255 and Ehp22 == 1 and LRE22 == 1 and patE22 == 57 and st3E22 == 1 then                                    --Knife                                        
X_pos_E22 = X_pos_E22-2 ; Y_pos_E22 = Y_pos_E22-16 ; WgtE22 = WgtE22 ; HgtE22 = HgtE22   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                            
elseif OIe22 == 255 and Ehp22 == 1 and LRE22 == 0 and patE22 == 57 and st3E22 == 1 then                                    --Knife                            
X_pos_E22 = X_pos_E22-2 ; Y_pos_E22 = Y_pos_E22-16 ; WgtE22 = WgtE22 ; HgtE22 = HgtE22   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight) 
elseif OIe22 == 255 and Ehp22 == 2 and LRE22 == 1 and patE22 == 57 and st3E22 == 3 then                                    --Chair                                       
X_pos_E22 = X_pos_E22-1 ; Y_pos_E22 = Y_pos_E22-14 ; WgtE22 = WgtE22+9 ; HgtE22 = HgtE22+20   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                            
elseif OIe22 == 255 and Ehp22 == 2 and LRE22 == 0 and patE22 == 57 and st3E22 == 3 then                                    --Chair                            
X_pos_E22 = X_pos_E22-2 ; Y_pos_E22 = Y_pos_E22-14 ; WgtE22 = WgtE22+9 ; HgtE22 = HgtE22+20   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 1 and patE22 == 57 and st3E22 == 4
  or OIe22 == 255 and Ehp22 == 3 and LRE22 == 1 and patE22 == 56 and st3E22 == 4 then                                      --falcon                                       
X_pos_E22 = X_pos_E22-1 ; Y_pos_E22 = Y_pos_E22-16 ; WgtE22 = WgtE22+24 ; HgtE22 = HgtE22+16   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                            
elseif OIe22 == 255 and Ehp22 == 3 and LRE22 == 0 and patE22 == 57 and st3E22 == 4 
  or OIe22 == 255 and Ehp22 == 3 and LRE22 == 0 and patE22 == 56 and st3E22 == 4 then                                      --falcon                             
X_pos_E22 = X_pos_E22-2 ; Y_pos_E22 = Y_pos_E22-16 ; WgtE22 = WgtE22+24 ; HgtE22 = HgtE22+16   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)
elseif OIe22 == 255 and Ehp22 == 2 and LRE22 == 1 and patE22 == 58 and st3E22 == 3 then                                    --Painting pictures                        
X_pos_E22 = X_pos_E22-2 ; Y_pos_E22 = Y_pos_E22-15 ; WgtE22 = WgtE22+12 ; HgtE22 = HgtE22+19  
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                            
elseif OIe22 == 255 and Ehp22 == 2 and LRE22 == 0 and patE22 == 58 and st3E22 == 3 then                                    --Painting pictures                            
X_pos_E22 = X_pos_E22 ; Y_pos_E22 = Y_pos_E22-15 ; WgtE22 = WgtE22+12 ; HgtE22 = HgtE22+19   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight) 
elseif OIe22 == 255 and Ehp22 == 2 and LRE22 == 1 and patE22 == 58 and st3E22 == 4 then                                    --Table doomed                                        
X_pos_E22 = X_pos_E22-1 ; Y_pos_E22 = Y_pos_E22-15 ; WgtE22 = WgtE22+20 ; HgtE22 = HgtE22+12   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                            
elseif OIe22 == 255 and Ehp22 == 2 and LRE22 == 0 and patE22 == 58 and st3E22 == 4 then                                    --Table doomed                           
X_pos_E22 = X_pos_E22-2 ; Y_pos_E22 = Y_pos_E22-15 ; WgtE22 = WgtE22+20 ; HgtE22 = HgtE22+12   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight) 
elseif OIe22 == 255 and Ehp22 == 1 and LRE22 == 1 and patE22 == 58 and st3E22 == 2 then                                    --Candle                                      
X_pos_E22 = X_pos_E22-1 ; Y_pos_E22 = Y_pos_E22-16 ; WgtE22 = WgtE22+8 ; HgtE22 = HgtE22+4   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                            
elseif OIe22 == 255 and Ehp22 == 1 and LRE22 == 0 and patE22 == 58 and st3E22 == 2 then                                    --Candle                          
X_pos_E22 = X_pos_E22-2 ; Y_pos_E22 = Y_pos_E22-16 ; WgtE22 = WgtE22+8 ; HgtE22 = HgtE22+4   
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,greenlight)                      

end

if Ehp22 == 0 then                              -- stop hitbox enemy22
X_pos_E22 = X_pos_E22+1 ; Y_pos_E22 = Y_pos_E22-14       
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,NO22)
elseif Ehp22 > 0 and OIe22 == 0 then
gui.drawRectangle(X_pos_E22,Y_pos_E22,WgtE22,HgtE22,NO22)

end
end

local function Enemy23_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX23 = mainmemory.read_u8              --X coordinate
local YY23 = mainmemory.read_u8              --Y coordinate
local enemy23_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E23 = mainmemory.read_u8         --state1 
local stat2_E23 = mainmemory.read_u8         --state2 
local stat3_E23 = mainmemory.read_u8         --state3 
local stat4_E23 = mainmemory.read_u8         --state4 
local pat_E23 = mainmemory.read_u8           --pattern select
local pat_count_E23 = mainmemory.read_u8     --pattern start count
local RES_pat_E23 = mainmemory.read_u8       --result pattern
local LR_E23 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E23 = mainmemory.read_u8            --check if enemy23 is loaded
local Scon = score_ONoff(0x00FD)
local Ehp23 = enemy23_hp(0x0E01)
local st1E23 = stat1_E23(0x0E18)
local st2E23 = stat2_E23(0x0E19)
local st3E23 = stat3_E23(0x0E1A)
local st4E23 = stat4_E23(0x0E1B)
local patE23 = pat_E23(0x0E07)
local PATcE23 = pat_count_E23(0x0E1F)
local RpatE23 = RES_pat_E23(0x0E1E)
local LRE23 = LR_E23(0x0E10)
local OIe23 = OI_E23(0x0E00)
local X_pos_E23 = XX23(0x0E04)
local Y_pos_E23 = YY23(0x0E02)
local WgtE23 = 10
local HgtE23 = 10
local purpurea = 0xFF990099
local NO23 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,NO23)

elseif OIe23 == 255 and Ehp23 == 1 and LRE23 == 1 and patE23 == 50 and st3E23 == 1 then                                        --Bat                                        
X_pos_E23 = X_pos_E23-1 ; Y_pos_E23 = Y_pos_E23-16 ; WgtE23 = WgtE23+8 ; HgtE23 = HgtE23+4   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                            
elseif OIe23 == 255 and Ehp23 == 1 and LRE23 == 0 and patE23 == 50 and st3E23 == 1 then                                    --Bat                             
X_pos_E23 = X_pos_E23-2 ; Y_pos_E23 = Y_pos_E23-16 ; WgtE23 = WgtE23+8 ; HgtE23 = HgtE23+4   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                                                   
elseif OIe23 == 255 and Ehp23 == 2 and LRE23 == 1 and st1E23 == 16 and st2E23 == 32 and st3E23 == 2 and st4E23 == 2 
  or OIe23 == 255 and Ehp23 == 2 and LRE23 == 1 and st1E23 == 16 and st2E23 == 0 and st3E23 == 2 and st4E23 == 2 then      --Dog                           
X_pos_E23 = X_pos_E23+1 ; Y_pos_E23 = Y_pos_E23-17 ; WgtE23 = WgtE23+20 ; HgtE23 = HgtE23+7  
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                                  
elseif OIe23 == 255 and Ehp23 == 2 and LRE23 == 0 and st1E23 == 16 and st2E23 == 32 and st3E23 == 2 and st4E23 == 2 
  or OIe23 == 255 and Ehp23 == 2 and LRE23 == 0 and st1E23 == 16 and st2E23 == 0 and st3E23 == 2 and st4E23 == 2 then      --Dog                             
X_pos_E23 = X_pos_E23+1 ; Y_pos_E23 = Y_pos_E23-17 ; WgtE23 = WgtE23+20 ; HgtE23 = HgtE23+7  
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                                  
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 1 and st1E23 == 16 and st2E23 == 32 and st3E23 == 3 and st4E23 == 3 then   --super dog       
X_pos_E23 = X_pos_E23 ; Y_pos_E23 = Y_pos_E23-17 ; WgtE23 = WgtE23+20 ; HgtE23 = HgtE23+7  
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 0 and st1E23 == 16 and st2E23 == 32 and st3E23 == 3 and st4E23 == 3 then   --super dog       
X_pos_E23 = X_pos_E23 ; Y_pos_E23 = Y_pos_E23-17 ; WgtE23 = WgtE23+20 ; HgtE23 = HgtE23+7  
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)
elseif OIe23 == 255 and Ehp23 == 2 and LRE23 == 1 and patE23 >= 52 and st3E23 == 2 then                                    --ghost girl                             
X_pos_E23 = X_pos_E23-4 ; Y_pos_E23 = Y_pos_E23-17 ; WgtE23 = WgtE23+12 ; HgtE23 = HgtE23+23  
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                                  
elseif OIe23 == 255 and Ehp23 == 2 and LRE23 == 0 and patE23 == 52 and st3E23 == 2 then                                    --ghost girl             
X_pos_E23 = X_pos_E23-3 ; Y_pos_E23 = Y_pos_E23-17 ; WgtE23 = WgtE23+12 ; HgtE23 = HgtE23+23  
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 1 and patE23 >= 52  
and st1E23 == 32 and st2E23 == 16 and st3E23 == 3 and st4E23 == 3 then                                                     --Super ghost girl                             
X_pos_E23 = X_pos_E23-4 ; Y_pos_E23 = Y_pos_E23-17 ; WgtE23 = WgtE23+12 ; HgtE23 = HgtE23+23  
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                                 
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 0 and patE23 == 52 
and st1E23 == 32 and st2E23 == 16 and st3E23 == 3 and st4E23 == 3 then                                                     --Super ghost girl             
X_pos_E23 = X_pos_E23-3 ; Y_pos_E23 = Y_pos_E23-17 ; WgtE23 = WgtE23+12 ; HgtE23 = HgtE23+23  
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                    
elseif OIe23 == 255 and Ehp23 >= 2 and LRE23 == 1 and patE23 == 53 and st3E23 >= 3 then                                    --Goblin , super goblin                            
X_pos_E23 = X_pos_E23-4 ; Y_pos_E23 = Y_pos_E23-17 ; WgtE23 = WgtE23+10 ; HgtE23 = HgtE23+23  
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                                  
elseif OIe23 == 255 and Ehp23 >= 2 and LRE23 == 0 and patE23 == 53 and st3E23 >= 3 then                                    --Goblin , super goblin            
X_pos_E23 = X_pos_E23 ; Y_pos_E23 = Y_pos_E23-17 ; WgtE23 = WgtE23+10 ; HgtE23 = HgtE23+23  
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                     
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 1 and patE23 <= 52 and st3E23 == 3 
and st1E23 == 40 and st2E23 == 16 and st3E23 == 3 and st4E23 == 2 
  or OIe23 == 255 and Ehp23 == 3 and LRE23 == 1 and patE23 <= 52 and st3E23 == 3 
and st1E23 == 40 and st2E23 == 0 and st3E23 == 3 and st4E23 == 2 then                                                      --Strange man                               
X_pos_E23 = X_pos_E23 ; Y_pos_E23 = Y_pos_E23-16 ; WgtE23 = WgtE23+7 ; HgtE23 = HgtE23+30 
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                            
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 0 and patE23 == 51 and st3E23 == 3 
and st1E23 == 40 and st2E23 == 16 and st3E23 == 3 and st4E23 == 2 
  or OIe23 == 255 and Ehp23 == 3 and LRE23 == 0 and patE23 <= 52 and st3E23 == 3 
and st1E23 == 40 and st2E23 == 0 and st3E23 == 3 and st4E23 == 2 then                                                      --Strange man                            
X_pos_E23 = X_pos_E23-1 ; Y_pos_E23 = Y_pos_E23-16 ; WgtE23 = WgtE23+7 ; HgtE23 = HgtE23+30 
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                           
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 1 and patE23 == 55 and st3E23 == 4 then                                    --Skeleton                              
X_pos_E23 = X_pos_E23-8 ; Y_pos_E23 = Y_pos_E23-17 ; WgtE23 = WgtE23+15 ; HgtE23 = HgtE23+30 
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                            
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 0 and patE23 == 55 and st3E23 == 4 then                                    --Skeleton                              
X_pos_E23 = X_pos_E23-1 ; Y_pos_E23 = Y_pos_E23-17 ; WgtE23 = WgtE23+15 ; HgtE23 = HgtE23+30 
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 1 and patE23 == 54 and st3E23 == 3 then                                    --Wax dolls                           
X_pos_E23 = X_pos_E23-2 ; Y_pos_E23 = Y_pos_E23-14 ; WgtE23 = WgtE23+11 ; HgtE23 = HgtE23+28 
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                            
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 0 and patE23 == 54 and st3E23 == 3 then                                    --Wax dolls                           
X_pos_E23 = X_pos_E23-2 ; Y_pos_E23 = Y_pos_E23-14 ; WgtE23 = WgtE23+11 ; HgtE23 = HgtE23+28 
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 1 and patE23 >= 55 and patE23 <= 56 and st3E23 == 3 
 and st1E23 == 32 and st2E23 == 16 and st3E23 == 3 and st4E23 == 2 
  or OIe23 == 255 and Ehp23 == 3 and LRE23 == 1 and patE23 >= 55 and patE23 <= 56 and st3E23 == 3 
 and st1E23 == 32 and st2E23 == 0 and st3E23 == 3 and st4E23 == 2 then                                                     --Magician                                       
X_pos_E23 = X_pos_E23-1 ; Y_pos_E23 = Y_pos_E23-16 ; WgtE23 = WgtE23+7 ; HgtE23 = HgtE23+22   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                            
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 0 and patE23 >= 55 and patE23 <= 56 and st3E23 == 3 
 and st1E23 == 32 and st2E23 == 16 and st3E23 == 3 and st4E23 == 2 
  or OIe23 == 255 and Ehp23 == 3 and LRE23 == 0 and patE23 >= 55 and patE23 <= 56 and st3E23 == 3 
 and st1E23 == 32 and st2E23 == 0 and st3E23 == 3 and st4E23 == 2 then                                                     --Magician                             
X_pos_E23 = X_pos_E23-3 ; Y_pos_E23 = Y_pos_E23-16 ; WgtE23 = WgtE23+7 ; HgtE23 = HgtE23+22  
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea) 
elseif OIe23 == 255 and Ehp23 == 1 and LRE23 == 1 and patE23 == 57 and st3E23 == 1 then                                    --Knife                                        
X_pos_E23 = X_pos_E23-2 ; Y_pos_E23 = Y_pos_E23-16 ; WgtE23 = WgtE23 ; HgtE23 = HgtE23   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                            
elseif OIe23 == 255 and Ehp23 == 1 and LRE23 == 0 and patE23 == 57 and st3E23 == 1 then                                    --Knife                            
X_pos_E23 = X_pos_E23-2 ; Y_pos_E23 = Y_pos_E23-16 ; WgtE23 = WgtE23 ; HgtE23 = HgtE23   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea) 
elseif OIe23 == 255 and Ehp23 == 2 and LRE23 == 1 and patE23 == 57 and st3E23 == 3 then                                    --Chair                                       
X_pos_E23 = X_pos_E23-1 ; Y_pos_E23 = Y_pos_E23-14 ; WgtE23 = WgtE23+9 ; HgtE23 = HgtE23+20   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                            
elseif OIe23 == 255 and Ehp23 == 2 and LRE23 == 0 and patE23 == 57 and st3E23 == 3 then                                    --Chair                            
X_pos_E23 = X_pos_E23-2 ; Y_pos_E23 = Y_pos_E23-14 ; WgtE23 = WgtE23+9 ; HgtE23 = HgtE23+20   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 1 and patE23 == 57 and st3E23 == 4
  or OIe23 == 255 and Ehp23 == 3 and LRE23 == 1 and patE23 == 56 and st3E23 == 4 then                                      --falcon                                       
X_pos_E23 = X_pos_E23-1 ; Y_pos_E23 = Y_pos_E23-16 ; WgtE23 = WgtE23+24 ; HgtE23 = HgtE23+16   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                            
elseif OIe23 == 255 and Ehp23 == 3 and LRE23 == 0 and patE23 == 57 and st3E23 == 4 
  or OIe23 == 255 and Ehp23 == 3 and LRE23 == 0 and patE23 == 56 and st3E23 == 4 then                                      --falcon                             
X_pos_E23 = X_pos_E23-2 ; Y_pos_E23 = Y_pos_E23-16 ; WgtE23 = WgtE23+24 ; HgtE23 = HgtE23+16   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)
elseif OIe23 == 255 and Ehp23 == 2 and LRE23 == 1 and patE23 == 58 and st3E23 == 3 then                                    --Painting pictures                                       
X_pos_E23 = X_pos_E23-2 ; Y_pos_E23 = Y_pos_E23-15 ; WgtE23 = WgtE23+12 ; HgtE23 = HgtE23+19  
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                            
elseif OIe23 == 255 and Ehp23 == 2 and LRE23 == 0 and patE23 == 58 and st3E23 == 3 then                                    --Painting pictures                            
X_pos_E23 = X_pos_E23 ; Y_pos_E23 = Y_pos_E23-15 ; WgtE23 = WgtE23+12 ; HgtE23 = HgtE23+19   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea) 
elseif OIe23 == 255 and Ehp23 == 2 and LRE23 == 1 and patE23 == 58 and st3E23 == 4 then                                    --Table doomed                                        
X_pos_E23 = X_pos_E23-1 ; Y_pos_E23 = Y_pos_E23-15 ; WgtE23 = WgtE23+20 ; HgtE23 = HgtE23+12     
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                            
elseif OIe23 == 255 and Ehp23 == 2 and LRE23 == 0 and patE23 == 58 and st3E23 == 4 then                                    --Table doomed                           
X_pos_E23 = X_pos_E23-2 ; Y_pos_E23 = Y_pos_E23-15 ; WgtE23 = WgtE23+20 ; HgtE23 = HgtE23+12   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea) 
elseif OIe23 == 255 and Ehp23 == 1 and LRE23 == 1 and patE23 == 58 and st3E23 == 2 then                                    --Candle                                      
X_pos_E23 = X_pos_E23-1 ; Y_pos_E23 = Y_pos_E23-16 ; WgtE23 = WgtE23+8 ; HgtE23 = HgtE23+4   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                            
elseif OIe23 == 255 and Ehp23 == 1 and LRE23 == 0 and patE23 == 58 and st3E23 == 2 then                                    --Candle                          
X_pos_E23 = X_pos_E23-2 ; Y_pos_E23 = Y_pos_E23-16 ; WgtE23 = WgtE23+8 ; HgtE23 = HgtE23+4   
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,purpurea)                      

end

if Ehp23 == 0 then                              -- stop hitbox enemy23
X_pos_E23 = X_pos_E23+1 ; Y_pos_E23 = Y_pos_E23-14       
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,NO23)
elseif Ehp23 > 0 and OIe23 == 0 then
gui.drawRectangle(X_pos_E23,Y_pos_E23,WgtE23,HgtE23,NO23)

end
end

local function Enemy24_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX24 = mainmemory.read_u8              --X coordinate
local YY24 = mainmemory.read_u8              --Y coordinate
local enemy24_hp = mainmemory.read_u8        --Health Points enemy4
local stat1_E24 = mainmemory.read_u8         --state1 
local stat2_E24 = mainmemory.read_u8         --state2 
local stat3_E24 = mainmemory.read_u8         --state3 
local stat4_E24 = mainmemory.read_u8         --state4 
local pat_E24 = mainmemory.read_u8           --pattern select
local pat_count_E24 = mainmemory.read_u8     --pattern start count
local RES_pat_E24 = mainmemory.read_u8       --result pattern
local LR_E24 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E24 = mainmemory.read_u8            --check if enemy24 is loaded
local Scon = score_ONoff(0x00FD)
local Ehp24 = enemy24_hp(0x0E21)
local st1E24 = stat1_E24(0x0E38)
local st2E24 = stat2_E24(0x0E39)
local st3E24 = stat3_E24(0x0E3A)
local st4E24 = stat4_E24(0x0E3B)
local patE24 = pat_E24(0x0E27)
local PATcE24 = pat_count_E24(0x0E3F)
local RpatE24 = RES_pat_E24(0x0E3E)
local LRE24 = LR_E24(0x0E30)
local OIe24 = OI_E24(0x0E20)
local X_pos_E24 = XX24(0x0E24)
local Y_pos_E24 = YY24(0x0E22)
local WgtE24 = 10
local HgtE24 = 10
local mok = 0xFF666666
local NO24 = 0x000000FF

if Scon > 16 then
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,NO24)

elseif OIe24 == 255 and Ehp24 == 1 and LRE24 == 1 and patE24 == 50 and st3E24 == 1 then                                   --Bat                                        
X_pos_E24 = X_pos_E24-1 ; Y_pos_E24 = Y_pos_E24-16 ; WgtE24 = WgtE24+8 ; HgtE24 = HgtE24+4   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                            
elseif OIe24 == 255 and Ehp24 == 1 and LRE24 == 0 and patE24 == 50 and st3E24 == 1 then                                   --Bat                             
X_pos_E24 = X_pos_E24-2 ; Y_pos_E24 = Y_pos_E24-16 ; WgtE24 = WgtE24+8 ; HgtE24 = HgtE24+4   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                                                   
elseif OIe24 == 255 and Ehp24 == 2 and LRE24 == 1 and st1E24 == 16 and st2E24 == 32 and st3E24 == 2 and st4E24 == 2 
  or OIe24 == 255 and Ehp24 == 2 and LRE24 == 1 and st1E24 == 16 and st2E24 == 0 and st3E24 == 2 and st4E24 == 2 then     --Dog                           
X_pos_E24 = X_pos_E24+1 ; Y_pos_E24 = Y_pos_E24-17 ; WgtE24 = WgtE24+20 ; HgtE24 = HgtE24+7  
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                                  
elseif OIe24 == 255 and Ehp24 == 2 and LRE24 == 0 and st1E24 == 16 and st2E24 == 32 and st3E24 == 2 and st4E24 == 2 
  or OIe24 == 255 and Ehp24 == 2 and LRE24 == 0 and st1E24 == 16 and st2E24 == 0 and st3E24 == 2 and st4E24 == 2 then     --Dog                             
X_pos_E24 = X_pos_E24+1 ; Y_pos_E24 = Y_pos_E24-17 ; WgtE24 = WgtE24+20 ; HgtE24 = HgtE24+7  
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                                  
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 1 and st1E24 == 16 and st2E24 == 32 and st3E24 == 3 and st4E24 == 3 then  --super dog       
X_pos_E24 = X_pos_E24 ; Y_pos_E24 = Y_pos_E24-17 ; WgtE24 = WgtE24+20 ; HgtE24 = HgtE24+7  
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 0 and st1E24 == 16 and st2E24 == 32 and st3E24 == 3 and st4E24 == 3 then  --super dog       
X_pos_E24 = X_pos_E24 ; Y_pos_E24 = Y_pos_E24-17 ; WgtE24 = WgtE24+20 ; HgtE24 = HgtE24+7  
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)
elseif OIe24 == 255 and Ehp24 == 2 and LRE24 == 1 and patE24 >= 52 and st3E24 == 2 then                                   --ghost girl                             
X_pos_E24 = X_pos_E24-4 ; Y_pos_E24 = Y_pos_E24-17 ; WgtE24 = WgtE24+12 ; HgtE24 = HgtE24+23  
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                                  
elseif OIe24 == 255 and Ehp24 == 2 and LRE24 == 0 and patE24 == 52 and st3E24 == 2 then                                   --ghost girl             
X_pos_E24 = X_pos_E24-3 ; Y_pos_E24 = Y_pos_E24-17 ; WgtE24 = WgtE24+12 ; HgtE24 = HgtE24+23  
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 1 and patE24 >= 52  
and st1E24 == 32 and st2E24 == 16 and st3E24 == 3 and st4E24 == 3 then                                                    --Super ghost girl                             
X_pos_E24 = X_pos_E24-4 ; Y_pos_E24 = Y_pos_E24-17 ; WgtE24 = WgtE24+12 ; HgtE24 = HgtE24+23  
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                                 
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 0 and patE24 == 52 
and st1E24 == 32 and st2E24 == 16 and st3E24 == 3 and st4E24 == 3 then                                                    --Super ghost girl             
X_pos_E24 = X_pos_E24-3 ; Y_pos_E24 = Y_pos_E24-17 ; WgtE24 = WgtE24+12 ; HgtE24 = HgtE24+23  
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                    
elseif OIe24 == 255 and Ehp24 >= 2 and LRE24 == 1 and patE24 == 53 and st3E24 >= 3 then                                   --Goblin , super goblin                            
X_pos_E24 = X_pos_E24-4 ; Y_pos_E24 = Y_pos_E24-17 ; WgtE24 = WgtE24+10 ; HgtE24 = HgtE24+23  
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                                  
elseif OIe24 == 255 and Ehp24 >= 2 and LRE24 == 0 and patE24 == 53 and st3E24 >= 3 then                                   --Goblin , super goblin            
X_pos_E24 = X_pos_E24 ; Y_pos_E24 = Y_pos_E24-17 ; WgtE24 = WgtE24+10 ; HgtE24 = HgtE24+23  
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                     
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 1 and patE24 <= 52 and st3E24 == 3 
and st1E24 == 40 and st2E24 == 16 and st3E24 == 3 and st4E24 == 2 
  or OIe24 == 255 and Ehp24 == 3 and LRE24 == 1 and patE24 <= 52 and st3E24 == 3 
and st1E24 == 40 and st2E24 == 0 and st3E24 == 3 and st4E24 == 2 then                                                     --Strange man                               
X_pos_E24 = X_pos_E24 ; Y_pos_E24 = Y_pos_E24-16 ; WgtE24 = WgtE24+7 ; HgtE24 = HgtE24+30 
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                            
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 0 and patE24 == 51 and st3E24 == 3 
and st1E24 == 40 and st2E24 == 16 and st3E24 == 3 and st4E24 == 2 
  or OIe24 == 255 and Ehp24 == 3 and LRE24 == 0 and patE24 <= 52 and st3E24 == 3 
and st1E24 == 40 and st2E24 == 0 and st3E24 == 3 and st4E24 == 2 then                                                     --Strange man                            
X_pos_E24 = X_pos_E24-1 ; Y_pos_E24 = Y_pos_E24-16 ; WgtE24 = WgtE24+7 ; HgtE24 = HgtE24+30 
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                           
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 1 and patE24 == 55 and st3E24 == 4 then                                   --Skeleton                              
X_pos_E24 = X_pos_E24-8 ; Y_pos_E24 = Y_pos_E24-17 ; WgtE24 = WgtE24+15 ; HgtE24 = HgtE24+30 
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                            
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 0 and patE24 == 55 and st3E24 == 4 then                                   --Skeleton                              
X_pos_E24 = X_pos_E24-1 ; Y_pos_E24 = Y_pos_E24-17 ; WgtE24 = WgtE24+15 ; HgtE24 = HgtE24+30 
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 1 and patE24 == 54 and st3E24 == 3 then                                   --Wax dolls                           
X_pos_E24 = X_pos_E24-2 ; Y_pos_E24 = Y_pos_E24-14 ; WgtE24 = WgtE24+11 ; HgtE24 = HgtE24+28 
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                            
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 0 and patE24 == 54 and st3E24 == 3 then                                   --Wax dolls                           
X_pos_E24 = X_pos_E24-2 ; Y_pos_E24 = Y_pos_E24-14 ; WgtE24 = WgtE24+11 ; HgtE24 = HgtE24+28 
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 1 and patE24 >= 55 and patE24 <= 56 and st3E24 == 3 
 and st1E24 == 32 and st2E24 == 16 and st3E24 == 3 and st4E24 == 2 
  or OIe24 == 255 and Ehp24 == 3 and LRE24 == 1 and patE24 >= 55 and patE24 <= 56 and st3E24 == 3 
 and st1E24 == 32 and st2E24 == 0 and st3E24 == 3 and st4E24 == 2 then                                                    --Magician                                       
X_pos_E24 = X_pos_E24-1 ; Y_pos_E24 = Y_pos_E24-16 ; WgtE24 = WgtE24+7 ; HgtE24 = HgtE24+22   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                            
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 0 and patE24 >= 55 and patE24 <= 56 and st3E24 == 3 
 and st1E24 == 32 and st2E24 == 16 and st3E24 == 3 and st4E24 == 2 
  or OIe24 == 255 and Ehp24 == 3 and LRE24 == 0 and patE24 >= 55 and patE24 <= 56 and st3E24 == 3 
 and st1E24 == 32 and st2E24 == 0 and st3E24 == 3 and st4E24 == 2 then                                                    --Magician                             
X_pos_E24 = X_pos_E24-3 ; Y_pos_E24 = Y_pos_E24-16 ; WgtE24 = WgtE24+7 ; HgtE24 = HgtE24+22  
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok) 
elseif OIe24 == 255 and Ehp24 == 1 and LRE24 == 1 and patE24 == 57 and st3E24 == 1 then                                   --Knife                                        
X_pos_E24 = X_pos_E24-2 ; Y_pos_E24 = Y_pos_E24-16 ; WgtE24 = WgtE24 ; HgtE24 = HgtE24   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                            
elseif OIe24 == 255 and Ehp24 == 1 and LRE24 == 0 and patE24 == 57 and st3E24 == 1 then                                   --Knife                            
X_pos_E24 = X_pos_E24-2 ; Y_pos_E24 = Y_pos_E24-16 ; WgtE24 = WgtE24 ; HgtE24 = HgtE24   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok) 
elseif OIe24 == 255 and Ehp24 == 2 and LRE24 == 1 and patE24 == 57 and st3E24 == 3 then                                   --Chair                                       
X_pos_E24 = X_pos_E24-1 ; Y_pos_E24 = Y_pos_E24-14 ; WgtE24 = WgtE24+9 ; HgtE24 = HgtE24+20   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                            
elseif OIe24 == 255 and Ehp24 == 2 and LRE24 == 0 and patE24 == 57 and st3E24 == 3 then                                   --Chair                            
X_pos_E24 = X_pos_E24-2 ; Y_pos_E24 = Y_pos_E24-14 ; WgtE24 = WgtE24+9 ; HgtE24 = HgtE24+20   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 1 and patE24 == 57 and st3E24 == 4
  or OIe24 == 255 and Ehp24 == 3 and LRE24 == 1 and patE24 == 56 and st3E24 == 4 then                                     --falcon                                       
X_pos_E24 = X_pos_E24-1 ; Y_pos_E24 = Y_pos_E24-16 ; WgtE24 = WgtE24+24 ; HgtE24 = HgtE24+16   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                            
elseif OIe24 == 255 and Ehp24 == 3 and LRE24 == 0 and patE24 == 57 and st3E24 == 4 
  or OIe24 == 255 and Ehp24 == 3 and LRE24 == 0 and patE24 == 56 and st3E24 == 4 then                                     --falcon                             
X_pos_E24 = X_pos_E24-2 ; Y_pos_E24 = Y_pos_E24-16 ; WgtE24 = WgtE24+24 ; HgtE24 = HgtE24+16   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)
elseif OIe24 == 255 and Ehp24 == 2 and LRE24 == 1 and patE24 == 58 and st3E24 == 3 then                                   --Painting pictures                                       
X_pos_E24 = X_pos_E24-2 ; Y_pos_E24 = Y_pos_E24-15 ; WgtE24 = WgtE24+12 ; HgtE24 = HgtE24+19  
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                            
elseif OIe24 == 255 and Ehp24 == 2 and LRE24 == 0 and patE24 == 58 and st3E24 == 3 then                                   --Painting pictures                            
X_pos_E24 = X_pos_E24 ; Y_pos_E24 = Y_pos_E24-15 ; WgtE24 = WgtE24+12 ; HgtE24 = HgtE24+19   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok) 
elseif OIe24 == 255 and Ehp24 == 2 and LRE24 == 1 and patE24 == 58 and st3E24 == 4 then                                   --Table doomed                                        
X_pos_E24 = X_pos_E24-1 ; Y_pos_E24 = Y_pos_E24-15 ; WgtE24 = WgtE24+20 ; HgtE24 = HgtE24+12   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                            
elseif OIe24 == 255 and Ehp24 == 2 and LRE24 == 0 and patE24 == 58 and st3E24 == 4 then                                   --Table doomed                           
X_pos_E24 = X_pos_E24-2 ; Y_pos_E24 = Y_pos_E24-15 ; WgtE24 = WgtE24+20 ; HgtE24 = HgtE24+12   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok) 
elseif OIe24 == 255 and Ehp24 == 1 and LRE24 == 1 and patE24 == 58 and st3E24 == 2 then                                   --Candle                                      
X_pos_E24 = X_pos_E24-1 ; Y_pos_E24 = Y_pos_E24-16 ; WgtE24 = WgtE24+8 ; HgtE24 = HgtE24+4   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                            
elseif OIe24 == 255 and Ehp24 == 1 and LRE24 == 0 and patE24 == 58 and st3E24 == 2 then                                   --Candle                          
X_pos_E24 = X_pos_E24-2 ; Y_pos_E24 = Y_pos_E24-16 ; WgtE24 = WgtE24+8 ; HgtE24 = HgtE24+4   
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,mok)                      

end

if Ehp24 == 0 then                              -- stop hitbox enemy24
X_pos_E24 = X_pos_E24+1 ; Y_pos_E24 = Y_pos_E24-14       
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,NO24)
elseif Ehp24 > 0 and OIe24 == 0 then
gui.drawRectangle(X_pos_E24,Y_pos_E24,WgtE24,HgtE24,NO24)

end
end

local function Enemy25_hitbox()

local score_ONoff = mainmemory.read_u8      --check if score (on/off)
local XX25 = mainmemory.read_u8              --X coordinate
local YY25 = mainmemory.read_u8              --Y coordinate
local enemy25_hp = mainmemory.read_u8        --Health Points enemy25
local stat1_E25 = mainmemory.read_u8         --state1 
local stat2_E25 = mainmemory.read_u8         --state2 
local stat3_E25 = mainmemory.read_u8         --state3 
local stat4_E25 = mainmemory.read_u8         --state4 
local pat_E25 = mainmemory.read_u8           --pattern select
local pat_count_E25 = mainmemory.read_u8     --pattern start count
local RES_pat_E25 = mainmemory.read_u8       --result pattern
local LR_E25 = mainmemory.read_u8            --Check  pattern is LEFT , RIGHT position
local OI_E25 = mainmemory.read_u8            --check if enemy25 is loaded
local Scon = score_ONoff(0x00FD)
local Ehp25 = enemy25_hp(0x0B81)
local st1E25 = stat1_E25(0x0B98)
local st2E25 = stat2_E25(0x0B99)
local st3E25 = stat3_E25(0x0B9A)
local st4E25 = stat4_E25(0x0B9B)
local patE25 = pat_E25(0x0B87)
local PATcE25 = pat_count_E25(0x0B9F)
local RpatE25 = RES_pat_E25(0x0B9E)
local LRE25 = LR_E25(0x0B90)
local OIe25 = OI_E25(0x0B80)
local X_pos_E25 = XX25(0x0B84)
local Y_pos_E25 = YY25(0x0B82)
local WgtE25 = 10
local HgtE25 = 10
local jau = 0xFFFFCC00
local NO25 = 0x00FFFFFF

if Scon > 16 then
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,NO25)

elseif OIe25 == 255 and Ehp25 == 1 and LRE25 == 1 and patE25 == 50 and st3E25 == 1 then                                    --Bat                                        
X_pos_E25 = X_pos_E25-1 ; Y_pos_E25 = Y_pos_E25-16 ; WgtE25 = WgtE25+8 ; HgtE25 = HgtE25+4   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                            
elseif OIe25 == 255 and Ehp25 == 1 and LRE25 == 0 and patE25 == 50 and st3E25 == 1 then                                    --Bat                             
X_pos_E25 = X_pos_E25-2 ; Y_pos_E25 = Y_pos_E25-16 ; WgtE25 = WgtE25+8 ; HgtE25 = HgtE25+4   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                                                   
elseif OIe25 == 255 and Ehp25 == 2 and LRE25 == 1 and st1E25 == 16 and st2E25 == 32 and st3E25 == 2 and st4E25 == 2 
  or OIe25 == 255 and Ehp25 == 2 and LRE25 == 1 and st1E25 == 16 and st2E25 == 0 and st3E25 == 2 and st4E25 == 2 then      --Dog                           
X_pos_E25 = X_pos_E25+1 ; Y_pos_E25 = Y_pos_E25-17 ; WgtE25 = WgtE25+20 ; HgtE25 = HgtE25+7  
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                                  
elseif OIe25 == 255 and Ehp25 == 2 and LRE25 == 0 and st1E25 == 16 and st2E25 == 32 and st3E25 == 2 and st4E25 == 2 
  or OIe25 == 255 and Ehp25 == 2 and LRE25 == 0 and st1E25 == 16 and st2E25 == 0 and st3E25 == 2 and st4E25 == 2 then      --Dog                             
X_pos_E25 = X_pos_E25+1 ; Y_pos_E25 = Y_pos_E25-17 ; WgtE25 = WgtE25+20 ; HgtE25 = HgtE25+7  
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                                  
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 1 and st1E25 == 16 and st2E25 == 32 and st3E25 == 3 and st4E25 == 3 then   --super dog       
X_pos_E25 = X_pos_E25 ; Y_pos_E25 = Y_pos_E25-17 ; WgtE25 = WgtE25+20 ; HgtE25 = HgtE25+7  
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 0 and st1E25 == 16 and st2E25 == 32 and st3E25 == 3 and st4E25 == 3 then   --super dog       
X_pos_E25 = X_pos_E25 ; Y_pos_E25 = Y_pos_E25-17 ; WgtE25 = WgtE25+20 ; HgtE25 = HgtE25+7  
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)
elseif OIe25 == 255 and Ehp25 == 2 and LRE25 == 1 and patE25 >= 52 and st3E25 == 2 then                                    --ghost girl                             
X_pos_E25 = X_pos_E25-4 ; Y_pos_E25 = Y_pos_E25-17 ; WgtE25 = WgtE25+12 ; HgtE25 = HgtE25+23  
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                                  
elseif OIe25 == 255 and Ehp25 == 2 and LRE25 == 0 and patE25 == 52 and st3E25 == 2 then                                    --ghost girl             
X_pos_E25 = X_pos_E25-3 ; Y_pos_E25 = Y_pos_E25-17 ; WgtE25 = WgtE25+12 ; HgtE25 = HgtE25+23  
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 1 and patE25 >= 52  
and st1E25 == 32 and st2E25 == 16 and st3E25 == 3 and st4E25 == 3 then                                                     --Super ghost girl                             
X_pos_E25 = X_pos_E25-4 ; Y_pos_E25 = Y_pos_E25-17 ; WgtE25 = WgtE25+12 ; HgtE25 = HgtE25+23  
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                                 
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 0 and patE25 == 52 
and st1E25 == 32 and st2E25 == 16 and st3E25 == 3 and st4E25 == 3 then                                                     --Super ghost girl             
X_pos_E25 = X_pos_E25-3 ; Y_pos_E25 = Y_pos_E25-17 ; WgtE25 = WgtE25+12 ; HgtE25 = HgtE25+23  
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                    
elseif OIe25 == 255 and Ehp25 >= 2 and LRE25 == 1 and patE25 == 53 and st3E25 >= 3 then                                    --Goblin , super goblin                            
X_pos_E25 = X_pos_E25-4 ; Y_pos_E25 = Y_pos_E25-17 ; WgtE25 = WgtE25+10 ; HgtE25 = HgtE25+23  
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                                  
elseif OIe25 == 255 and Ehp25 >= 2 and LRE25 == 0 and patE25 == 53 and st3E25 >= 3 then                                    --Goblin , super goblin            
X_pos_E25 = X_pos_E25 ; Y_pos_E25 = Y_pos_E25-17 ; WgtE25 = WgtE25+10 ; HgtE25 = HgtE25+23  
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                     
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 1 and patE25 <= 52 and st3E25 == 3 
and st1E25 == 40 and st2E25 == 16 and st3E25 == 3 and st4E25 == 2 
  or OIe25 == 255 and Ehp25 == 3 and LRE25 == 1 and patE25 <= 52 and st3E25 == 3 
and st1E25 == 40 and st2E25 == 0 and st3E25 == 3 and st4E25 == 2 then                                                      --Strange man                               
X_pos_E25 = X_pos_E25 ; Y_pos_E25 = Y_pos_E25-16 ; WgtE25 = WgtE25+7 ; HgtE25 = HgtE25+30 
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                            
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 0 and patE25 == 51 and st3E25 == 3 
and st1E25 == 40 and st2E25 == 16 and st3E25 == 3 and st4E25 == 2 
  or OIe25 == 255 and Ehp25 == 3 and LRE25 == 0 and patE25 <= 52 and st3E25 == 3 
and st1E25 == 40 and st2E25 == 0 and st3E25 == 3 and st4E25 == 2 then                                                      --Strange man                            
X_pos_E25 = X_pos_E25-1 ; Y_pos_E25 = Y_pos_E25-16 ; WgtE25 = WgtE25+7 ; HgtE25 = HgtE25+30 
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                           
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 1 and patE25 == 55 and st3E25 == 4 then                                    --Skeleton                              
X_pos_E25 = X_pos_E25-8 ; Y_pos_E25 = Y_pos_E25-17 ; WgtE25 = WgtE25+15 ; HgtE25 = HgtE25+30 
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                            
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 0 and patE25 == 55 and st3E25 == 4 then                                    --Skeleton                              
X_pos_E25 = X_pos_E25-1 ; Y_pos_E25 = Y_pos_E25-17 ; WgtE25 = WgtE25+15 ; HgtE25 = HgtE25+30 
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 1 and patE25 == 54 and st3E25 == 3 then                                    --Wax dolls                           
X_pos_E25 = X_pos_E25-2 ; Y_pos_E25 = Y_pos_E25-14 ; WgtE25 = WgtE25+11 ; HgtE25 = HgtE25+28 
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                            
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 0 and patE25 == 54 and st3E25 == 3 then                                    --Wax dolls                           
X_pos_E25 = X_pos_E25-2 ; Y_pos_E25 = Y_pos_E25-14 ; WgtE25 = WgtE25+11 ; HgtE25 = HgtE25+28 
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 1 and patE25 >= 55 and patE25 <= 56 and st3E25 == 3 
 and st1E25 == 32 and st2E25 == 16 and st3E25 == 3 and st4E25 == 2 
  or OIe25 == 255 and Ehp25 == 3 and LRE25 == 1 and patE25 >= 55 and patE25 <= 56 and st3E25 == 3 
 and st1E25 == 32 and st2E25 == 0 and st3E25 == 3 and st4E25 == 2 then                                                     --Magician                                       
X_pos_E25 = X_pos_E25-1 ; Y_pos_E25 = Y_pos_E25-16 ; WgtE25 = WgtE25+7 ; HgtE25 = HgtE25+22   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                            
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 0 and patE25 >= 55 and patE25 <= 56 and st3E25 == 3 
 and st1E25 == 32 and st2E25 == 16 and st3E25 == 3 and st4E25 == 2 
  or OIe25 == 255 and Ehp25 == 3 and LRE25 == 0 and patE25 >= 55 and patE25 <= 56 and st3E25 == 3 
 and st1E25 == 32 and st2E25 == 0 and st3E25 == 3 and st4E25 == 2 then                                                     --Magician                             
X_pos_E25 = X_pos_E25-3 ; Y_pos_E25 = Y_pos_E25-16 ; WgtE25 = WgtE25+7 ; HgtE25 = HgtE25+22  
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau) 
elseif OIe25 == 255 and Ehp25 == 1 and LRE25 == 1 and patE25 == 57 and st3E25 == 1 then                                    --Knife                                        
X_pos_E25 = X_pos_E25-2 ; Y_pos_E25 = Y_pos_E25-16 ; WgtE25 = WgtE25 ; HgtE25 = HgtE25   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                            
elseif OIe25 == 255 and Ehp25 == 1 and LRE25 == 0 and patE25 == 57 and st3E25 == 1 then                                    --Knife                            
X_pos_E25 = X_pos_E25-2 ; Y_pos_E25 = Y_pos_E25-16 ; WgtE25 = WgtE25 ; HgtE25 = HgtE25   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau) 
elseif OIe25 == 255 and Ehp25 == 2 and LRE25 == 1 and patE25 == 57 and st3E25 == 3 then                                    --Chair                                       
X_pos_E25 = X_pos_E25-1 ; Y_pos_E25 = Y_pos_E25-14 ; WgtE25 = WgtE25+9 ; HgtE25 = HgtE25+20   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                            
elseif OIe25 == 255 and Ehp25 == 2 and LRE25 == 0 and patE25 == 57 and st3E25 == 3 then                                    --Chair                            
X_pos_E25 = X_pos_E25-2 ; Y_pos_E25 = Y_pos_E25-14 ; WgtE25 = WgtE25+9 ; HgtE25 = HgtE25+20   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 1 and patE25 == 57 and st3E25 == 4
  or OIe25 == 255 and Ehp25 == 3 and LRE25 == 1 and patE25 == 56 and st3E25 == 4 then                                      --falcon                                       
X_pos_E25 = X_pos_E25-1 ; Y_pos_E25 = Y_pos_E25-16 ; WgtE25 = WgtE25+24 ; HgtE25 = HgtE25+16   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                            
elseif OIe25 == 255 and Ehp25 == 3 and LRE25 == 0 and patE25 == 57 and st3E25 == 4 
  or OIe25 == 255 and Ehp25 == 3 and LRE25 == 0 and patE25 == 56 and st3E25 == 4 then                                      --falcon                             
X_pos_E25 = X_pos_E25-2 ; Y_pos_E25 = Y_pos_E25-16 ; WgtE25 = WgtE25+24 ; HgtE25 = HgtE25+16   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)
elseif OIe25 == 255 and Ehp25 == 2 and LRE25 == 1 and patE25 == 58 and st3E25 == 3 then                                    --Painting pictures                                 
X_pos_E25 = X_pos_E25-2 ; Y_pos_E25 = Y_pos_E25-15 ; WgtE25 = WgtE25+12 ; HgtE25 = HgtE25+19  
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                            
elseif OIe25 == 255 and Ehp25 == 2 and LRE25 == 0 and patE25 == 58 and st3E25 == 3 then                                    --Painting pictures                            
X_pos_E25 = X_pos_E25 ; Y_pos_E25 = Y_pos_E25-15 ; WgtE25 = WgtE25+12 ; HgtE25 = HgtE25+19   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau) 
elseif OIe25 == 255 and Ehp25 == 2 and LRE25 == 1 and patE25 == 58 and st3E25 == 4 then                                    --Table doomed                                        
X_pos_E25 = X_pos_E25-1 ; Y_pos_E25 = Y_pos_E25-15 ; WgtE25 = WgtE25+20 ; HgtE25 = HgtE25+12   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                            
elseif OIe25 == 255 and Ehp25 == 2 and LRE25 == 0 and patE25 == 58 and st3E25 == 4 then                                    --Table doomed                           
X_pos_E25 = X_pos_E25-2 ; Y_pos_E25 = Y_pos_E25-15 ; WgtE25 = WgtE25+20 ; HgtE25 = HgtE25+12   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau) 
elseif OIe25 == 255 and Ehp25 == 1 and LRE25 == 1 and patE25 == 58 and st3E25 == 2 then                                    --Candle                                      
X_pos_E25 = X_pos_E25-1 ; Y_pos_E25 = Y_pos_E25-16 ; WgtE25 = WgtE25+8 ; HgtE25 = HgtE25+4   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                            
elseif OIe25 == 255 and Ehp25 == 1 and LRE25 == 0 and patE25 == 58 and st3E25 == 2 then                                    --Candle                          
X_pos_E25 = X_pos_E25-2 ; Y_pos_E25 = Y_pos_E25-16 ; WgtE25 = WgtE25+8 ; HgtE25 = HgtE25+4   
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,jau)                      


end

if Ehp25 == 0 then                              -- stop hitbox enemy25
X_pos_E25 = X_pos_E25+1 ; Y_pos_E25 = Y_pos_E25-14       
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,NO25)
elseif Ehp25 > 0 and OIe25 == 0 then
gui.drawRectangle(X_pos_E25,Y_pos_E25,WgtE25,HgtE25,NO25)

end
end


local function bullets_hitbox()
local Xbul1 = mainmemory.read_u8      --X position bullet
local Ybul1 = mainmemory.read_u8      --Y position bullet
local OI_B1 = mainmemory.read_u8      --open close hit box
local LorR1 = mainmemory.read_u8      --check left or right
local IOBb = mainmemory.read_u8       --check if boss is at screen
local XBu1 = Xbul1(0x0A84)
local YBu1 = Ybul1(0x0A82)
local OIb1 = OI_B1(0x0A80)
local LR1 = LorR1(0x0A90)
local IoBb = IOBb(0x0B60)
local green = 0xFF00FF00
local no = 0x00FFFFFF

if OIb1 == 255 and LR1 == 1 and IoBb == 0 then
XBu1 = XBu1 ; YBu1 = YBu1 -17
gui.drawRectangle(XBu1,YBu1,8,8,green)
elseif OIb1 == 255 and LR1 == 0 and IoBb == 0 then
XBu1 = XBu1-2 ; YBu1 = YBu1 -17
gui.drawRectangle(XBu1,YBu1,8,8,green)
elseif OIb1 == 255 and IoBb == 255 then
gui.drawRectangle(XBu1,YBu1,5,5,no)



end
end

local function bullets2_hitbox()
local Xbul2 = mainmemory.read_u8      --X position bullet
local Ybul2 = mainmemory.read_u8      --Y position bullet
local OI_B2 = mainmemory.read_u8      --open close hit box
local LorR2 = mainmemory.read_u8      --check left or right
local XBu2 = Xbul2(0x0AA4)
local YBu2 = Ybul2(0x0AA2)
local OIb2 = OI_B2(0x0AA0)
local LR2 = LorR2(0x0AB0)
local green2 = 0xFF00DD00
local no = 0x00FFFFFF

if OIb2 == 255 and LR2 == 1 then
XBu2 = XBu2 ; YBu2 = YBu2 -17
gui.drawRectangle(XBu2,YBu2,8,8,green2)
elseif OIb2 == 255 and LR2 == 0 then
XBu2 = XBu2-2 ; YBu2 = YBu2 -17
gui.drawRectangle(XBu2,YBu2,8,8,green2)
elseif OIb2 == 0 then
gui.drawRectangle(XBu2,YBu2,5,5,no)


end
end

local function bullets3_hitbox()
local Xbul3 = mainmemory.read_u8      --X position bullet
local Ybul3 = mainmemory.read_u8      --Y position bullet
local OI_B3 = mainmemory.read_u8      --open close hit box
local LorR3 = mainmemory.read_u8      --check left or right
local XBu3 = Xbul3(0x0AC4)
local YBu3 = Ybul3(0x0AC2)
local OIb3 = OI_B3(0x0AC0)
local LR3 = LorR3(0x0AD0)
local green3 = 0xFF00BB00
local no = 0x00FFFFFF

if OIb3 == 255 and LR3 == 1 then
XBu3 = XBu3 ; YBu3 = YBu3 -17
gui.drawRectangle(XBu3,YBu3,8,8,green3)
elseif OIb3 == 255 and LR3 == 0 then
XBu3 = XBu3-2 ; YBu3 = YBu3 -17
gui.drawRectangle(XBu3,YBu3,8,8,green3)
elseif OIb3 == 0 then
gui.drawRectangle(XBu3,YBu3,5,5,no)


end
end

local function bullets4_hitbox()
local Xbul4 = mainmemory.read_u8      --X position bullet
local Ybul4 = mainmemory.read_u8      --Y position bullet
local OI_B4 = mainmemory.read_u8      --open close hit box
local LorR4 = mainmemory.read_u8      --check left or right
local XBu4 = Xbul4(0x0A64)
local YBu4 = Ybul4(0x0A62)
local OIb4 = OI_B4(0x0A60)
local LR4 = LorR4(0x0A70)
local green4 = 0xFF009900
local no = 0x00FFFFFF

if OIb4 == 255 and LR4 == 1 then
XBu4 = XBu4 ; YBu4 = YBu4 -17
gui.drawRectangle(XBu4,YBu4,8,8,green4)
elseif OIb4 == 255 and LR4 == 0 then
XBu4 = XBu4-2 ; YBu4 = YBu4 -17
gui.drawRectangle(XBu4,YBu4,8,8,green4)
elseif OIb4 == 0 then
gui.drawRectangle(XBu4,YBu4,5,5,no)


end
end

local function bullets5_hitbox()
local Xbul5 = mainmemory.read_u8      --X position bullet
local Ybul5 = mainmemory.read_u8      --Y position bullet
local OI_B5 = mainmemory.read_u8      --open close hit box
local LorR5 = mainmemory.read_u8      --check left or right
local XBu5 = Xbul5(0x0A44)
local YBu5 = Ybul5(0x0A42)
local OIb5 = OI_B5(0x0A40)
local LR5 = LorR5(0x0A50)
local green5 = 0xFF007700
local no = 0x00FFFFFF

if OIb5 == 255 and LR5 == 1 then
XBu5 = XBu5 ; YBu5 = YBu5 -17
gui.drawRectangle(XBu5,YBu5,8,8,green5)
elseif OIb5 == 255 and LR5 == 0 then
XBu5 = XBu5-2 ; YBu5 = YBu5 -17
gui.drawRectangle(XBu5,YBu5,8,8,green5)
elseif OIb5 == 0 then
gui.drawRectangle(XBu5,YBu5,5,5,no)

end
end

local function Bullet_player()
local X_BUL = mainmemory.read_u8            --X position bullet
local Y_BUL = mainmemory.read_u8            --Y position bullet
local BUL_count = mainmemory.read_u8        --check bullet count
local SSWD_sel = mainmemory.read_u8         --check secondary weapon use
local bombe_pat = mainmemory.read_u8        --check bomb pattern
local drop_B = mainmemory.read_u8           --check if bomb use
local VLR_Bomb = mainmemory.read_u8         --check if L or R
local Sswd = SSWD_sel(0x1FB8)
local Xbul = X_BUL(0x0A44)
local Ybul = Y_BUL(0x0A42)
local bulC = BUL_count(0x1FB9)
local bmp = bombe_pat(0x0A48)
local dbmb = drop_B(0x0A40)
local vlrb = VLR_Bomb(0x0A46)
local green = 0xFF003300
local no = 0x00FFFFFF


if Sswd == 3 and bmp == 1 and dbmb == 127 then
Xbul = Xbul + 2  ;  Ybul = Ybul - 16
gui.drawRectangle(Xbul,Ybul,8,8,green)
elseif Sswd == 3 and bmp > 1 and dbmb == 127 then
Xbul = Xbul ;  Ybul = Ybul - 16
gui.drawRectangle(Xbul,Ybul,23,23,green) 
elseif Sswd == 3 and bmp > 1 and dbmb == 2 then
Xbul = Xbul  ;  Ybul = Ybul - 16
gui.drawRectangle(Xbul,Ybul,8,8,no)

elseif vlrb == 111 and Sswd == 3 and bmp == 1 and dbmb == 127 and bulC == bulC-1 then
Xbul = Xbul -7 ;  Ybul = Ybul - 16
gui.drawRectangle(Xbul,Ybul,8,8,green)

end
end


local function HITandFASTwalk()

local gravity = mainmemory.read_u8
local fast_walk = mainmemory.read_u8
local weapon_use = mainmemory.read_u8
local _2nd_weapon_use = mainmemory.read_u8
local time_to_jump = mainmemory.read_u8
local GVT = gravity(0x0A31)
local fw = fast_walk(0x0A2C)
local Swd = weapon_use(0x1FB7)
local Swd2 = _2nd_weapon_use(0x1FB8)
local ttj = time_to_jump(0x0A2B)
local purp = 0xFF9900FF
local no = 0x00FFFFFF


if Swd == 0 and GVT == 2 and ttj == 6 and fw == 0 
   or Swd == 1 and GVT == 2 and ttj == 6 and fw == 0
     or Swd == 3 and GVT == 2 and ttj == 5 and fw == 0 then
gui.drawRectangle (145,8,14,15,purp)

 

end
end


--------------------------------------------------------------------------------------------------------------------------------------
--configuration (RNG_BREAKER) -"RNG_BREAKER" play numerous try and search the best platforms pattern                                 -  
Ypr = 72                      --platforms pattern is fixed by numerous conditions :                                                  -
Ypr2 = 102                    --1:frame, before the loading screen to enter in the boss's room                                       -
Ypr3 = 106                    -- 2:specific moves, when player landing you can move "right, left or not"                             -
T1 = 0                        --    and all positions (sprite attack + right move,left...) modify platform pattern!                  -  
Tc2 = 0                       --all platform patterns have a linked specificity, it can appear at different moments after            -   
RNGbreak = false              -- RNG's conditions are fixed.                                                                         -
RNGp1 = true                  --RNG_BREAKER's Tool is configured in 2 step:                                                          -
RNGp2 = false                 --1: search the best pattern and best time delay to appear (best pattern can appear 2 frames           - 
Tc = false                    --    before actual zoboner's WR and it's the only true best pattern because he appear at the same     - 
--------------------------------     moment when you can move)                                                                       -
-------------------------------- 2:search the best pattern with 15 frames delay than actual WR (15 frames because you can retry      - 
--------------------------------    and loose just 1 frame before than you enter in loading time boss's room to change RNG           -
--------------------------------      (-1 frame or +1 frame = change luck), like that you loose 1 frame but maybe than you will have -  
--------------------------------         the best pattern)                                                                           -
--------------------------------------------------------------------------------------------------------------------------------------
							  
local function RNG_BREAKER()
local section_count = mainmemory.read_u8  --sector count into level
local level_t = mainmemory.read_u8        --check level
local round_t = mainmemory.read_u8        --check round
local start_count = mainmemory.read_u8    
local PLATf_X = mainmemory.read_u8        --check X position "platform 1"
local PLATf_Y = mainmemory.read_u8        --check Y position "platform 1"
local PLATf2_X = mainmemory.read_u8       --check X position "platform 2"
local PLATf2_Y = mainmemory.read_u8       --check Y position "platform 2"
local HP_boss = mainmemory.read_u8        --check health point "boss"
local X_boss = mainmemory.read_u8         --check X position "boss"
local ATT_boss = mainmemory.read_u8       --check if boss attack
local IO_boss = mainmemory.read_u8        --check if boss's health point is open 
local Y_pos = mainmemory.read_u8          --check Y position "player"
local LV1 = level_t(0x1FC1)
local RN1 = round_t(0x1FC0)
local SC1 = section_count(0x06A1)
local Yp = Y_pos(0x0A22)
local pltx = PLATf_X(0x0EC4)
local plty = PLATf_Y(0x0EC2)
local plt2x = PLATf2_X(0x0EE4)
local plt2y = PLATf2_Y(0x0EE2)
local hpb = HP_boss(0x0B3A)
local xbss = X_boss(0x0B24)
local attb = ATT_boss(0x0B28)
local Iob = IO_boss(0x0B60)
local LAGc = emu.islagged()
local luaTR = ({["P1 Right"] = true})
local luaTL = ({["P1 Left"] = true})
local luaT1 = ({["P1 B1"] = true})
local luaT2 = ({["P1 B2"] = true})



if RNGp1 == true then                                                                                        -- "RNGp1 = true" search to obtain optimal pattern:
if LV1 == 0 and RN1 == 4 and SC1 == 11 and LAGc == true then                                                 -- 0 to 2 frames max after X position move "boss"
savestate.saveslot(8)                                                                                        
Tc = true
  
elseif T1 == 0 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 0 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 0 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 0 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 0 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 0 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 0 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 0 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 0 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 1 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 1 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 1 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 1 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 1 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 1 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 1 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 1 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 1 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 2 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 2 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 2 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 2 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 2 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 2 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 2 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 2 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 2 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 3 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 3 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 3 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 3 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 3 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 3 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 3 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 3 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 3 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 4 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 4 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 4 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 4 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 4 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 4 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 4 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 4 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 4 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 5 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 5 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 5 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 5 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 5 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 5 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 5 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 5 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 5 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 6 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 6 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 6 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 6 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 6 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 6 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 6 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 6 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 6 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 7 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 7 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 7 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 7 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 7 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 7 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 7 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 7 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 7 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 8 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 8 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 8 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 8 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 8 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 8 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 8 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or T1 == 8 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 8 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 9 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 9 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 9 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 9 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 9 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 9 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 9 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 9 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 9 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 10 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 10 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 10 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 10 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 10 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 10 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 10 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 10 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 10 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 11 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 11 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 11 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 11 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 11 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 11 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 11 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 11 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 11 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 12 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 12 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 12 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 12 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 12 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 12 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 12 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 12 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 12 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 13 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 13 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 13 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 13 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 13 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 13 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 13 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 13 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 13 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -1
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 14 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 14 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 14 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 14 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 14 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 14 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 14 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 14 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 14 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -1
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 15 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 15 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 15 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 15 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 15 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 15 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 15 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 15 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 15 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr
Ypr3 = Ypr3 +10
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 16 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 16 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 16 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 16 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 16 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 16 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 16 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 16 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 16 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +3
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 17 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 17 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 17 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 17 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 17 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 17 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 17 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 17 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 17 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +3
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 18 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 18 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 18 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 18 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 18 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 18 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 18 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 18 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 18 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 19 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 19 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 19 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 19 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 19 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 19 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 19 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 19 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 19 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 20 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 20 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 20 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 20 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 20 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 20 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 20 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 20 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 20 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 21 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 21 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 21 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 21 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 21 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 21 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 21 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 21 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 21 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 22 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 22 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 22 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 22 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 22 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 22 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 22 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 22 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 22 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +3
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 23 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 23 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 23 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 23 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 23 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 23 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 23 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 23 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 23 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 24 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 24 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 24 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 24 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 24 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 24 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 24 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 24 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 24 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 25 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 25 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 25 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 25 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 25 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 25 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 ==25 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 25 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 26 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 26 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1); joypad.set(luaTL) 
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 26 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 26 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 26 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 26 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 26 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 26 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
Ypr3 = 128
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 27 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 27 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 27 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 27 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 27 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 27 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 27 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 27 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 27 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 28 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 28 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 28 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 28 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 28 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 28 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 28 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 28 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 28 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 29 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 29 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 29 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 29 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 29 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 29 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 29 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 29 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 29 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 -1
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 30 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 30 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 30 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 30 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 30 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 30 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 30 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 30 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 30 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 -5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 31 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 31 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 31 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 31 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 31 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 31 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 31 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 31 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 31 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72 
Ypr3 = 106
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 32 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +42  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 32 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 32 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 +5 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 32 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 32 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 32 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 32 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 32 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 32 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -9
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 33 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 33 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 33 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 33 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 33 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 33 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 33 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 33 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 33 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -8
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 34 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 34 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 34 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 34 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 34 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 34 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 34 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 34 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 34 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 35 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 35 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 35 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 35 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 35 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 35 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 35 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 35 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 35 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 36 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 36 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 36 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 36 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 36 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 36 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 36 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 36 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 36 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 37 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 37 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 37 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 37 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 37 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 37 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 37 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 37 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 37 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 38 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 38 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 38 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 38 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 38 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 38 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 38 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 38 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 38 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 39 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 39 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 39 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 39 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 39 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 39 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 39 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 39 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 39 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 40 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 40 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 40 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 40 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 40 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 40 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 40 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 40 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 40 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -1
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 41 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 41 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 41 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 41 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 41 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 41 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 41 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 41 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 41 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -1
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 42 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 42 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 42 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 42 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 42 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 42 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 42 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 42 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 42 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 43 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +5 and Yp <= Ypr +8 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 43 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 43 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 43 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 43 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 43 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 43 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 43 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 43 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 44 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +6 and Yp <= Ypr +7 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 44 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 44 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 44 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 44 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 44 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 44 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 44 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 44 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3   
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 45 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 45 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 45 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 45 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 45 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 45 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 45 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 45 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3 +5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 46 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then 
joypad.set(luaT1) 
elseif T1 == 46 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 46 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 46 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 46 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 46 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 46 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 46 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3 +2 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 47 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 47 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 47 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 47 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 47 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 47 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 47 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 47 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3 +10
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 48 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 48 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 48 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 48 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 48 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 48 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 48 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 48 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3 +18
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 49 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 49 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 49 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 49 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 49 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 49 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 49 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 49 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = 106  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 50 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 50 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaT2)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 50 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 50 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 50 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 50 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 50 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 50 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
Ypr3 = Ypr3 +36
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 51 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 51 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 51 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 51 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 51 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 51 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 51 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 51 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3 -8 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 52 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 52 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 52 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 52 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 52 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 52 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 52 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 52 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = 73  
Ypr3 = Ypr3 -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 53 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp == Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 53 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp == Ypr +2 and Yp <= Ypr +3 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 53 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTL) 
elseif T1 == 53 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 53 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 53 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 53 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 53 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 53 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 53 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -1  
Ypr3 = Ypr3 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 54 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp == Ypr and Yp <= Ypr +3 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 54 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp == Ypr +4 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 54 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTL) 
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 54 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 54 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 54 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 54 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 54 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 54 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 54 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72  
Ypr3 = 106
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 55 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 55 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 55 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 55 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 55 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 55 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 55 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -9
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 56 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +72  and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 56 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 56 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 56 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 56 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 56 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 56 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -8
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 57 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +68  and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 57 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 57 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 57 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 57 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 57 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 57 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 58 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +64  and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 58 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 58 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 58 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 58 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 58 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 58 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 59 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +60  and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 59 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 59 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 59 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 59 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 59 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 59 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 60 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +56  and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 60 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 60 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 60 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 60 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 60 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 60 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 61 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +52  and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 61 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 61 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 61 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 61 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 61 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 61 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 62 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +48  and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 62 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 62 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 62 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 62 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 62 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 62 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 63 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +44  and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 63 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 63 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 63 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 63 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 63 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 63 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 64 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 64 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 64 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 64 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 64 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 64 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 64 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 65 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +36  and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 65 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 65 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 65 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 65 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 65 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 65 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 66 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +34 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 66 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 66 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 66 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 66 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 66 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 66 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 67 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +32 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 67 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 67 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 67 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 67 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 67 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 67 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 68 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 68 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +10 and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 68 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 68 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 68 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 68 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 68 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 68 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 69 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +4 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 69 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +10 and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 69 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 69 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 69 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 69 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 69 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 69 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 70 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 70 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +10 and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 70 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 70 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 70 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 70 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 70 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 70 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 71 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 71 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +5 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 71 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 71 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 71 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 71 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 71 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 71 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 72 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 72 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 72 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 72 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 72 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 72 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 72 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 72 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 73 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 73 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +8 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 73 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 73 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 73 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 73 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 73 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 73 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 74 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 74 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 74 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 74 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 74 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 74 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 74 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 74 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 75 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 75 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +5 and hpb == 255 then
joypad.set(luaTR)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 75 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 75 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 75 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 75 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 75 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 75 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 76 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 76 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 76 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +11 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 76 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 76 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 76 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 76 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 76 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 76 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
Ypr3 = 106  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 77 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +60 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 77 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 77 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 77 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 77 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 77 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 77 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 77 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 78 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +52 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 78 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 78 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 78 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 78 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 78 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 78 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 78 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 79 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +44 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 79 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 79 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 79 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 79 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 79 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 79 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 79 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 80 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 80 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 80 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 80 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 80 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 80 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 80 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 80 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 81 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 81 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 81 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 81 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 81 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 81 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 81 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 81 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 82 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 82 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 82 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 82 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 82 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 82 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 82 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 82 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 83 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 83 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 83 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 83 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 83 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 83 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 83 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 83 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 84 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +14 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 84 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 84 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 84 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 84 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 84 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 84 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 84 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 85 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 85 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 85 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 85 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 85 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 85 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 85 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 85 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 86 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 86 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 86 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 86 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 86 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 86 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 86 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 86 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 87 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +4 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 87 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 87 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 87 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 87 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 87 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 87 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 87 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 88 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 88 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 88 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 88 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 88 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 88 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 88 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 88 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 89 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 89 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 89 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 89 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 89 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 89 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 89 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 89 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 90 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 90 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 90 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 90 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 90 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 90 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 90 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 90 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 91 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 91 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 91 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 91 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 91 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 91 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 91 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 91 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 92 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 92 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 92 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 92 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 92 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 92 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 92 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 92 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 93 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 93 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +4 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 93 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 93 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 93 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 93 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 93 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 93 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 94 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 94 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 94 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 94 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 94 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 94 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 94 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 94 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 95 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 95 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +8 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 95 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 95 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 95 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 95 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 95 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 95 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 96 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 96 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +12 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 96 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 96 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 96 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 96 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 96 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 96 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 97 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 97 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 97 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 97 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 97 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 97 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 97 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 97 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
Ypr3 = 106  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 98 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +44 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 98 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 98 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 98 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)  
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 98 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 98 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 98 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 98 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 98 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 98 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 99 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 99 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 99 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 99 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 99 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 99 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 99 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 99 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 99 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 99 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 100 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 100 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 100 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 100 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 100 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 100 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 100 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 100 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 100 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 100 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 101 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +22 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 101 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 101 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 101 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 101 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 101 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 101 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 101 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 101 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 101 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 102 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 102 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 102 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 102 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 102 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 102 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 102 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 102 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 102 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 102 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 103 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +14 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 103 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 103 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 103 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 103 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 103 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 103 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 103 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 103 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 103 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 104 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 104 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 104 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 104 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 104 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 104 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 104 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 104 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 104 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 104 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 105 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +7 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 105 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 105 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 105 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 105 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 105 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 105 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 105 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 105 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 105 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 106 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +5 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 106 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 106 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 106 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 106 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 106 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 106 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 106 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 106 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 106 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 107 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 107 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 107 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 107 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 107 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 107 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 107 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 107 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 107 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 107 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 108 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 108 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 108 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 108 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 108 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 108 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 108 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 108 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 108 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 108 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 109 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 109 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 109 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 109 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 109 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 109 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 109 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 109 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 109 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 109 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 110 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 110 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +40 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 110 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +54 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 110 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 110 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 110 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 110 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 110 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 110 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 110 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 111 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 111 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +32 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 111 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 111 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 111 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 111 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 111 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 111 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 111 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 111 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 112 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 112 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +24 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 112 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 112 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 112 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 112 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 112 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 112 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 112 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 112 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 113 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 113 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +20 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 113 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 113 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 113 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 113 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 113 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 113 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 113 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 113 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 114 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 114 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +16 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 114 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 114 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 114 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 114 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 114 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 114 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 114 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 114 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 115 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR) 
elseif T1 == 115 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +12 and Yp <= Ypr +40 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 115 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 115 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTL) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 115 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 115 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 115 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 115 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 115 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 115 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 116 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +12 and hpb == 255 then
joypad.set(luaTR) 
elseif T1 == 116 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +7 and Yp <= Ypr +56 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 116 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 116 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 116 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 116 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 116 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 116 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 116 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 116 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 117 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 117 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +5 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 117 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 117 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 117 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 117 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 117 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 117 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 117 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 117 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)
  
elseif T1 == 118 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 118 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 118 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 118 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 118 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 118 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 118 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 118 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 118 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
Ypr3 = 106  
T1 = T1 +1
Tc = true
savestate.loadslot(8)


elseif T1 == 119 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 119 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 119 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 119 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)  
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 119 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 119 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 119 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 119 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 119 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 119 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 120 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 120 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 120 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 120 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 120 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 120 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 120 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 120 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 120 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 120 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 121 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +12 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 121 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 121 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 121 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 121 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 121 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 121 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 121 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 121 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 121 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 122 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +8 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 122 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 122 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 122 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 122 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 122 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 122 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 122 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 122 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 122 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 123 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 123 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 123 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 123 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 123 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 123 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 123 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 123 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 123 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 123 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 124 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +4 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 124 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 124 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 124 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 124 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 124 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 124 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 124 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 124 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 124 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 125 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 125 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 126 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 125 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 125 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 125 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 125 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 125 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 125 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 125 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 126 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 126 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 126 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 126 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 126 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 126 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 126 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 126 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 126 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 126 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 127 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 127 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 127 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 127 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 127 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 127 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 127 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 127 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 127 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 127 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 128 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 128 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +16 and Yp <= Ypr +22 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 128 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 128 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 128 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 128 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 128 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 128 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 128 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 128 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 129 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 129 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +12 and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 129 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 129 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +52 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 129 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 129 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 129 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 129 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 129 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 129 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 130 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 130 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +12 and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 130 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 130 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +60 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 130 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 130 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 130 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 130 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 130 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 130 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 131 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +10  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 131 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +12 and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 131 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 131 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +80 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 131 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 131 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 131 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 131 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 131 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 131 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 132 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 132 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +10 and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 132 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 132 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 132 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 132 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 132 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 132 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 132 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 132 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 133 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then --tu t'es stpper la
joypad.set(luaTR)
elseif T1 == 133 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 133 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 133 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTL) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 133 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 133 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 133 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 133 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 133 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 133 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 134 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 134 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +8 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 134 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 134 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 134 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 134 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 134 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 134 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 134 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 134 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 135 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 135 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +12 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 135 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 135 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 135 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 135 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 135 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 135 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 135 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 135 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 136 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 136 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 136 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 136 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 136 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 136 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 136 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 136 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 136 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 136 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 137 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 137 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 137 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 137 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 137 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 137 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 137 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 137 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 137 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 137 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 138 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 138 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 138 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 138 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 138 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saves8ot(6)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 138 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saves8ot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 138 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 138 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 138 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 138 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
Ypr3 = 106  
T1 = T1 +1
Tc = true
savestate.loadslot(8)


elseif T1 == 139 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 139 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 139 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 139 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)  
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 139 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 139 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 139 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 139 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 139 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 139 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 140 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 140 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 140 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 140 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +68 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 140 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 140 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 140 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 140 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 140 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 140 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 141 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 141 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 141 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 141 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +60 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 141 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 141 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 141 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 141 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 141 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 141 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 142 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 142 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 142 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 142 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +52 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 142 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 142 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 142 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 142 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 142 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 142 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 143 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 143 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 143 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 143 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +44 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 143 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 143 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 143 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 143 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 143 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 143 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 144 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 144 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 144 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 144 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 144 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 144 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 144 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 144 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 144 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 144 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 145 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 145 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 145 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 145 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 145 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 145 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 145 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 145 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 145 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 145 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 146 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +14 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 146 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 146 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 146 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 146 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 146 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 146 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 146 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 146 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 146 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 147 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 147 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 147 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 147 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 147 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 147 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 147 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 147 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 147 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 147 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 148 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 148 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 148 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 148 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 148 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 148 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 148 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 148 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 148 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 148 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 149 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +4 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 149 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 149 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 149 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 149 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 149 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 149 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 149 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 149 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 149 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 150 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 150 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 150 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 150 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 150 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 150 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 150 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 150 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 150 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 150 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 151 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 151 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 151 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 151 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 151 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 151 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 151 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 151 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 151 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 151 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 152 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 152 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 152 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 152 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 152 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 152 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 152 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 152 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 152 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 152 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 153 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 153 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 153 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 153 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 153 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 153 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 153 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 153 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 153 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 153 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 154 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +5 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 154 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 154 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 154 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 154 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 154 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 154 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 154 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 154 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 154 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 155 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 155 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +12 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 155 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 155 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 155 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 155 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 155 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 155 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 155 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 155 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 156 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 156 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +8 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 156 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 156 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 156 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 156 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 156 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 156 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 156 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 156 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 157 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6  and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 157 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +8 and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 157 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 157 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 157 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 157 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 157 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 157 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 157 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 157 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 158 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6  and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 158 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +7 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 158 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 158 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 158 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 158 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 158 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 158 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 158 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 158 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then
Ypr = 72
Ypr3 = 106  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 159 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +22 and hpb == 255 then     
joypad.set(luaTR)
elseif T1 == 159 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 159 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL)   
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 159 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 159 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 159 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 159 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 159 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 159 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 160 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR) 
elseif T1 == 160 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 160 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 160 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 160 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 160 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 160 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 160 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 160 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 161 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +14 and hpb == 255 then
joypad.set(luaTR) 
elseif T1 == 161 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 161 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL)  
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 161 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 161 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 161 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 161 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 161 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 161 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 162 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 162 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 162 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL) 
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 162 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 162 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 162 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 162 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 162 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 162 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 163 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 163 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 163 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL) 
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 163 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 163 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 163 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 163 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 163 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 163 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 164 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +4 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 164 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 164 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL)  
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 164 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 164 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 164 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 164 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 164 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 164 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 165 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 165 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 165 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL) 
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 165 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 165 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 165 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 165 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 165 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 165 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 166 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 166 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 166 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL) 
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 166 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 166 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 166 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 166 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 166 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 166 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 167 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 167 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +34 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 167 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL) 
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 167 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 167 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 167 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 167 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 167 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 167 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 168 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +5 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 168 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +6 and Yp <= Ypr +8 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 168 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 168 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL) 
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 168 and Iob == 255 and xbss >= 219 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 168 and Iob == 255 and xbss >= 187 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 168 and Iob == 255 and xbss == 219 and pltx > 96 and pltx < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 168 and Iob == 255 and xbss == 219 and pltx < 96 and pltx >= 0
      or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 168 and Iob == 255 and xbss == 187 and plt2x > 48 and plt2x < 250 
  or LV1 == 0 and RN1 == 4 and SC1 == 11 and T1 == 168 and Iob == 255 and xbss == 187 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)


 elseif T1 == 168 and RNGp2 == false then                                                    --if after search and no match found with "RNGp1": break "RNGp1" an start "RNGp2"
RNGp1 = false ; RNGp2 = true                                                                 --"RNGp2" = 80% match, but platforms start to move more later than "RNGp1"  
end                                                                                          --conclusion: not best pattern due to add delay


if RNGbreak == true then                                                                    --print message if "RNGp1" match
gui.drawText(17,100,'RNG IS BREAKED and SAVED on SAVE STATE 8',0xFF00CC00,0xFF000000,9,bold) 
gui.drawText(87,110,'MOVIE is STOPPED',0xFF00CC00,0xFF000000,9,bold) 
movie.stop()

elseif Tc == true then                                                                       --print try count 
Tc2 = Tc2 +1
Tc = false
elseif Tc2 == 1 then
gui.drawText(174,-3,'tr = 1',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 2 then
gui.drawText(174,-3,'tr = 2',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 3 then
gui.drawText(174,-3,'tr = 3',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 4 then
gui.drawText(174,-3,'tr = 4',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 5 then
gui.drawText(174,-3,'tr = 5',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 6 then
gui.drawText(174,-3,'tr = 6',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 7 then
gui.drawText(174,-3,'tr = 7',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 8 then
gui.drawText(174,-3,'tr = 8',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 9 then
gui.drawText(174,-3,'tr = 9',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 10 then
gui.drawText(174,-3,'tr = 10',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 11 then
gui.drawText(174,-3,'tr = 11',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 12 then
gui.drawText(174,-3,'tr = 12',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 13 then
gui.drawText(174,-3,'tr = 13',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 14 then
gui.drawText(174,-3,'tr = 14',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 15 then
gui.drawText(174,-3,'tr = 15',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 16 then
gui.drawText(174,-3,'tr = 16',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 17 then
gui.drawText(174,-3,'tr = 17',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 18 then
gui.drawText(174,-3,'tr = 18',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 19 then
gui.drawText(174,-3,'tr = 19',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 20 then
gui.drawText(174,-3,'tr = 20',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 21 then
gui.drawText(174,-3,'tr = 21',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 22 then
gui.drawText(174,-3,'tr = 22',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 23 then
gui.drawText(174,-3,'tr = 23',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 24 then
gui.drawText(174,-3,'tr = 24',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 25 then
gui.drawText(174,-3,'tr = 25',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 26 then
gui.drawText(174,-3,'tr = 26',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 27 then
gui.drawText(174,-3,'tr = 27',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 28 then
gui.drawText(174,-3,'tr = 28',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 29 then
gui.drawText(174,-3,'tr = 29',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 30 then
gui.drawText(174,-3,'tr = 30',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 31 then
gui.drawText(174,-3,'tr = 31',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 32 then
gui.drawText(174,-3,'tr = 32',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 33 then
gui.drawText(174,-3,'tr = 33',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 34 then
gui.drawText(174,-3,'tr = 34',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 35 then
gui.drawText(174,-3,'tr = 35',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 36 then
gui.drawText(174,-3,'tr = 36',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 37 then
gui.drawText(174,-3,'tr = 37',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 38 then
gui.drawText(174,-3,'tr = 38',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 39 then
gui.drawText(174,-3,'tr = 39',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 40 then
gui.drawText(174,-3,'tr = 40',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 41 then
gui.drawText(174,-3,'tr = 41',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 42 then
gui.drawText(174,-3,'tr = 42',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 43 then
gui.drawText(174,-3,'tr = 43',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 44 then
gui.drawText(174,-3,'tr = 44',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 45 then
gui.drawText(174,-3,'tr = 45',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 46 then
gui.drawText(174,-3,'tr = 46',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 47 then
gui.drawText(174,-3,'tr = 47',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 48 then
gui.drawText(174,-3,'tr = 48',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 49 then
gui.drawText(174,-3,'tr = 49',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 50 then
gui.drawText(174,-3,'tr = 50',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 51 then
gui.drawText(174,-3,'tr = 51',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 52 then
gui.drawText(174,-3,'tr = 52',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 53 then
gui.drawText(174,-3,'tr = 53',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 54 then
gui.drawText(174,-3,'tr = 54',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 55 then
gui.drawText(174,-3,'tr = 55',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 56 then
gui.drawText(174,-3,'tr = 56',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 57 then
gui.drawText(174,-3,'tr = 57',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 58 then
gui.drawText(174,-3,'tr = 58',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 59 then
gui.drawText(174,-3,'tr = 59',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 60 then
gui.drawText(174,-3,'tr = 60',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 61 then
gui.drawText(174,-3,'tr = 61',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 62 then
gui.drawText(174,-3,'tr = 62',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 63 then
gui.drawText(174,-3,'tr = 63',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 64 then
gui.drawText(174,-3,'tr = 64',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 65 then
gui.drawText(174,-3,'tr = 65',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 66 then
gui.drawText(174,-3,'tr = 66',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 67 then
gui.drawText(174,-3,'tr = 67',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 68 then
gui.drawText(174,-3,'tr = 68',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 69 then
gui.drawText(174,-3,'tr = 69',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 70 then
gui.drawText(174,-3,'tr = 70',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 71 then
gui.drawText(174,-3,'tr = 71',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 72 then
gui.drawText(174,-3,'tr = 72',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 73 then
gui.drawText(174,-3,'tr = 73',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 74 then
gui.drawText(174,-3,'tr = 74',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 75 then
gui.drawText(174,-3,'tr = 75',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 76 then
gui.drawText(174,-3,'tr = 76',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 77 then
gui.drawText(174,-3,'tr = 77',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 78 then
gui.drawText(174,-3,'tr = 78',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 79 then
gui.drawText(174,-3,'tr = 79',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 80 then
gui.drawText(174,-3,'tr = 80',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 81 then
gui.drawText(174,-3,'tr = 81',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 82 then
gui.drawText(174,-3,'tr = 82',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 83 then
gui.drawText(174,-3,'tr = 83',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 84 then
gui.drawText(174,-3,'tr = 84',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 85 then
gui.drawText(174,-3,'tr = 85',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 86 then
gui.drawText(174,-3,'tr = 86',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 87 then
gui.drawText(174,-3,'tr = 87',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 88 then
gui.drawText(174,-3,'tr = 88',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 89 then
gui.drawText(174,-3,'tr = 89',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 90 then
gui.drawText(174,-3,'tr = 90',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 91 then
gui.drawText(174,-3,'tr = 91',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 92 then
gui.drawText(174,-3,'tr = 92',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 93 then
gui.drawText(174,-3,'tr = 93',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 94 then
gui.drawText(174,-3,'tr = 94',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 95 then
gui.drawText(174,-3,'tr = 95',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 96 then
gui.drawText(174,-3,'tr = 96',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 97 then
gui.drawText(174,-3,'tr = 97',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 98 then
gui.drawText(174,-3,'tr = 98',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 99 then
gui.drawText(174,-3,'tr = 99',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 100 then
gui.drawText(174,-3,'tr = 100',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 101 then
gui.drawText(174,-3,'tr = 101',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 102 then
gui.drawText(174,-3,'tr = 102',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 103 then
gui.drawText(174,-3,'tr = 103',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 104 then
gui.drawText(174,-3,'tr = 104',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 105 then
gui.drawText(174,-3,'tr = 105',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 106 then
gui.drawText(174,-3,'tr = 106',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 107 then
gui.drawText(174,-3,'tr = 107',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 108 then
gui.drawText(174,-3,'tr = 108',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 109 then
gui.drawText(174,-3,'tr = 109',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 110 then
gui.drawText(174,-3,'tr = 110',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 111 then
gui.drawText(174,-3,'tr = 111',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 112 then
gui.drawText(174,-3,'tr = 112',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 113 then
gui.drawText(174,-3,'tr = 113',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 114 then
gui.drawText(174,-3,'tr = 114',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 115 then
gui.drawText(174,-3,'tr = 115',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 116 then
gui.drawText(174,-3,'tr = 116',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 117 then
gui.drawText(174,-3,'tr = 117',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 118 then
gui.drawText(174,-3,'tr = 118',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 119 then
gui.drawText(174,-3,'tr = 119',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 120 then
gui.drawText(174,-3,'tr = 120',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 121 then
gui.drawText(174,-3,'tr = 121',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 122 then
gui.drawText(174,-3,'tr = 122',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 123 then
gui.drawText(174,-3,'tr = 123',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 124 then
gui.drawText(174,-3,'tr = 124',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 125 then
gui.drawText(174,-3,'tr = 125',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 126 then
gui.drawText(174,-3,'tr = 126',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 127 then
gui.drawText(174,-3,'tr = 127',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 128 then
gui.drawText(174,-3,'tr = 128',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 129 then
gui.drawText(174,-3,'tr = 129',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 130 then
gui.drawText(174,-3,'tr = 130',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 131 then
gui.drawText(174,-3,'tr = 131',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 132 then
gui.drawText(174,-3,'tr = 132',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 133 then
gui.drawText(174,-3,'tr = 133',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 134 then
gui.drawText(174,-3,'tr = 134',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 135 then
gui.drawText(174,-3,'tr = 135',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 136 then
gui.drawText(174,-3,'tr = 136',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 137 then
gui.drawText(174,-3,'tr = 137',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 138 then
gui.drawText(174,-3,'tr = 138',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 139 then
gui.drawText(174,-3,'tr = 139',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 140 then
gui.drawText(174,-3,'tr = 140',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 141 then
gui.drawText(174,-3,'tr = 141',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 142 then
gui.drawText(174,-3,'tr = 142',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 143 then
gui.drawText(174,-3,'tr = 143',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 144 then
gui.drawText(174,-3,'tr = 144',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 145 then
gui.drawText(174,-3,'tr = 145',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 146 then
gui.drawText(174,-3,'tr = 146',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 147 then
gui.drawText(174,-3,'tr = 147',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 148 then
gui.drawText(174,-3,'tr = 148',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 149 then
gui.drawText(174,-3,'tr = 149',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 150 then
gui.drawText(174,-3,'tr = 150',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 151 then
gui.drawText(174,-3,'tr = 151',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 152 then
gui.drawText(174,-3,'tr = 152',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 153 then
gui.drawText(174,-3,'tr = 153',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 154 then
gui.drawText(174,-3,'tr = 154',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 155 then
gui.drawText(174,-3,'tr = 155',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 156 then
gui.drawText(174,-3,'tr = 156',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 157 then
gui.drawText(174,-3,'tr = 157',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 158 then
gui.drawText(174,-3,'tr = 158',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 159 then
gui.drawText(174,-3,'tr = 159',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 160 then
gui.drawText(174,-3,'tr = 160',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 161 then
gui.drawText(174,-3,'tr = 161',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 162 then
gui.drawText(174,-3,'tr = 162',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 163 then
gui.drawText(174,-3,'tr = 163',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 164 then
gui.drawText(174,-3,'tr = 164',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 165 then
gui.drawText(174,-3,'tr = 165',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 166 then
gui.drawText(174,-3,'tr = 166',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 167 then
gui.drawText(174,-3,'tr = 167',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 168 then
gui.drawText(174,-3,'tr = 168',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 169 then
gui.drawText(174,-3,'tr = 169',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 170 then
gui.drawText(174,-3,'tr = 170',0xFFFF00CC,0xFF000000,9,bold)


end
end


if RNGp2 == true then                                                                                        --alternative pattern "add delay" 
if T1 == 168 then                                                                                            --"RNGp2" start and reinitialize try count
  T1 = T1 -168 ; Tc2 = 1
  end
  if LV1 == 0 and RN1 == 4 and SC1 == 11 and LAGc == true then
savestate.saveslot(8)
Tc = true

elseif T1 == 0 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 0 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 0 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 0 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                  
elseif T1 == 0 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 0 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 0 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 0 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 0 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 1 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 1 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 1 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 1 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                  
elseif T1 == 1 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 1 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 1 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 1 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 1 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 2 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 2 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 2 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 2 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                  
elseif T1 == 2 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 2 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 2 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 2 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 2 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 3 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 3 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 3 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 3 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                  
elseif T1 == 3 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 3 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 3 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 3 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 3 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 4 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 4 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 4 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 4 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                  
elseif T1 == 4 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 4 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 4 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 4 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 4 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 5 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 5 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 5 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 5 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                  
elseif T1 == 5 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 5 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 5 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 5 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 5 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 6 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 6 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 6 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 6 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                  
elseif T1 == 6 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 6 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 6 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 6 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 6 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 7 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 7 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 7 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 7 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                  
elseif T1 == 7 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 7 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 7 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 7 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 7 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 8 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 8 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 8 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 8 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                  
elseif T1 == 8 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 8 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 8 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 8 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 8 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 9 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 9 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 9 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 9 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                  
elseif T1 == 9 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 9 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 9 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 9 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 9 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 10 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 10 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 10 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 10 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 10 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 10 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 10 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 10 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 10 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 11 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 11 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 11 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 11 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 11 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 11 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 11 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 11 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 11 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 12 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 12 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 12 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 12 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 12 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 12 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 12 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 12 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 12 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 13 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 13 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 13 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 13 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 13 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 13 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 13 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 13 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 13 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -1
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 14 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 14 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +4 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 14 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 14 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 14 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 14 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 14 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 14 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 14 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -1
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 15 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 15 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 15 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 15 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 15 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 15 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 15 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 15 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 15 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr
Ypr3 = Ypr3 +10
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 16 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 16 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 16 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 16 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 16 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 16 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 16 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 16 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 16 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +3
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 17 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 17 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 17 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 17 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 17 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 17 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 17 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 17 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 17 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +3
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 18 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 18 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 18 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 18 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 18 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 18 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 18 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 18 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 18 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 19 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 19 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 19 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 19 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 19 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 19 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 19 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 19 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 19 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 20 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 20 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 20 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 20 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 20 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 20 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 20 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 20 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 20 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 21 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 21 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 21 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 21 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 21 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 21 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 21 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 21 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 21 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 22 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 22 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 22 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 22 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 22 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 22 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 22 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 22 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 22 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +3
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 23 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 23 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 23 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 23 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 23 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 23 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 23 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 23 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 23 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 24 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +30  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 24 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 24 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 24 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 24 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 24 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 24 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 24 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 24 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 +4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 25 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 25 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 25 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 25 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 25 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 25 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 ==25  and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 25 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 26 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 26 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1); joypad.set(luaTL) 
elseif T1 == 26 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 26 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 26 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 26 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 26 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 26 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
Ypr3 = 128
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 27 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 27 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 27 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 27 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 27 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 27 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 27 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 27 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 27 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 28 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 28 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 28 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 28 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 28 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 28 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 28 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 28 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 28 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 29 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 29 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 29 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 29 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 29 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 29 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 29 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 29 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 29 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 -1
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 30 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 30 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 30 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 30 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 30 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 30 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 30 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 30 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 30 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
Ypr3 = Ypr3 -5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 31 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 31 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 and Yp <= Ypr2 +2 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 31 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 31 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 31 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 31 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 31 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 31 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 31 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72 
Ypr3 = 106
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 32 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +42  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 32 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 32 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 +5 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 32 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 32 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 32 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 32 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 32 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 32 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -9
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 33 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 33 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 33 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 33 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 33 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 33 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 33 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 33 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 33 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -8
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 34 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 34 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 34 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 34 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 34 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 34 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 34 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 34 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 34 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 35 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 35 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 35 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 35 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 35 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 35 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 35 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 35 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 35 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 36 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 36 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 36 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 36 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 36 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 36 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 36 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 36 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 36 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 37 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 37 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 37 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 37 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 37 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 37 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 37 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 37 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 37 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 38 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 38 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 38 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 38 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 38 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 38 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 38 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 38 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 38 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 39 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 39 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 39 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 39 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 39 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 39 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 39 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 39 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 39 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 40 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 40 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 40 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 40 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 40 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 40 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 40 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 40 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 40 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -1
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 41 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 41 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 41 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 41 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 41 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 41 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 41 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 41 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 41 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -1
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 42 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 42 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 42 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 42 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                        
elseif T1 == 42 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 42 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 42 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 42 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 42 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 43 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +5 and Yp <= Ypr +8 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 43 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 43 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 43 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 43 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 43 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 43 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 43 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 43 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 44 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +6 and Yp <= Ypr +7 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 44 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 44 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 44 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 44 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 44 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 44 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 44 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 44 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3   
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 45 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTR)
elseif T1 == 45 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 45 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 45 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 45 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 45 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 45 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 45 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3 +5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 46 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then 
joypad.set(luaT1) 
elseif T1 == 46 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 46 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 46 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 46 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 46 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 46 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 46 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3 +2 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 47 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 47 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 47 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 47 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 47 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 47 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 47 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 47 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3 +10
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 48 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 48 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 48 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 48 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 48 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 48 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 48 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 48 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3 +18
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 49 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 49 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 49 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                     
elseif T1 == 49 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 49 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 49 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 49 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 49 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = 106  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 50 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 50 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaT2)
elseif T1 == 50 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 50 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 50 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 50 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 50 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 50 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3 +36
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 51 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 51 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 51 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 51 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 51 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 51 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 51 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 51 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr3 = Ypr3 -8 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 52 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 52 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 52 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 52 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 52 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 52 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 52 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 52 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 73  
Ypr3 = Ypr3 -2
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 53 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp == Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 53 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp == Ypr +2 and Yp <= Ypr +3 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 53 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTL) 
elseif T1 == 53 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 53 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 53 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 53 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 53 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 53 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 53 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -1  
Ypr3 = Ypr3 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 54 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp == Ypr and Yp <= Ypr +3 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 54 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp == Ypr +4 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 54 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr2 +19 and Yp <= Ypr2 +26 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTL) 
elseif T1 == 54 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr3 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 54 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 54 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 54 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 54 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 54 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 54 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72  
Ypr3 = 106
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 55 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 55 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 55 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 55 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 55 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 55 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 55 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -9
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 56 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +72  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 56 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 56 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 56 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 56 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 56 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 56 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -8
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 57 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +68  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 57 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 57 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 57 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 57 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 57 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 57 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -5
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 58 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +64  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 58 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 58 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 58 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 58 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 58 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 58 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 59 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +60  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 59 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 59 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 59 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 59 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 59 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 59 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr -4
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 60 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +56  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 60 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 60 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 60 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 60 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 60 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 60 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 61 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +52  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 61 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 61 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 61 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 61 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 61 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 61 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 62 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +48  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 62 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 62 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 62 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 62 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 62 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 62 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 63 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +44  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 63 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 63 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 63 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 63 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 63 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 63 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 64 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +40  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 64 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 64 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 64 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 64 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 64 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 64 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 65 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +36  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 65 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 65 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 65 and Iob == 255 and xbss < 173 and pltx > 9 and pltx < 250 
    or T1 == 65 and Iob == 255 and xbss < 173 and pltx < 9 and pltx >= 0
    or T1 == 65 and Iob == 255 and xbss < 173 and plt2x > 8 and plt2x < 250 
    or T1 == 65 and Iob == 255 and xbss < 173 and plt2x < 8 and plt2x >= 0 then 
Ypr = Ypr
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 66 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +34 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 66 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 66 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 66 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 66 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 66 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 66 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = Ypr 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 67 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +32 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 67 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 67 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 67 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 67 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 67 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 67 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 68 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 68 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +10 and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 68 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 68 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 68 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 68 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 68 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 68 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 69 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +4 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 69 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +10 and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 69 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 69 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 69 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 69 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 69 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 69 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 70 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 70 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +10 and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 70 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 70 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 70 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 70 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 70 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 70 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 71 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 71 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +5 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 71 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 71 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 71 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 71 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 71 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 71 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 72 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 72 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 72 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 72 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 72 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 72 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 72 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 72 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 73 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 73 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +8 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 73 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 73 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 73 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 73 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 73 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 73 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 74 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 74 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 74 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 74 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 74 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 74 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 74 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 74 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 75 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 75 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +5 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 75 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 75 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 75 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 75 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 75 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 75 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 76 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 76 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 76 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +11 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTL)
elseif T1 == 76 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 76 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 76 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 76 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 76 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 76 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
Ypr3 = 106  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 77 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +60 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 77 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 77 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 77 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 77 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 77 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 77 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 77 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 78 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +52 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 78 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 78 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 78 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 78 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 78 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 78 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 78 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 79 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +44 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 79 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 79 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 79 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 79 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 79 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 79 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 79 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 80 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 80 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 80 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 80 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 80 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 80 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 80 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 80 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 81 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 81 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 81 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 81 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 81 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 81 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 81 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 81 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 82 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 82 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 82 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 82 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 82 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 82 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 82 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 82 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 83 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 83 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 83 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 83 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 83 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 83 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 83 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 83 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 84 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +14 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 84 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 84 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 84 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 84 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 84 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 84 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 84 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 85 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 85 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 85 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 85 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 85 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 85 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 85 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 85 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 86 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 86 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 86 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 86 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 86 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 86 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 86 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 86 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 87 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +4 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 87 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 87 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 87 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 87 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 87 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 87 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 87 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 88 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 88 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 88 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 88 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 88 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 88 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 88 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 88 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 89 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 89 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 89 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 89 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 89 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 89 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 89 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 89 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 90 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 90 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 90 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 90 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 90 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 90 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 90 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 90 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 91 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 91 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 91 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 91 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 91 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 91 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 91 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 91 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 92 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 92 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +64 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 92 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 92 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 92 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 92 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 92 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 92 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 93 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 93 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +4 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 93 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 93 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 93 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 93 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 93 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 93 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 94 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 94 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 94 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 94 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 94 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 94 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 94 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 94 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 95 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 95 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +8 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 95 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 95 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 95 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 95 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 95 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 95 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 96 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 96 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +12 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 96 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 96 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 96 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 96 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 96 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 96 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 97 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +1 and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 97 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 97 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 97 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 97 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 97 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 97 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 97 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
Ypr3 = 106  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 98 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +44 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 98 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 98 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 98 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)  
elseif T1 == 98 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 98 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 98 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 98 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 98 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 98 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 99 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 99 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 99 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 99 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 99 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                   
elseif T1 == 99 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 99 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 99 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 99 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 99 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 100 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 100 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 100 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 100 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 100 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 100 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 100 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 100 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 100 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 100 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 101 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +22 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 101 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 101 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 101 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 101 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 101 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 101 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 101 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 101 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 101 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 102 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 102 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 102 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 102 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 102 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 102 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 102 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 102 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 102 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 102 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 103 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +14 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 103 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 103 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 103 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 103 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 103 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 103 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 103 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 103 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 103 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 104 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 104 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 104 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 104 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 104 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 104 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 104 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 104 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 104 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 104 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 105 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +7 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 105 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 105 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 105 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 105 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 105 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 105 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 105 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 105 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 105 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 106 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +5 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 106 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 106 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 106 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 106 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 106 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 106 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 106 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 106 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 106 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 107 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 107 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 107 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 107 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 107 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 107 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 107 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 107 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 107 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 107 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 108 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 108 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 108 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 108 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 108 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 108 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 108 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 108 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 108 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 108 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 109 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 109 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +48 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 109 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 109 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 109 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 109 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 109 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 109 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 109 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 109 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 110 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 110 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +40 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 110 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +54 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 110 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and Yp <= Ypr +64 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 110 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 110 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 110 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 110 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 110 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 110 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 111 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 111 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +32 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 111 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 111 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 111 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 111 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 111 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 111 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 111 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 111 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 112 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 112 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +24 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 112 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 112 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 112 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 112 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 112 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 112 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 112 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 112 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 113 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 113 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +20 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 113 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 113 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 113 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 113 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 113 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 113 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 113 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 113 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 114 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 114 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +16 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 114 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 114 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 114 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 114 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 114 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 114 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 114 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 114 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 115 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR) 
elseif T1 == 115 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +12 and Yp <= Ypr +40 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 115 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 115 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaTL) ; joypad.set(luaT1)
elseif T1 == 115 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 115 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 115 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 115 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 115 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 115 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 116 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +12 and hpb == 255 then
joypad.set(luaTR) 
elseif T1 == 116 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +7 and Yp <= Ypr +56 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 116 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 116 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 116 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 116 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 116 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 116 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 116 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 116 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 117 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 117 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +5 and Yp <= Ypr +48 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 117 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 117 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 117 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 117 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 117 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 117 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 117 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 117 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)
  
elseif T1 == 118 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 118 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +52 and Yp <= Ypr +54 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 118 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +54 and hpb == 255 then
joypad.set(luaT1) ; joypad.set(luaTL)
elseif T1 == 118 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 118 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 118 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 118 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 118 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 118 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
Ypr3 = 106  
T1 = T1 +1
Tc = true
savestate.loadslot(8)


elseif T1 == 119 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 119 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 119 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 119 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)  
elseif T1 == 119 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 119 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 119 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 119 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 119 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 119 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 120 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 120 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 120 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 120 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 120 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 120 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 120 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 120 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 120 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 120 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 121 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +12 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 121 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 121 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 121 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 121 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 121 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 121 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 121 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 121 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 121 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 122 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +8 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 122 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 122 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 122 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 122 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 122 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 122 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 122 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 122 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 122 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 123 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 123 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 123 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 123 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 123 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 123 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 123 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 123 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 123 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 123 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 124 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +4 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 124 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 124 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 124 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 124 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 124 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 124 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 124 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 124 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 124 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 125 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 125 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 125 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 125 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 125 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                      
elseif T1 == 125 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 125 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 125 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 125 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 125 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 126 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 126 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 126 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 126 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 126 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 126 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 126 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 126 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 126 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 126 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 127 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 127 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +22 and Yp <= Ypr +28 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 127 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 127 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 127 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                      
elseif T1 == 127 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 127 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 127 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 127 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 127 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 128 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 128 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +16 and Yp <= Ypr +22 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 128 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 128 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 128 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 128 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 128 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 128 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 128 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 128 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 129 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 129 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +12 and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 129 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 129 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +52 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 129 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 129 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 129 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 129 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 129 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 129 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 130 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 130 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +12 and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 130 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 130 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +60 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 130 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 130 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 130 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 130 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 130 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 130 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 131 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +2 and Yp <= Ypr +10  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 131 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +12 and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 131 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 131 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +80 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 131 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 131 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 131 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 131 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 131 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 131 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 132 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 132 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +10 and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 132 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 132 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 132 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 132 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 132 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 132 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 132 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 132 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 133 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then --tu t'es stpper la
joypad.set(luaTR)
elseif T1 == 133 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 133 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 133 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTL) ; joypad.set(luaT1)
elseif T1 == 133 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 133 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 133 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 133 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 133 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 133 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 134 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 134 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +8 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 134 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 134 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 134 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 134 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 134 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 134 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 134 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 134 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 135 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 135 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +12 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 135 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 135 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 135 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 135 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 135 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 135 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 135 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 135 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 136 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 136 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 136 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 136 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 136 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 136 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 136 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 136 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 136 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 136 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 137 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 137 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 137 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 137 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 137 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 137 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 137 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 137 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 137 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 137 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 138 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 138 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 138 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +28 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 138 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +72 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 138 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 138 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 138 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 138 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 138 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 138 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
Ypr3 = 106  
T1 = T1 +1
Tc = true
savestate.loadslot(8)


elseif T1 == 139 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 139 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 139 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 139 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)  
elseif T1 == 139 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 139 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 139 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 139 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 139 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 139 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 140 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 140 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 140 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 140 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +68 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 140 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 140 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 140 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 140 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 140 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 140 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 141 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 141 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 141 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 141 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +60 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 141 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 141 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 141 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 141 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 141 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 141 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 142 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 142 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 142 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 142 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +52 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 142 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 142 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 142 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 142 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 142 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 142 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 143 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 143 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 143 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 143 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +44 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 143 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 143 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 143 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 143 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 143 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 143 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 144 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 144 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 144 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 144 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +36 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 144 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 144 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 144 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 144 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 144 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 144 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 145 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +16 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 145 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 145 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 145 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 145 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 145 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 145 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 145 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 145 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 145 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 146 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +14 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 146 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 146 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 146 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 146 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 146 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 146 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 146 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 146 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 146 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 147 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 147 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 147 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 147 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 147 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 147 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 147 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 147 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 147 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 147 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 148 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 148 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 148 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 148 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 148 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 148 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 148 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 148 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 148 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 148 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 149 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +4 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 149 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 149 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 149 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 149 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 149 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 149 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 149 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 149 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 149 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 150 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 150 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 150 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 150 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 150 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 150 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 150 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 150 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 150 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 150 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 151 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1  and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 151 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 151 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 151 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 151 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 151 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 151 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 151 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 151 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 151 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 152 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 152 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 152 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 152 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 152 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 152 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 152 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 152 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 152 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 152 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 153 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 153 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 153 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 153 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 153 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 153 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 153 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 153 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 153 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 153 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 154 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +5 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 154 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +18 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 154 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 154 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 154 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.savlot(6)                      
elseif T1 == 154 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 154 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 154 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 154 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 154 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 155 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 155 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +12 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 155 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 155 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 155 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 155 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 155 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 155 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 155 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 155 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 156 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 156 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +8 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 156 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 156 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 156 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 156 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 156 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 156 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 156 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 156 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = tru
savestate.loadslot(8)

elseif T1 == 157 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6  and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 157 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +8 and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 157 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 157 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 157 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 157 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 157 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 157 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 157 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 157 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 158 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +6  and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 158 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +7 and Yp <= Ypr +20 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 158 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +20 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 158 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +30 and Yp <= Ypr +30 and hpb == 255 then
joypad.set(luaTR) ; joypad.set(luaT1)
elseif T1 == 158 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 158 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 158 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 158 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 158 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 158 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
Ypr = 72
Ypr3 = 106  
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 159 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +22 and hpb == 255 then     
joypad.set(luaTR)
elseif T1 == 159 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 159 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL)   
elseif T1 == 159 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 159 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 159 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 159 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 159 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 159 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 160 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +18 and hpb == 255 then
joypad.set(luaTR) 
elseif T1 == 160 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 160 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 160 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 160 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 160 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 160 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 160 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 160 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 161 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +14 and hpb == 255 then
joypad.set(luaTR) 
elseif T1 == 161 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 161 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL)  
elseif T1 == 161 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 161 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 161 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 161 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 161 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 161 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 162 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +10 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 162 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 162 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 162 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 162 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 162 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 162 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 162 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 162 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 163 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +6 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 163 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 163 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 163 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 163 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 163 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 163 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 163 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 163 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 164 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +4 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 164 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 164 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL)  
elseif T1 == 164 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 164 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 164 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 164 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 164 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 164 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 165 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +2 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 165 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 165 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 165 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 165 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 165 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 165 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 165 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 165 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 166 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr +1 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 166 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 166 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 166 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 166 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 166 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 166 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 166 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 166 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 167 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr and Yp <= Ypr and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 167 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +34 and hpb == 255 then
joypad.set(luaT1) 
elseif T1 == 167 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 167 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)                    
elseif T1 == 167 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 167 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 167 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 167 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 167 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)

elseif T1 == 168 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +3 and Yp <= Ypr +5 and hpb == 255 then
joypad.set(luaTL)
elseif T1 == 168 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +6 and Yp <= Ypr +8 and hpb == 255 then
joypad.set(luaTR)
elseif T1 == 168 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp > Ypr +22 and Yp <= Ypr +24 and hpb == 255 then
joypad.set(luaT1)
elseif T1 == 168 and LV1 == 0 and RN1 == 4 and SC1 == 11 and Yp >= Ypr +24 and Yp <= Ypr +80 and hpb == 255 then
joypad.set(luaTL) 
elseif T1 == 168 and Iob == 255 and xbss <230 and xbss >173 and pltx == 96 and plty == 47 then
savestate.saveslot(7)
elseif T1 == 168 and Iob == 255 and xbss <230 and xbss >173 and plt2x == 48 and plt2y == 47 then
savestate.saveslot(8); RNGbreak = true ; Tc = false
elseif T1 == 168 and Iob == 255 and xbss < 173 and pltx > 96 and pltx < 250 
    or T1 == 168 and Iob == 255 and xbss < 173 and pltx < 96 and pltx >= 0
    or T1 == 168 and Iob == 255 and xbss < 173 and plt2x > 48 and plt2x < 250 
    or T1 == 168 and Iob == 255 and xbss < 173 and plt2x < 48 and plt2x >= 0 then 
T1 = T1 +1
Tc = true
savestate.loadslot(8)
end

if RNGbreak == true then                                                                     --print massage if "RNGp2" match and stop movie
gui.drawText(15,100,'RNG IS BREACKED and SAVED on SAVE STATE 8',0xFF00CC00,0xFF000000,9,bold) 
gui.drawText(85,110,'MOVIE is STOPPED',0xFF00CC00,0xFF000000,9,bold) 
movie.stop()

elseif Tc == true then                                                                        --print try count
Tc2 = Tc2 +1
Tc = false
elseif Tc2 == 1 then
gui.drawText(174,-3,'tr = 1',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 2 then
gui.drawText(174,-3,'tr = 2',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 3 then
gui.drawText(174,-3,'tr = 3',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 4 then
gui.drawText(174,-3,'tr = 4',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 5 then
gui.drawText(174,-3,'tr = 5',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 6 then
gui.drawText(174,-3,'tr = 6',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 7 then
gui.drawText(174,-3,'tr = 7',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 8 then
gui.drawText(174,-3,'tr = 8',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 9 then
gui.drawText(174,-3,'tr = 9',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 10 then
gui.drawText(174,-3,'tr = 10',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 11 then
gui.drawText(174,-3,'tr = 11',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 12 then
gui.drawText(174,-3,'tr = 12',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 13 then
gui.drawText(174,-3,'tr = 13',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 14 then
gui.drawText(174,-3,'tr = 14',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 15 then
gui.drawText(174,-3,'tr = 15',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 16 then
gui.drawText(174,-3,'tr = 16',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 17 then
gui.drawText(174,-3,'tr = 17',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 18 then
gui.drawText(174,-3,'tr = 18',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 19 then
gui.drawText(174,-3,'tr = 19',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 20 then
gui.drawText(174,-3,'tr = 20',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 21 then
gui.drawText(174,-3,'tr = 21',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 22 then
gui.drawText(174,-3,'tr = 22',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 23 then
gui.drawText(174,-3,'tr = 23',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 24 then
gui.drawText(174,-3,'tr = 24',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 25 then
gui.drawText(174,-3,'tr = 25',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 26 then
gui.drawText(174,-3,'tr = 26',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 27 then
gui.drawText(174,-3,'tr = 27',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 28 then
gui.drawText(174,-3,'tr = 28',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 29 then
gui.drawText(174,-3,'tr = 29',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 30 then
gui.drawText(174,-3,'tr = 30',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 31 then
gui.drawText(174,-3,'tr = 31',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 32 then
gui.drawText(174,-3,'tr = 32',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 33 then
gui.drawText(174,-3,'tr = 33',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 34 then
gui.drawText(174,-3,'tr = 34',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 35 then
gui.drawText(174,-3,'tr = 35',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 36 then
gui.drawText(174,-3,'tr = 36',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 37 then
gui.drawText(174,-3,'tr = 37',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 38 then
gui.drawText(174,-3,'tr = 38',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 39 then
gui.drawText(174,-3,'tr = 39',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 40 then
gui.drawText(174,-3,'tr = 40',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 41 then
gui.drawText(174,-3,'tr = 41',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 42 then
gui.drawText(174,-3,'tr = 42',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 43 then
gui.drawText(174,-3,'tr = 43',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 44 then
gui.drawText(174,-3,'tr = 44',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 45 then
gui.drawText(174,-3,'tr = 45',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 46 then
gui.drawText(174,-3,'tr = 46',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 47 then
gui.drawText(174,-3,'tr = 47',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 48 then
gui.drawText(174,-3,'tr = 48',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 49 then
gui.drawText(174,-3,'tr = 49',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 50 then
gui.drawText(174,-3,'tr = 50',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 51 then
gui.drawText(174,-3,'tr = 51',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 52 then
gui.drawText(174,-3,'tr = 52',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 53 then
gui.drawText(174,-3,'tr = 53',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 54 then
gui.drawText(174,-3,'tr = 54',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 55 then
gui.drawText(174,-3,'tr = 55',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 56 then
gui.drawText(174,-3,'tr = 56',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 57 then
gui.drawText(174,-3,'tr = 57',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 58 then
gui.drawText(174,-3,'tr = 58',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 59 then
gui.drawText(174,-3,'tr = 59',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 60 then
gui.drawText(174,-3,'tr = 60',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 61 then
gui.drawText(174,-3,'tr = 61',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 62 then
gui.drawText(174,-3,'tr = 62',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 63 then
gui.drawText(174,-3,'tr = 63',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 64 then
gui.drawText(174,-3,'tr = 64',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 65 then
gui.drawText(174,-3,'tr = 65',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 66 then
gui.drawText(174,-3,'tr = 66',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 67 then
gui.drawText(174,-3,'tr = 67',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 68 then
gui.drawText(174,-3,'tr = 68',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 69 then
gui.drawText(174,-3,'tr = 69',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 70 then
gui.drawText(174,-3,'tr = 70',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 71 then
gui.drawText(174,-3,'tr = 71',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 72 then
gui.drawText(174,-3,'tr = 72',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 73 then
gui.drawText(174,-3,'tr = 73',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 74 then
gui.drawText(174,-3,'tr = 74',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 75 then
gui.drawText(174,-3,'tr = 75',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 76 then
gui.drawText(174,-3,'tr = 76',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 77 then
gui.drawText(174,-3,'tr = 77',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 78 then
gui.drawText(174,-3,'tr = 78',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 79 then
gui.drawText(174,-3,'tr = 79',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 80 then
gui.drawText(174,-3,'tr = 80',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 81 then
gui.drawText(174,-3,'tr = 81',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 82 then
gui.drawText(174,-3,'tr = 82',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 83 then
gui.drawText(174,-3,'tr = 83',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 84 then
gui.drawText(174,-3,'tr = 84',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 85 then
gui.drawText(174,-3,'tr = 85',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 86 then
gui.drawText(174,-3,'tr = 86',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 87 then
gui.drawText(174,-3,'tr = 87',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 88 then
gui.drawText(174,-3,'tr = 88',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 89 then
gui.drawText(174,-3,'tr = 89',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 90 then
gui.drawText(174,-3,'tr = 90',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 91 then
gui.drawText(174,-3,'tr = 91',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 92 then
gui.drawText(174,-3,'tr = 92',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 93 then
gui.drawText(174,-3,'tr = 93',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 94 then
gui.drawText(174,-3,'tr = 94',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 95 then
gui.drawText(174,-3,'tr = 95',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 96 then
gui.drawText(174,-3,'tr = 96',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 97 then
gui.drawText(174,-3,'tr = 97',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 98 then
gui.drawText(174,-3,'tr = 98',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 99 then
gui.drawText(174,-3,'tr = 99',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 100 then
gui.drawText(174,-3,'tr = 100',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 101 then
gui.drawText(174,-3,'tr = 101',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 102 then
gui.drawText(174,-3,'tr = 102',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 103 then
gui.drawText(174,-3,'tr = 103',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 104 then
gui.drawText(174,-3,'tr = 104',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 105 then
gui.drawText(174,-3,'tr = 105',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 106 then
gui.drawText(174,-3,'tr = 106',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 107 then
gui.drawText(174,-3,'tr = 107',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 108 then
gui.drawText(174,-3,'tr = 108',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 109 then
gui.drawText(174,-3,'tr = 119',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 110 then
gui.drawText(174,-3,'tr = 110',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 111 then
gui.drawText(174,-3,'tr = 111',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 112 then
gui.drawText(174,-3,'tr = 112',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 113 then
gui.drawText(174,-3,'tr = 113',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 114 then
gui.drawText(174,-3,'tr = 114',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 115 then
gui.drawText(174,-3,'tr = 115',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 116 then
gui.drawText(174,-3,'tr = 116',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 117 then
gui.drawText(174,-3,'tr = 117',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 118 then
gui.drawText(174,-3,'tr = 118',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 119 then
gui.drawText(174,-3,'tr = 119',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 120 then
gui.drawText(174,-3,'tr = 120',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 121 then
gui.drawText(174,-3,'tr = 121',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 122 then
gui.drawText(174,-3,'tr = 122',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 123 then
gui.drawText(174,-3,'tr = 123',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 124 then
gui.drawText(174,-3,'tr = 124',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 125 then
gui.drawText(174,-3,'tr = 125',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 126 then
gui.drawText(174,-3,'tr = 126',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 127 then
gui.drawText(174,-3,'tr = 127',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 128 then
gui.drawText(174,-3,'tr = 128',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 129 then
gui.drawText(174,-3,'tr = 129',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 130 then
gui.drawText(174,-3,'tr = 130',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 131 then
gui.drawText(174,-3,'tr = 131',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 132 then
gui.drawText(174,-3,'tr = 132',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 133 then
gui.drawText(174,-3,'tr = 133',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 134 then
gui.drawText(174,-3,'tr = 134',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 135 then
gui.drawText(174,-3,'tr = 135',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 136 then
gui.drawText(174,-3,'tr = 136',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 137 then
gui.drawText(174,-3,'tr = 137',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 138 then
gui.drawText(174,-3,'tr = 138',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 139 then
gui.drawText(174,-3,'tr = 139',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 140 then
gui.drawText(174,-3,'tr = 140',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 141 then
gui.drawText(174,-3,'tr = 141',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 142 then
gui.drawText(174,-3,'tr = 142',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 143 then
gui.drawText(174,-3,'tr = 143',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 144 then
gui.drawText(174,-3,'tr = 144',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 145 then
gui.drawText(174,-3,'tr = 145',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 146 then
gui.drawText(174,-3,'tr = 146',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 147 then
gui.drawText(174,-3,'tr = 147',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 148 then
gui.drawText(174,-3,'tr = 148',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 149 then
gui.drawText(174,-3,'tr = 149',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 150 then
gui.drawText(174,-3,'tr = 150',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 151 then
gui.drawText(174,-3,'tr = 151',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 152 then
gui.drawText(174,-3,'tr = 152',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 153 then
gui.drawText(174,-3,'tr = 153',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 154 then
gui.drawText(174,-3,'tr = 154',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 155 then
gui.drawText(174,-3,'tr = 155',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 156 then
gui.drawText(174,-3,'tr = 156',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 157 then
gui.drawText(174,-3,'tr = 157',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 158 then
gui.drawText(174,-3,'tr = 158',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 159 then
gui.drawText(174,-3,'tr = 159',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 160 then
gui.drawText(174,-3,'tr = 160',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 161 then
gui.drawText(174,-3,'tr = 161',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 162 then
gui.drawText(174,-3,'tr = 162',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 163 then
gui.drawText(174,-3,'tr = 163',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 164 then
gui.drawText(174,-3,'tr = 164',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 165 then
gui.drawText(174,-3,'tr = 165',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 166 then
gui.drawText(174,-3,'tr = 166',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 167 then
gui.drawText(174,-3,'tr = 167',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 168 then
gui.drawText(174,-3,'tr = 168',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 169 then
gui.drawText(174,-3,'tr = 169',0xFFFF00CC,0xFF000000,9,bold)
elseif Tc2 == 170 then
gui.drawText(174,-3,'tr = 170',0xFFFF00CC,0xFF000000,9,bold)

end
end
end


local function TEXT_VALIDATION() 
local level_t = mainmemory.read_u8       --check level
local round_t = mainmemory.read_u8       --check round
local TXT_Fboss = mainmemory.read_u8     --check text validation
local txt = TXT_Fboss (0x00D8)
local LV1 = level_t(0x1FC1)
local RN1 = round_t(0x1FC0)
local luaT1 = ({["P1 B1"] = true})

if LV1 == 0 and RN1 == 4 and txt == 14 then    
joypad.set(luaT1)

end
end



--configuration (TIMER_info)

-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
WRname = "zoboner"     --If you beat the world record, change "zoboner" by your name         --
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
WRt1 = 4947            -- If you beat the world record, (change frames!)                     --
WRt2 = 8784            --  for CHANGE FRAMES play your movie and watch "Scph(00FA)"          --
WRt3 = 13598           --   with "RAM WATCH" tool at the scoring screen (level end)          --
WRt4 = 18540           --    and when the value of "Scph" is EQUAL to "43", read frame count --
WRt5 = 22727           --     and change one by one "WRt1 to WRt12" values                   --
WRt6 = 27116           ------------------------------------------------------------------------                                                                    
WRt7 = 31287           ------------------------------------------------------------------------                                                                   
WRt8 = 34478           ------------------------------------------------------------------------                                                                    
WRt9 = 40235           ------------------------------------------------------------------------
WRt10 = 44685          -----------------------------------------------------------------------
WRt11 = 50052          ----------------------------------------------------------------------
WRt12 = 57874          ---------------------------------------------------------------------
------------------------------------------------------------------------------------------- 
WRts1 = 0              --calculator
local function TIMER_info()
local score_onoff = mainmemory.read_u8  --check if score count is active
local score_phase = mainmemory.read_u8  --check if score count calculate
local ROUND_s = mainmemory.read_u8      --check round
local LEVEL_s = mainmemory.read_u8      --check level
local Soff = score_onoff(0x00FD)
local Scph = score_phase(0x00FA)
local RD = ROUND_s(0x1FC0)
local LV = LEVEL_s(0x1FC1)
local FRT = emu.framecount()            --frame count (factor uses to calculator)



if Soff == 16 then 

WRt1 = 4947           
WRt2 = 8784           
WRt3 = 13598          
WRt4 = 18540          
WRt5 = 22727          
WRt6 = 27116                                                                        
WRt7 = 31287                                                                       
WRt8 = 34478                                                                        
WRt9 = 40235          
WRt10 = 44685         
WRt11 = 50052         
WRt12 = 57874
end
 
if RD == 0 and LV == 0 then
WRtC = WRt1
TinS = (WRt1/60)/61.1
TinS2 = (FRT/60)/61.1
elseif RD == 0 and LV == 1 then
WRtC = WRt2
TinS = (WRt2/60)/61.1
TinS2 = (FRT/60)/61.1
elseif RD == 0 and LV == 2 then
WRtC = WRt3
TinS = (WRt3/60)/61.1
TinS2 = (FRT/60)/61.1
elseif RD == 1 and LV == 0 then
WRtC = WRt4
TinS = (WRt4/60)/61.1
TinS2 = (FRT/60)/61.1
elseif RD == 1 and LV == 1 then
WRtC = WRt5
TinS = (WRt5/60)/61.1
TinS2 = (FRT/60)/61.1
elseif RD == 1 and LV == 2 then
WRtC = WRt6
TinS = (WRt6/60)/61.1
TinS2 = (FRT/60)/61.1
elseif RD == 2 and LV == 0 then
WRtC = WRt7
TinS = (WRt7/60)/61.1
TinS2 = (FRT/60)/61.1
elseif RD == 2 and LV == 1 then
WRtC = WRt8
TinS = (WRt8/60)/61.1
TinS2 = (FRT/60)/61.1
elseif RD == 2 and LV == 2 then
WRtC = WRt9
TinS = (WRt9/60)/61.1
TinS2 = (FRT/60)/61.1
elseif RD == 3 and LV == 0 then
WRtC = WRt10
TinS = (WRt10/60)/61.1
TinS2 = (FRT/60)/61.1
elseif RD == 3 and LV == 1 then
WRtC = WRt11
TinS = (WRt11/60)/61.1
TinS2 = (FRT/60)/61.1
elseif RD == 3 and LV == 2 then
WRtC = WRt12
TinS = (WRt12/60)/61.1
TinS2 = (FRT/60)/61.1

end

if Soff == 185 and Scph >= 44 and Scph <= 53 then
   if FRT > WRtC and Soff == 185 and Scph >= 44 and Scph <= 53 then 
    WRts1 = FRT - WRtC
	 gui.drawText(50,45,"***WR holder name***",0xFFBBBBBB,0xFF000000)
	 gui.drawText(30,60,"_____________________________________",0x00BBBBBB,0xFF000000)
	 gui.drawText(100,60,WRname,0xFFFF9900,0xFF000000)
	 gui.drawText(12,75,"***TIME comparison(in frames)***",0xFFBBBBBB,0xFF000000)
	 gui.drawText(70,90,"-Actual TAS WR :",0xFFBBBBBB,0xFF000000)
	 gui.drawText(186,90,WRtC,0xFF00FF00,0xFF000000)
	 gui.drawText(70,105,"-Your time     :",0xFFBBBBBB,0xFF000000)
	 gui.drawText(186,105,FRT,0xFFDD0000,0xFF000000)
	 gui.drawText(70,120,"-difference    :",0xFFBBBBBB,0xFF000000)
	 gui.drawText(186,120,WRts1,0xFFDD0000,0xFF000000)
	 gui.drawText(10,135,"_________________________________________________________",0xF00BBBBBB,0xFF000000)
	 gui.drawText(10,135,"your current time:",0xFFBBBBBB,0xFF000000)
	 gui.drawText(145,135,TinS2,0xFFDD0000,0xFF000000)
	 gui.drawText(10,150,"_________________________________________________________",0xF00BBBBBB,0xFF000000)
	 gui.drawText(10,150,"WR current time  :",0xFFBBBBBB,0xFF000000)
	 gui.drawText(145,150,TinS,0xFF00FF00,0xFF000000)
	 gui.drawText(200,150,"_____________________",0xF00BBBBBB,0xFF000000)
	 gui.drawText(200,135,"_____________________",0xF00BBBBBB,0xFF000000)
      elseif FRT < WRtC and Soff == 185 and Scph >= 44 and Scph <= 53 then
       WRts1 = WRtC	- FRT
	    gui.drawText(50,45,"***WR holder name***",0xFFBBBBBB,0xFF000000)
	    gui.drawText(30,60,"_____________________________________",0x00BBBBBB,0xFF000000)
	    gui.drawText(100,60,WRname,0xFFFF9900,0xFF000000)
        gui.drawText(12,75,"***TIME comparison(in frames)***",0xFFBBBBBB,0xFF000000)
	    gui.drawText(70,90,"-Actual TAS WR :",0xFFBBBBBB,0xFF000000)
	    gui.drawText(186,90,WRtC,0xFF888888,0xFF000000)
	    gui.drawText(70,105,"-Your time     :",0xFFBBBBBB,0xFF000000)
	    gui.drawText(186,105,FRT,0xFF888888,0xFF000000)
	    gui.drawText(70,120,"-difference    :",0xFFBBBBBB,0xFF000000)
	    gui.drawText(186,120,WRts1,0xFF888888,0xFF000000)
		gui.drawText(10,135,"_________________________________________________________",0xF00BBBBBB,0xFF000000)
	    gui.drawText(10,135,"your current time:",0xFFBBBBBB,0xFF000000)
	    gui.drawText(145,135,TinS2,0xFF00FF00,0xFF000000)
	    gui.drawText(10,150,"_________________________________________________________",0xF00BBBBBB,0xFF000000)
	    gui.drawText(10,150,"WR current time  :",0xFFBBBBBB,0xFF000000)
	    gui.drawText(145,150,TinS,0xFFDD0000,0xFF000000)
		gui.drawText(200,150,"_____________________",0xF00BBBBBB,0xFF000000)
	    gui.drawText(200,135,"_____________________",0xF00BBBBBB,0xFF000000)
         elseif FRT == WRtC  then
          WRts1 = WRtC - WRtC
            gui.drawText(50,45,"***WR holder name***",0xFFBBBBBB,0xFF000000)
	        gui.drawText(30,60,"_____________________________________",0x00BBBBBB,0xFF000000)
	        gui.drawText(100,60,WRname,0xFFFF9900,0xFF000000)		  
            gui.drawText(12,75,"***TIME comparison(in frames)***",0xFFBBBBBB,0xFF000000)
	        gui.drawText(70,90,"-Actual TAS WR :",0xFFBBBBBB,0xFF000000)
	        gui.drawText(186,90,WRtC,0xFFFF9900,0xFF000000)
	        gui.drawText(70,105,"-Your time     :",0xFFBBBBBB,0xFF000000)
	        gui.drawText(186,105,FRT,0xFFFF9900,0xFF000000)
	        gui.drawText(70,120,"-difference    :",0xFFBBBBBB,0xFF000000)
	        gui.drawText(186,120,WRts1,0xFFFF9900,0xFF000000)
			gui.drawText(10,135,"_________________________________________________________",0xF00BBBBBB,0xFF000000)
	        gui.drawText(10,135,"your current time:",0xFFBBBBBB,0xFF000000)
	        gui.drawText(145,135,TinS2,0xFFFF9900,0xFF000000)
	        gui.drawText(10,150,"_________________________________________________________",0xF00BBBBBB,0xFF000000)
	        gui.drawText(10,150,"WR current time  :",0xFFBBBBBB,0xFF000000)
	        gui.drawText(145,150,TinS,0xFFFF9900,0xFF000000)
			gui.drawText(200,150,"_____________________",0xF00BBBBBB,0xFF000000)
	        gui.drawText(200,135,"_____________________",0xF00BBBBBB,0xFF000000)
			
			
if RD == 0 and LV == 0 and Soff == 185 and Scph >= 44 then   
WRt1 = WRt1 +1
elseif RD == 0 and LV == 1 and Soff == 185 and Scph >= 44 then 
WRt2 = WRt2 +1
elseif RD == 0 and LV == 2 and Soff == 185 and Scph >= 44 then 
WRt3 = WRt3 +1
elseif RD == 1 and LV == 0 and Soff == 185 and Scph >= 44 then 
WRt4 = WRt4 +1
elseif RD == 1 and LV == 1 and Soff == 185 and Scph >= 44 then 
WRt5 = WRt5 +1
elseif RD == 1 and LV == 2 and Soff == 185 and Scph >= 44 then 
WRt6 = WRt6 +1
elseif RD == 2 and LV == 0 and Soff == 185 and Scph >= 44 then 
WRt7 = WRt7 +1
elseif RD == 2 and LV == 1 and Soff == 185 and Scph >= 44 then 
WRt8 = WRt8 +1
elseif RD == 2 and LV == 2 and Soff == 185 and Scph >= 44 then 
WRt9 = WRt9 +1
elseif RD == 3 and LV == 0 and Soff == 185 and Scph >= 44 then 
WRt10 = WRt10 +1
elseif RD == 3 and LV == 1 and Soff == 185 and Scph >= 44 then 
WRt11 = WRt11 +1
elseif RD == 3 and LV == 2 and Soff == 185 and Scph >= 44 then 
WRt12 = WRt12 



	
             
end
end
end
end


while true do
TIMER_info()

RNG_BREAKER()

TEXT_VALIDATION()

Player_Hitbox()

boss_hitbox()

Enemy1_hitbox()
Enemy2_hitbox()
Enemy3_hitbox()
Enemy4_hitbox()
Enemy5_hitbox()
Enemy6_hitbox()
Enemy7_hitbox()
Enemy8_hitbox()
Enemy9_hitbox()
Enemy10_hitbox()
Enemy11_hitbox()
Enemy12_hitbox()
Enemy13_hitbox()
Enemy14_hitbox()
Enemy15_hitbox()
Enemy16_hitbox()
Enemy17_hitbox()
Enemy18_hitbox()
Enemy19_hitbox()
Enemy20_hitbox()
Enemy21_hitbox()
Enemy22_hitbox()
Enemy23_hitbox()
Enemy24_hitbox()
Enemy25_hitbox()

bullets_hitbox()
bullets2_hitbox()
bullets3_hitbox()
bullets4_hitbox()
bullets5_hitbox()
Bullet_player()

HITandFASTwalk()
  
	emu.frameadvance();

end