- All Malotes added

- Trigger system renamed and revamped
- Bambolles can be poped by shooting at them
This commit is contained in:
2022-10-28 17:10:33 +02:00
parent 0ef6d03ec1
commit 8d95eb10e1
6 changed files with 67 additions and 33 deletions

View File

@@ -80,6 +80,14 @@ function bambolla.update_normal()
bambolla.y=28-abs(sin(bambolla.x*0.1))*24 bambolla.y=28-abs(sin(bambolla.x*0.1))*24
if bambolla.hab==abad.hab then if bambolla.hab==abad.hab then
if cacau.hab==bambolla.hab and aabb(bambolla,cacau) then
bambolla.update=bambolla.update_splash
bambolla.draw=bambolla.draw_splash
bambolla.cx=bambolla.x+8
bambolla.y=bambolla.y+8
bambolla.dx=0
bambolla.dy=-4
end
if aabb(bambolla,abad) then if aabb(bambolla,abad) then
--bambolla.hab=-1 --bambolla.hab=-1
if abad.energia>0 then abad.energia=abad.energia-1 end if abad.energia>0 then abad.energia=abad.energia-1 end

View File

@@ -2,4 +2,4 @@ title=Cacaus
width=128 width=128
height=96 height=96
zoom=5 zoom=5
files=scenes.lua,starter.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=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

View File

@@ -47,14 +47,29 @@ function _init()
table.insert(actors,batman) table.insert(actors,batman)
-- MALOTES PERSISTENTS -- MALOTES PERSISTENTS
z = zombie.new() table.insert(actors,zombie.new(2,24,24,false))
table.insert(actors,z) table.insert(actors,caco.new(13,24,16,true))
c=caco.new(13,24,16,true) table.insert(actors,caco.new(20,24,16,false))
table.insert(actors,c) table.insert(actors,zombie.new(32,24,24,false))
table.insert(actors,caco.new(41,24,16,false))
table.insert(actors,zombie.new(44,24,24,false))
-- STARTERS table.insert(actors,caco.new(50,24,16,false))
table.insert(actors,starter.new(10,44,32,scenes.abad_inici)) table.insert(actors,caco.new(61,24,16,false))
table.insert(actors,starter.new(11,16,32,scenes.abad_corfes))
table.insert(actors,zombie.new(73,24,24,false))
table.insert(actors,zombie.new(54,24,24,false))
table.insert(actors,zombie.new(68,24,24,false))
table.insert(actors,caco.new(57,24,16,false))
table.insert(actors,zombie.new(46,24,24,false))
table.insert(actors,caco.new(37,24,16,false))
table.insert(actors,caco.new(26,24,16,false))
table.insert(actors,zombie.new(28,24,24,false))
table.insert(actors,caco.new(17,24,16,false))
-- TRIGGERS
table.insert(actors,trigger.new(10,44,32,triggers.escena_abad_inici))
table.insert(actors,trigger.new(11,16,32,triggers.escena_abad_corfes))
score.create() score.create()
cameras[0]=gps cameras[0]=gps

View File

@@ -1,23 +0,0 @@
starter={}
function starter.new(_hab,_x,_y,_scene)
return {hab=_hab,x=_x,y=_y,scene=_scene,update=starter.update,draw=starter.draw,bb={x=0,y=0,w=8,h=8}}
end
function starter:draw()
-- do nothing
--rectfill(self.x,self.y,self.x+8,self.y+8,3)
end
function starter:update()
if self.hab==abad.hab then
if aabb(abad,self) then
starter.do_touched(self)
end
end
end
function starter:do_touched()
start_scene(self.scene)
remove_actor(self)
end

34
trigger.lua Normal file
View File

@@ -0,0 +1,34 @@
trigger={}
function trigger.new(_hab,_x,_y,_fun)
return {hab=_hab,x=_x,y=_y,fun=_fun,update=trigger.update,draw=trigger.draw,bb={x=0,y=0,w=8,h=8}}
end
function trigger:draw()
-- do nothing
--rectfill(self.x,self.y,self.x+8,self.y+8,3)
end
function trigger:update()
if self.hab==abad.hab then
if aabb(abad,self) then
self:fun()
end
end
end
--function trigger:do_touched()
-- start_scene(self.scene)
-- remove_actor(self)
--end
triggers={}
function triggers:escena_abad_inici()
start_scene(scenes.abad_inici)
remove_actor(self)
end
function triggers:escena_abad_corfes()
start_scene(scenes.abad_corfes)
remove_actor(self)
end

View File

@@ -1,7 +1,7 @@
zombie={} zombie={}
function zombie:new() function zombie.new(_hab,_x,_y,_flip)
return {hab=2,x=24,y=24,flip=false,frame=0,wait=0,step=0,hit=zombie.hit,update=zombie.update_normal, draw=zombie.draw,jumpfwd=false,anim={16,17,16,18},bb={x=4,y=0,w=8,h=16}} return {hab=_hab,x=_x,y=_y,flip=_flip,frame=0,wait=0,step=0,hit=zombie.hit,update=zombie.update_normal, draw=zombie.draw,jumpfwd=false,anim={16,17,16,18},bb={x=4,y=0,w=8,h=16}}
end end
function zombie:draw() function zombie:draw()