diff --git a/batman.lua b/batman.lua index 5f4f5e4..da6b65b 100644 --- a/batman.lua +++ b/batman.lua @@ -17,6 +17,9 @@ function batman.draw() end function batman.hit() + if abad.objects.bol~=nil then + -- Start end of the game + end end function batman.update_normal() @@ -116,7 +119,7 @@ function batman.update_normal() if batman.hab==abad.hab then if aabb(abad,batman) then - + abad_hurt(40) end end diff --git a/bol.lua b/bol.lua new file mode 100644 index 0000000..9ea1560 --- /dev/null +++ b/bol.lua @@ -0,0 +1,20 @@ +bol={hab=39,x=28,y=25,bb={x=0,y=0,w=16,h=8}} + +function bol.init() + bol.update=bol.update + bol.draw=bol.draw +end + +function bol.draw() + sspr(112,88,16,8,bol.x,bol.y,16,8) +end + +function bol.update() + if bol.hab==abad.hab then + if aabb(abad,bol) then + abad.objects.bol=true + start_scene(scenes.bol_trobat) + remove_actor(bol) + end + end +end diff --git a/game.ini b/game.ini index 27debc4..08392a7 100644 --- a/game.ini +++ b/game.ini @@ -2,4 +2,4 @@ title=Cacaus width=128 height=96 zoom=5 -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 +files=dead.lua,scenes.lua,trigger.lua,score.lua,switches.lua,map.lua,mapa.lua,bol.lua,invisible.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 diff --git a/invisible.lua b/invisible.lua new file mode 100644 index 0000000..704ee3b --- /dev/null +++ b/invisible.lua @@ -0,0 +1,27 @@ +invisible={} + +function invisible.new(_hab,_x,_y) + return {hab=_hab,x=_x,y=_y,wait=0,hit=invisible.hit,update=invisible.update,draw=invisible.draw,bb={x=0,y=0,w=8,h=8}} +end + +function invisible:draw() + -- Es invisible, res que drawar +end + +function invisible:update() + self.wait=self.wait+1 + + if self.wait==6 then + self.wait=0 + + if self.hab==abad.hab then + if aabb(abad,self) then + abad_hurt(1) + end + end + + end +end + +function invisible:hit() +end diff --git a/main.lua b/main.lua index b352fa0..8e9eca1 100644 --- a/main.lua +++ b/main.lua @@ -51,8 +51,27 @@ function _init() batman.init() table.insert(actors,batman) + bol.init() + table.insert(actors,bol) + -- MALOTES PERSISTENTS - table.insert(actors,gota.new(10,80,4,20)) + table.insert(actors,gota.new(70,40,8,20)) + table.insert(actors,gota.new(70,72,8,30)) + table.insert(actors,gota.new(63,40,4,25)) + table.insert(actors,gota.new(63,72,4,20)) + table.insert(actors,gota.new(64,24,4,10)) + table.insert(actors,gota.new(64,56,4,25)) + table.insert(actors,gota.new(65,24,4,10)) + table.insert(actors,gota.new(65,64,4,25)) + table.insert(actors,gota.new(66,24,4,10)) + table.insert(actors,gota.new(66,32,4,15)) + table.insert(actors,gota.new(77,16,4,30)) + table.insert(actors,gota.new(77,72,4,25)) + + table.insert(actors,invisible.new(77,40,32)) + table.insert(actors,invisible.new(77,48,32)) + table.insert(actors,invisible.new(58,16,32)) + table.insert(actors,invisible.new(58,16,32)) table.insert(actors,zombie.new(2,24,24,false)) table.insert(actors,caco.new(13,24,16,true)) @@ -239,9 +258,19 @@ function update_game() fireball.update() switches.update() + local hx = abad.hab%10 + local hy = flr(abad.hab/10) if btnp(KEY_RETURN) then mode=modes.editing mapa_restore_backup() + elseif btn(KEY_LSHIFT) and btnp(KEY_RIGHT) and hx<9 then + abad.hab=abad.hab+1 + elseif btn(KEY_LSHIFT) and btnp(KEY_LEFT) and hx>0 then + abad.hab=abad.hab-1 + elseif btn(KEY_LSHIFT) and btnp(KEY_DOWN) and hy<7 then + abad.hab=abad.hab+10 + elseif btn(KEY_LSHIFT) and btnp(KEY_UP) and hy>0 then + abad.hab=abad.hab-10 end if abad.objects.gps~=nil then if btnp(KEY_1) then diff --git a/map.lua b/map.lua index b82babf..6e68b66 100644 --- a/map.lua +++ b/map.lua @@ -393,9 +393,9 @@ mapa={ { 24,29,28,29,28,29,28,29,8,9,26,27, 24,256,256,256,256,256,256,256,8,9,25,25, - 24,256,256,256,256,256,256,256,8,9,26,27, - 24,256,114,121,256,256,112,256,8,9,25,25, - 24,256,256,101,102,103,256,256,8,9,26,27, + 24,256,114,256,256,256,112,256,8,9,26,27, + 24,256,256,256,256,256,256,256,8,9,25,25, + 24,256,256,256,105,256,256,256,8,9,26,27, 24,29,28,29,28,29,28,29,28,29,25,25, }, diff --git a/scenes.lua b/scenes.lua index 47bb014..0888595 100644 --- a/scenes.lua +++ b/scenes.lua @@ -76,6 +76,11 @@ scenes={ {x=4,y=0,flip=false,text={"L'habitació de Batman!","Segur que els cacaus","estàn ahí dins."}}, {x=4,y=0,flip=false,text={"Però necessite","una clau...",""}} }, + bol_trobat={ + {x=4,y=0,flip=false,text={"PER FI, JA TINC","ELS MEUS CACAUS!!!","OLE!! OLE!!"}}, + {x=4,y=0,flip=false,text={"Se va a enterar","Batman ara quan","el pille..."}}, + {x=4,y=0,flip=false,text={"Ara si que li puc","pegar una bona","cacauà..."}} + }, } function start_scene(scene) diff --git a/score.lua b/score.lua index f564e55..223c80b 100644 --- a/score.lua +++ b/score.lua @@ -38,4 +38,6 @@ function score.draw() if abad.objects.clau_premiere~=nil then sspr(112,8,8,8,104,48) end if abad.objects.clau_elalien~=nil then sspr(120,8,8,8,112,48) end + + if abad.objects.bol~=nil then sspr(112,88,16,8,104,46) end end \ No newline at end of file diff --git a/tiles.gif b/tiles.gif index 731fff3..bb38a01 100644 Binary files a/tiles.gif and b/tiles.gif differ