- [NEW] Gota implementada
This commit is contained in:
2
game.ini
2
game.ini
@@ -2,4 +2,4 @@ title=Cacaus
|
|||||||
width=128
|
width=128
|
||||||
height=96
|
height=96
|
||||||
zoom=5
|
zoom=5
|
||||||
files=dead.lua,scenes.lua,trigger.lua,score.lua,switches.lua,map.lua,mapa.lua,fireball.lua,cacau.lua,bambolla.lua,imp.lua,gps.lua,peu.lua,gorro.lua,batman.lua,elalien.lua,premiere.lua,caco.lua,zombie.lua,abad.lua,main.lua
|
files=dead.lua,scenes.lua,trigger.lua,score.lua,switches.lua,map.lua,mapa.lua,gota.lua,fireball.lua,cacau.lua,bambolla.lua,imp.lua,gps.lua,peu.lua,gorro.lua,batman.lua,elalien.lua,premiere.lua,caco.lua,zombie.lua,abad.lua,main.lua
|
||||||
|
|||||||
75
gota.lua
Normal file
75
gota.lua
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
gota={}
|
||||||
|
|
||||||
|
function gota.new(_hab,_x,_y,_freq)
|
||||||
|
return {hab=_hab,ix=_x,iy=_y,x=_x,y=_y,freq=_freq,cx=0,dx=0,dy=0,wait=0,step=0,hit=gota.hit,update=gota.update_normal, draw=gota.draw_normal,bb={x=2,y=0,w=4,h=6}}
|
||||||
|
end
|
||||||
|
|
||||||
|
function gota:draw_normal()
|
||||||
|
sspr(112,0,8,8,self.x,self.y)
|
||||||
|
end
|
||||||
|
|
||||||
|
function gota:update_normal()
|
||||||
|
self.wait=self.wait+1
|
||||||
|
|
||||||
|
if self.wait==6 then
|
||||||
|
self.wait=0
|
||||||
|
self.step=self.step+1
|
||||||
|
if self.step > self.freq then
|
||||||
|
self.y=self.y+4
|
||||||
|
if check_tile(self.hab,self.x+2,self.y+2)>=tiletype.block then
|
||||||
|
self.update=gota.update_splash
|
||||||
|
self.draw=gota.draw_splash
|
||||||
|
self.cx=self.x+2
|
||||||
|
self.dx=0
|
||||||
|
self.dy=-4
|
||||||
|
end
|
||||||
|
else
|
||||||
|
--self.flip=not self.flip
|
||||||
|
end
|
||||||
|
|
||||||
|
if self.hab==abad.hab then
|
||||||
|
if aabb(abad,self) then
|
||||||
|
abad_hurt(1)
|
||||||
|
self.update=gota.update_splash
|
||||||
|
self.draw=gota.draw_splash
|
||||||
|
self.cx=self.x+2
|
||||||
|
self.dx=0
|
||||||
|
self.dy=-4
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function gota:hit()
|
||||||
|
end
|
||||||
|
|
||||||
|
function gota:draw_splash()
|
||||||
|
circfill(self.cx+self.dx,self.y,2,16)
|
||||||
|
circfill(self.cx+self.dx,self.y,1,11)
|
||||||
|
circfill(self.cx-self.dx,self.y,2,16)
|
||||||
|
circfill(self.cx-self.dx,self.y,1,11)
|
||||||
|
circfill(self.cx-(self.dx/2),self.y-4,2,16)
|
||||||
|
circfill(self.cx-(self.dx/2),self.y-4,1,11)
|
||||||
|
circfill(self.cx+(self.dx/2),self.y-4,2,16)
|
||||||
|
circfill(self.cx+(self.dx/2),self.y-4,1,11)
|
||||||
|
end
|
||||||
|
|
||||||
|
function gota:update_splash()
|
||||||
|
self.wait=self.wait+1
|
||||||
|
|
||||||
|
if self.wait==3 then
|
||||||
|
self.wait=0
|
||||||
|
self.dx=self.dx-2
|
||||||
|
self.x=self.cx+self.dx
|
||||||
|
self.y=self.y+self.dy
|
||||||
|
self.dy=self.dy+1
|
||||||
|
if self.y>48 then
|
||||||
|
self.step=0
|
||||||
|
self.update=gota.update_normal
|
||||||
|
self.draw=gota.draw_normal
|
||||||
|
self.x=self.ix
|
||||||
|
self.y=self.iy
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
2
main.lua
2
main.lua
@@ -52,6 +52,8 @@ function _init()
|
|||||||
table.insert(actors,batman)
|
table.insert(actors,batman)
|
||||||
|
|
||||||
-- MALOTES PERSISTENTS
|
-- MALOTES PERSISTENTS
|
||||||
|
table.insert(actors,gota.new(10,80,4,20))
|
||||||
|
|
||||||
table.insert(actors,zombie.new(2,24,24,false))
|
table.insert(actors,zombie.new(2,24,24,false))
|
||||||
table.insert(actors,caco.new(13,24,16,true))
|
table.insert(actors,caco.new(13,24,16,true))
|
||||||
table.insert(actors,caco.new(20,24,16,false))
|
table.insert(actors,caco.new(20,24,16,false))
|
||||||
|
|||||||
Reference in New Issue
Block a user