- All Malotes added
- Trigger system renamed and revamped - Bambolles can be poped by shooting at them
This commit is contained in:
@@ -80,6 +80,14 @@ function bambolla.update_normal()
|
||||
bambolla.y=28-abs(sin(bambolla.x*0.1))*24
|
||||
|
||||
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
|
||||
--bambolla.hab=-1
|
||||
if abad.energia>0 then abad.energia=abad.energia-1 end
|
||||
|
||||
2
game.ini
2
game.ini
@@ -2,4 +2,4 @@ title=Cacaus
|
||||
width=128
|
||||
height=96
|
||||
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
|
||||
|
||||
29
main.lua
29
main.lua
@@ -47,14 +47,29 @@ function _init()
|
||||
table.insert(actors,batman)
|
||||
|
||||
-- MALOTES PERSISTENTS
|
||||
z = zombie.new()
|
||||
table.insert(actors,z)
|
||||
c=caco.new(13,24,16,true)
|
||||
table.insert(actors,c)
|
||||
table.insert(actors,zombie.new(2,24,24,false))
|
||||
table.insert(actors,caco.new(13,24,16,true))
|
||||
table.insert(actors,caco.new(20,24,16,false))
|
||||
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,starter.new(10,44,32,scenes.abad_inici))
|
||||
table.insert(actors,starter.new(11,16,32,scenes.abad_corfes))
|
||||
table.insert(actors,caco.new(50,24,16,false))
|
||||
table.insert(actors,caco.new(61,24,16,false))
|
||||
|
||||
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()
|
||||
|
||||
cameras[0]=gps
|
||||
|
||||
23
starter.lua
23
starter.lua
@@ -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
34
trigger.lua
Normal 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
|
||||
@@ -1,7 +1,7 @@
|
||||
zombie={}
|
||||
|
||||
function zombie:new()
|
||||
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}}
|
||||
function zombie.new(_hab,_x,_y,_flip)
|
||||
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
|
||||
|
||||
function zombie:draw()
|
||||
|
||||
Reference in New Issue
Block a user