forked from JailDoctor/cacaus
53 lines
1.3 KiB
Lua
53 lines
1.3 KiB
Lua
local arcade_config = require("arcade_config")
|
|
o2aX = arcade_config.org2arc_escala
|
|
|
|
fireball={hab=-1,x=0,y=0,wait=0,flip=false,bb={x=0,y=0,w=4,h=4}}
|
|
|
|
function fireball.init(_hab,_x,_y,_flip)
|
|
if fireball.hab ~= -1 then return end
|
|
fireball.hab=_hab
|
|
fireball.x=_x
|
|
fireball.y=_y
|
|
fireball.flip=_flip
|
|
end
|
|
|
|
function fireball.draw()
|
|
draw.circf(fireball.x*o2aX,fireball.y*o2aX,3*o2aX,16)
|
|
draw.circf(fireball.x*o2aX,fireball.y*o2aX,2*o2aX,3)
|
|
draw.circf(fireball.x*o2aX,fireball.y*o2aX,1*o2aX,8)
|
|
end
|
|
|
|
function fireball.update()
|
|
if fireball.hab == -1 then return end
|
|
fireball.wait=fireball.wait+1
|
|
|
|
if fireball.wait==3 then
|
|
fireball.wait=0
|
|
|
|
if fireball.x>96 then
|
|
fireball.hab=-1
|
|
return
|
|
elseif check_tile(fireball.hab,fireball.x,fireball.y)<tiletype.block then
|
|
if fireball.flip then
|
|
fireball.x=fireball.x-4
|
|
else
|
|
fireball.x=fireball.x+4
|
|
end
|
|
if fireball.x<-4 then
|
|
fireball.hab=-1
|
|
return
|
|
end
|
|
else
|
|
fireball.hab=-1
|
|
return
|
|
end
|
|
|
|
if fireball.hab==abad.hab then
|
|
if aabb(fireball,abad) and abad.update~=abad_state_crouch then
|
|
fireball.hab=-1
|
|
abad_hurt(1)
|
|
end
|
|
end
|
|
end
|
|
end
|