diff --git a/abad.lua b/abad.lua index 9b69998..d58a76a 100644 --- a/abad.lua +++ b/abad.lua @@ -3,6 +3,7 @@ abad={x=40,y=24,flip=false,frame=1,wait=0,hab=10,vides=3,energia=40,step=0,updat function abad_init() abad.update=abad_state_normal + abad.objects={} end function abad:draw() diff --git a/elalien.lua b/elalien.lua index c260e20..c935466 100644 --- a/elalien.lua +++ b/elalien.lua @@ -5,7 +5,7 @@ function elalien.init() elalien.update=elalien.update_normal elalien.draw=elalien.draw local habs={66,56,59,53} - premiere.hab=habs[1+rnd(4)] + elalien.hab=habs[1+rnd(4)] end function elalien.draw() diff --git a/game.ini b/game.ini index 5dc3e6b..e54faea 100644 --- a/game.ini +++ b/game.ini @@ -1,5 +1,5 @@ title=Cacaus width=128 height=96 -zoom=4 -files=scenes.lua,starter.lua,score.lua,switches.lua,map.lua,mapa.lua,cacau.lua,batman.lua,elalien.lua,premiere.lua,caco.lua,zombie.lua,abad.lua,main.lua +zoom=5 +files=scenes.lua,starter.lua,score.lua,switches.lua,map.lua,mapa.lua,cacau.lua,gorro.lua,batman.lua,elalien.lua,premiere.lua,caco.lua,zombie.lua,abad.lua,main.lua diff --git a/gorro.lua b/gorro.lua new file mode 100644 index 0000000..193a562 --- /dev/null +++ b/gorro.lua @@ -0,0 +1,21 @@ +gorro={hab=5,x=48,y=24,bb={x=0,y=0,w=8,h=8}} + +function gorro.init() + local habs={11,11,11,11} + gorro.hab=habs[1+rnd(4)] + gorro.update=gorro.update + gorro.draw=gorro.draw +end + +function gorro.draw() + sspr(96,32,16,16,gorro.x,gorro.y,16,16) +end + +function gorro.update() + if gorro.hab==abad.hab then + if aabb(abad,gorro) then + abad.objects.gorro=true + remove_actor(gorro) + end + end +end diff --git a/main.lua b/main.lua index 3b64a24..12d7055 100644 --- a/main.lua +++ b/main.lua @@ -27,10 +27,16 @@ function _init() --mapa_new() abad_init() table.insert(actors,abad) + + gorro.init() + table.insert(actors,gorro) + premiere.init() table.insert(actors,premiere) + elalien.init() table.insert(actors,elalien) + batman.init() table.insert(actors,batman) @@ -128,6 +134,9 @@ function update_game() _update=update_dialog elseif btnp(KEY_C) then mapa_cycle_colors(abad.hab) + elseif btnp(KEY_M) then + mapa_create_minimap() + return end if btn(KEY_TAB) then scroll=2 diff --git a/map.lua b/map.lua index 44664dd..b82babf 100644 --- a/map.lua +++ b/map.lua @@ -96,7 +96,7 @@ mapa={ 256,256,73,74,256,256,73,74,256,256,18,19, 256,256,89,90,256,256,89,90,256,256,17,17, 256,256,256,256,256,256,256,256,256,256,18,19, - 20,21,20,21,20,21,256,80,17,17,17,17, + 20,21,256,80,17,18,19,17,18,19,17,17, }, -- 11 @@ -165,8 +165,8 @@ mapa={ 256,256,256,256,25,41,256,256,256,256,256,256, 256,73,74,256,25,41,256,256,73,74,256,256, 256,89,90,78,25,41,256,256,89,90,256,256, - 256,256,95,94,25,41,256,256,256,256,256,256, - 28,29,28,29,25,41,44,45,44,45,44,45, + 256,256,95,94,25,41,256,256,10,11,256,256, + 28,29,28,29,25,41,44,45,10,11,44,45, }, -- 18 @@ -181,21 +181,21 @@ mapa={ }, -- 19 { - 44,45,44,45,44,45,44,45,44,45,44,45, - 256,256,256,256,256,256,256,256,256,256,256,256, - 256,97,98,97,256,73,74,256,98,97,96,256, - 256,99,256,100,256,89,90,256,99,256,100,256, - 256,256,256,256,256,256,256,256,256,256,256,256, - 44,45,44,45,44,45,256,83,41,45,44,45, + 44,45,44,45,42,43,42,43,44,45,44,45, + 256,256,256,256,256,40,40,256,256,256,256,256, + 256,97,98,97,256,40,40,256,98,97,96,256, + 256,99,256,100,256,40,40,256,99,256,100,256, + 256,256,256,256,256,40,40,256,256,256,256,256, + 3,41,83,256,44,45,44,45,44,45,44,45, }, -- 20 { - 44,45,44,45,44,45,256,256,41,41,41,41, - 256,256,256,256,256,256,256,256,41,77,42,43, - 256,256,73,74,256,256,256,3,256,93,41,41, - 256,256,89,90,256,256,3,256,256,256,42,43, - 256,256,256,256,256,3,256,256,8,9,41,41, + 44,45,256,256,256,42,43,41,42,43,41,41, + 256,256,256,256,41,41,256,256,256,77,42,43, + 256,256,256,3,256,41,256,256,256,93,41,41, + 256,256,3,256,256,39,256,256,256,256,42,43, + 256,3,256,256,256,38,256,256,8,9,41,41, 44,45,44,45,44,45,44,45,8,9,42,43, }, @@ -261,11 +261,11 @@ mapa={ }, -- 27 { - 17,17,18,19,17,17,18,19,17,17,18,19, - 256,256,256,256,256,256,256,256,256,256,256,256, - 256,256,73,74,256,256,256,256,73,74,256,256, - 256,256,89,90,256,256,256,256,89,90,256,256, - 256,256,256,256,256,256,256,256,256,256,256,256, + 17,17,18,19,17,17,18,19,10,11,18,19, + 256,256,256,256,256,256,256,256,10,11,256,256, + 256,73,74,256,256,73,74,256,10,11,256,256, + 256,89,90,256,256,89,90,256,10,11,256,256, + 256,256,256,256,256,256,256,256,10,11,256,256, 17,17,18,19,17,256,80,17,18,19,17,17, }, @@ -281,11 +281,11 @@ mapa={ }, -- 29 { - 36,37,36,37,36,37,256,256,256,33,34,35, - 256,256,256,256,256,256,256,256,33,256,256,256, - 256,256,256,256,256,256,256,2,256,256,256,256, - 256,117,98,256,256,256,2,256,256,106,116,256, - 256,101,102,103,256,2,256,256,104,101,102,256, + 33,256,256,256,33,33,34,35,33,33,34,35, + 256,33,256,256,256,256,256,256,256,256,256,256, + 256,256,2,256,256,256,256,256,256,256,256,256, + 256,256,256,2,256,256,256,117,98,106,116,256, + 256,256,256,256,2,256,104,101,102,101,102,256, 34,35,33,33,34,35,33,33,34,35,33,33, }, @@ -312,10 +312,10 @@ mapa={ -- 32 { 40,40,40,40,40,40,40,40,40,40,40,40, - 44,45,44,45,44,45,44,45,44,45,44,45, - 256,256,256,256,256,256,256,256,256,256,256,256, - 256,112,256,256,113,256,256,256,114,256,256,113, - 256,256,256,256,256,256,256,256,256,256,256,256, + 44,45,41,45,44,41,44,45,44,45,44,45, + 256,256,38,256,256,38,256,256,256,256,256,256, + 256,112,38,256,113,38,256,256,114,256,256,113, + 256,256,38,256,256,38,256,256,256,256,256,256, 44,45,41,83,256,44,45,44,45,44,45,44, }, @@ -342,7 +342,7 @@ mapa={ -- 35 { 26,27,28,29,28,29,28,29,8,9,26,27, - 24,256,256,256,256,256,256,256,8,9,256,24, + 24,15,256,256,256,256,256,256,8,9,256,24, 24,256,256,256,256,256,256,256,8,9,256,24, 24,256,256,256,256,256,256,256,8,9,256,24, 24,256,256,256,256,256,256,256,8,9,256,24, @@ -352,10 +352,10 @@ mapa={ -- 36 { 24,29,256,256,1,25,26,27,25,1,28,29, - 24,256,256,256,256,256,26,27,256,256,256,256, - 24,256,256,256,256,256,256,256,256,256,256,256, - 24,256,106,116,256,256,256,256,256,105,256,256, - 24,25,101,102,256,256,256,256,101,102,256,256, + 24,256,256,256,256,256,25,26,27,256,256,256, + 24,256,256,256,256,256,256,256,25,256,256,256, + 24,256,106,116,256,256,256,256,38,256,256,256, + 24,25,101,102,256,256,256,256,38,256,256,256, 28,29,28,29,25,81,256,28,29,28,29,28, }, @@ -375,18 +375,18 @@ mapa={ 29,256,256,256,256,256,69,256,256,256,256,28, 256,256,98,96,98,256,256,98,98,96,256,256, 256,256,99,256,100,256,256,99,256,100,256,256, - 256,256,256,256,256,111,111,256,10,11,256,256, - 29,28,29,28,29,69,256,28,10,11,29,28, + 256,256,256,256,256,111,111,256,256,256,256,256, + 29,28,29,28,29,69,256,28,29,28,29,28, }, -- 39 { 28,29,25,25,28,29,25,25,28,29,25,25, 256,256,25,25,256,256,256,256,256,256,106,24, - 256,256,256,69,256,256,256,256,256,256,95,24, + 256,256,15,256,256,256,256,256,256,256,95,24, 256,256,256,256,78,97,107,108,256,106,105,24, - 256,256,111,111,94,101,102,110,103,105,98,24, - 28,29,69,256,28,29,28,29,28,29,28,29, + 256,256,256,256,94,101,102,110,103,105,98,24, + 28,29,28,29,28,29,28,29,28,29,28,29, }, -- 40 @@ -471,11 +471,11 @@ mapa={ }, -- 48 { - 20,21,20,21,17,256,256,17,10,11,20,21, - 256,256,256,256,256,256,69,256,10,11,256,256, - 256,256,96,97,256,256,69,256,10,11,256,256, - 256,115,99,100,256,256,256,256,10,11,256,256, - 256,101,102,103,256,111,111,256,10,11,256,256, + 20,21,20,21,17,256,256,17,20,21,20,21, + 256,256,256,256,256,256,69,256,256,256,256,256, + 256,256,96,97,256,256,69,256,256,256,256,256, + 256,115,99,100,256,256,256,256,256,117,256,256, + 256,101,102,103,256,111,111,256,101,102,103,256, 19,18,19,18,19,69,256,18,19,18,19,18, }, @@ -522,7 +522,7 @@ mapa={ -- 53 { 18,19,10,11,18,19,17,17,20,21,20,21, - 16,256,10,11,256,256,256,256,256,256,256,256, + 16,15,10,11,256,256,256,256,256,256,256,256, 16,256,10,11,256,256,75,76,256,256,256,256, 16,256,10,11,256,256,91,92,256,256,256,256, 16,256,10,11,256,256,18,19,256,256,256,256, @@ -533,7 +533,7 @@ mapa={ { 20,21,20,21,21,17,18,19,67,256,256,256, 256,256,256,256,256,17,18,19,256,65,68,64, - 256,256,256,256,256,15,18,19,256,256,256,256, + 256,256,256,256,256,256,18,19,256,256,256,256, 256,256,256,256,256,256,38,256,67,256,64,256, 256,256,256,256,256,256,38,256,256,256,256,256, 20,21,20,21,20,21,20,21,54,55,54,56, @@ -601,8 +601,8 @@ mapa={ }, -- 61 { - 17,20,21,20,21,20,21,20,21,17,18,19, - 16,256,256,256,256,256,256,256,256,77,18,19, + 18,19,21,20,21,20,21,20,21,17,18,19, + 16,15,256,256,256,256,256,256,256,77,18,19, 16,256,256,256,256,256,256,256,256,93,18,19, 16,256,256,256,256,256,256,116,256,78,18,19, 16,256,10,11,256,256,101,102,256,94,18,19, @@ -792,7 +792,7 @@ mapa={ -- 80 { 42,43,42,43,42,43,42,43,256,256,256,256, - 256,256,256,256,256,256,42,43,256,256,256,256, + 256,256,256,256,256,15,42,43,256,256,256,256, 256,256,256,256,256,256,42,43,256,126,127,256, 256,256,256,256,256,256,42,43,256,256,256,256, 256,256,256,256,256,256,42,43,256,256,256,256, diff --git a/mapa.lua b/mapa.lua index 81282b2..7de4b7d 100644 --- a/mapa.lua +++ b/mapa.lua @@ -143,3 +143,32 @@ function check_tile(hab,x,y) return tiletype.void end end + +pix={14,10,7,1,0,0,0,0,4,4,4,4,0,0,0,8,14,14,14,14,14,14,0,0,10,10,10,10,10,10,10,10,7,7,7,7,7,7,2,2,1,1,1,1,1,1,12,12,1,1,1,9,9,9,10,10,10,0,0,0,0,0,0,0} + +function mapa_create_minimap() + minimap = newsurf(128,96) + setdest(minimap) + for h=0,79 do + for y=0,5 do + for x=0,11 do + local tile=mapa[h+1][1+x+y*12] + if h==45 then + print(x..","..y.."="..tile) + end + if tile<64 then + pset(x+(h%10)*12,y+flr(h/10)*6,pix[1+tile]) + end + end + end + end + _update=mapa_draw_minimap +end + +function mapa_draw_minimap() + --print("HOLA") + setsource(minimap) + setdest(0) + cls(16) + sspr(0,0,128,96,0,0) +end \ No newline at end of file diff --git a/score.lua b/score.lua index 1322243..5cf88a0 100644 --- a/score.lua +++ b/score.lua @@ -31,4 +31,8 @@ end function score.draw() setsource(score.surf) sspr(0,0,32,96,96,0) + setsource(tiles) + if abad.objects.gorro~=nil then sspr(96,32,16,16,99,44) end + if abad.objects.peu~=nil then sspr(112,32,16,16,109,44) end + if abad.objects.gps~=nil then sspr(112,48,16,16,100,55) end end \ No newline at end of file diff --git a/tiles.gif b/tiles.gif index 9a489e2..675e715 100644 Binary files a/tiles.gif and b/tiles.gif differ