- room beautifying finished

- scenes
- starters
This commit is contained in:
2022-10-25 19:07:21 +02:00
parent fbda875ac6
commit 838cd171ae
9 changed files with 260 additions and 102 deletions

View File

@@ -31,7 +31,7 @@ function abad_state_normal()
abad.jumpfwd=false abad.jumpfwd=false
elseif btn(KEY_DOWN) then elseif btn(KEY_DOWN) then
abad.update=abad_state_crouch abad.update=abad_state_crouch
elseif btn(KEY_SPACE) and cacau.hab==-1 then elseif btnp(KEY_SPACE) and cacau.hab==-1 then
abad.update=abad_state_fire abad.update=abad_state_fire
abad.wait=0 abad.wait=0
cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip) cacau.init(abad.hab,abad.x+8,abad.y+8,abad.flip)

View File

@@ -2,4 +2,4 @@ title=Cacaus
width=128 width=128
height=96 height=96
zoom=4 zoom=4
files=score.lua,switches.lua,map.lua,mapa.lua,cacau.lua,premiere.lua,caco.lua,zombie.lua,abad.lua,main.lua files=scenes.lua,starter.lua,score.lua,switches.lua,map.lua,mapa.lua,cacau.lua,premiere.lua,caco.lua,zombie.lua,abad.lua,main.lua

View File

@@ -7,6 +7,14 @@ seltile = 0
actors={} actors={}
function remove_actor(actor)
for index, value in pairs(actors) do
if value == actor then
table.remove(actors,index)
end
end
end
function _init() function _init()
tiles=loadsurf("tiles.gif") tiles=loadsurf("tiles.gif")
setsource(tiles) setsource(tiles)
@@ -22,6 +30,8 @@ function _init()
table.insert(actors,z) table.insert(actors,z)
c=caco.new(11,24,16) c=caco.new(11,24,16)
table.insert(actors,c) table.insert(actors,c)
table.insert(actors,starter.new(10,44,32,scenes.abad_inici))
score.create() score.create()
_update=update_game _update=update_game
@@ -72,6 +82,7 @@ function update_dialog()
_update=update_game _update=update_game
end end
end end
scroll=0 scroll=0
function update_game() function update_game()
cls(16) cls(16)
@@ -147,8 +158,10 @@ function update_game()
actor:update() actor:update()
if actor.hab==cacau.hab and actor~=abad then if actor.hab==cacau.hab and actor~=abad then
if aabb(actor,cacau) then if aabb(actor,cacau) then
actor:hit() if actor.hit~=nil then
cacau.hab=-1 actor:hit()
cacau.hab=-1
end
end end
end end
end end

180
map.lua
View File

@@ -104,7 +104,7 @@ mapa={
256,66,26,27,28,29,28,29,26,27,28,29, 256,66,26,27,28,29,28,29,26,27,28,29,
256,256,256,24,256,256,256,256,15,25,256,256, 256,256,256,24,256,256,256,256,15,25,256,256,
64,68,256,256,256,256,256,256,256,25,256,256, 64,68,256,256,256,256,256,256,256,25,256,256,
256,256,66,24,256,256,256,256,256,38,256,256, 256,256,66,24,256,121,256,256,256,38,256,256,
256,66,256,24,101,102,103,256,256,38,256,256, 256,66,256,24,101,102,103,256,256,38,256,256,
66,256,256,24,28,29,28,29,28,29,28,29, 66,256,256,24,28,29,28,29,28,29,28,29,
@@ -163,19 +163,19 @@ mapa={
{ {
28,29,28,29,25,41,44,45,44,45,44,45, 28,29,28,29,25,41,44,45,44,45,44,45,
256,256,256,256,25,41,256,256,256,256,256,256, 256,256,256,256,25,41,256,256,256,256,256,256,
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,256,256,256,25,41,256,256,256,256,256,256, 256,89,90,78,25,41,256,256,89,90,256,256,
256,256,256,256,25,41,256,256,256,256,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, 28,29,28,29,25,41,44,45,44,45,44,45,
}, },
-- 18 -- 18
{ {
44,45,44,45,41,256,256,41,44,45,44,45, 44,45,44,45,41,256,256,41,44,45,44,45,
256,256,256,256,256,69,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,256,256,69,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,41,41,256,69,41,41,256,256,256,
256,256,256,41,41,256,256,41,41,256,256,256,
45,44,45,42,43,256,256,42,43,44,45,44, 45,44,45,42,43,256,256,42,43,44,45,44,
}, },
@@ -183,8 +183,8 @@ mapa={
{ {
44,45,44,45,44,45,44,45,44,45,44,45, 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,256,256,256,256,256,256,256,256,256,256,256,
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,256,256,256,256,256,256,256,256,256,256,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, 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,44,45,256,83,41,45,44,45,
@@ -192,9 +192,9 @@ mapa={
-- 20 -- 20
{ {
44,45,44,45,44,45,256,256,41,41,41,41, 44,45,44,45,44,45,256,256,41,41,41,41,
256,256,256,256,256,256,256,256,41,256,42,43, 256,256,256,256,256,256,256,256,41,77,42,43,
256,256,256,256,256,256,256,3,256,256,41,41, 256,256,73,74,256,256,256,3,256,93,41,41,
256,256,256,256,256,256,3,256,256,256,42,43, 256,256,89,90,256,256,3,256,256,256,42,43,
256,256,256,256,256,3,256,256,8,9,41,41, 256,256,256,256,256,3,256,256,8,9,41,41,
44,45,44,45,44,45,44,45,8,9,42,43, 44,45,44,45,44,45,44,45,8,9,42,43,
@@ -244,7 +244,7 @@ mapa={
36,37,36,37,36,37,36,37,36,37,34,35, 36,37,36,37,36,37,36,37,36,37,34,35,
256,256,256,256,256,256,73,74,256,256,77,32, 256,256,256,256,256,256,73,74,256,256,77,32,
256,96,97,96,256,256,89,90,256,256,93,32, 256,96,97,96,256,256,89,90,256,256,93,32,
256,99,256,100,256,256,256,256,256,256,256,32, 256,99,256,100,256,121,256,256,256,256,256,32,
256,256,256,256,256,101,102,103,8,9,256,32, 256,256,256,256,256,101,102,103,8,9,256,32,
36,37,36,37,36,37,36,37,8,9,33,32, 36,37,36,37,36,37,36,37,8,9,33,32,
@@ -263,8 +263,8 @@ mapa={
{ {
17,17,18,19,17,17,18,19,17,17,18,19, 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,256,256,256,256,256,256,256,256,256,256,
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,256,256,256,256,256,256,256,256,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, 256,256,256,256,256,256,256,256,256,256,256,256,
17,17,18,19,17,256,80,17,18,19,17,17, 17,17,18,19,17,256,80,17,18,19,17,17,
@@ -272,11 +272,11 @@ mapa={
-- 28 -- 28
{ {
18,19,17,18,19,256,256,33,33,34,35,33, 18,19,17,18,19,256,256,33,33,34,35,33,
256,256,256,17,17,256,256,34,35,256,256,256, 256,256,256,17,17,256,69,34,35,72,256,256,
256,256,256,18,19,256,256,33,33,256,256,256, 256,256,256,18,19,256,69,33,33,88,256,256,
256,256,256,17,17,256,256,34,35,256,256,256, 256,256,256,17,16,256,256,34,35,256,256,256,
256,256,256,18,19,256,256,33,33,256,256,256, 256,256,256,18,19,69,256,41,33,256,256,256,
17,18,19,17,17,256,256,34,35,33,33,34, 17,18,19,17,17,69,256,34,35,33,33,34,
}, },
-- 29 -- 29
@@ -284,8 +284,8 @@ mapa={
36,37,36,37,36,37,256,256,256,33,34,35, 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,256,33,256,256,256,
256,256,256,256,256,256,256,2,256,256,256,256, 256,256,256,256,256,256,256,2,256,256,256,256,
256,256,256,256,256,256,2,256,256,256,256,256, 256,117,98,256,256,256,2,256,256,106,116,256,
256,256,256,256,256,2,256,256,256,256,256,256, 256,101,102,103,256,2,256,256,104,101,102,256,
34,35,33,33,34,35,33,33,34,35,33,33, 34,35,33,33,34,35,33,33,34,35,33,33,
}, },
@@ -293,9 +293,9 @@ mapa={
{ {
33,33,34,35,33,33,34,35,8,9,33,33, 33,33,34,35,33,33,34,35,8,9,33,33,
256,256,256,256,256,256,33,33,8,9,34,35, 256,256,256,256,256,256,33,33,8,9,34,35,
256,256,256,256,256,256,34,35,8,9,33,33, 256,256,256,256,256,97,34,35,8,9,33,33,
256,256,256,256,256,256,33,33,8,9,34,35, 256,256,256,256,115,100,33,33,8,9,34,35,
256,256,256,256,256,256,34,35,8,9,33,33, 256,256,256,104,101,102,34,35,8,9,33,33,
34,35,33,33,34,35,33,33,8,9,34,35, 34,35,33,33,34,35,33,33,8,9,34,35,
}, },
@@ -334,7 +334,7 @@ mapa={
40,40,40,40,40,40,40,40,40,40,40,40, 40,40,40,40,40,40,40,40,40,40,40,40,
45,44,45,44,45,44,45,44,45,44,45,40, 45,44,45,44,45,44,45,44,45,44,45,40,
256,256,256,256,256,256,256,256,73,74,256,40, 256,256,256,256,256,256,256,256,73,74,256,40,
256,256,113,256,256,114,256,256,89,90,256,40, 256,256,113,256,256,114,256,121,89,90,256,40,
256,256,256,256,256,256,256,101,102,103,256,40, 256,256,256,256,256,256,256,101,102,103,256,40,
44,45,41,83,256,44,45,44,45,44,45,40, 44,45,41,83,256,44,45,44,45,44,45,40,
@@ -372,31 +372,31 @@ mapa={
-- 38 -- 38
{ {
27,26,27,28,29,256,256,28,29,26,27,26, 27,26,27,28,29,256,256,28,29,26,27,26,
29,256,256,256,256,256,256,256,256,256,256,28, 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,98,96,98,256,256,98,98,96,256,256,
256,256,99,256,100,256,256,99,256,100,256,256, 256,256,99,256,100,256,256,99,256,100,256,256,
256,256,256,256,256,256,256,256,10,11,256,256, 256,256,256,256,256,69,256,256,10,11,256,256,
29,28,29,28,29,256,256,28,10,11,29,28, 29,28,29,28,29,256,256,28,10,11,29,28,
}, },
-- 39 -- 39
{ {
28,29,28,29,28,29,28,29,28,29,28,29, 28,29,25,25,28,29,25,25,28,29,25,25,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,25,25,256,256,256,256,256,256,106,24,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,69,256,256,256,256,256,256,95,24,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,78,97,107,108,256,106,105,24,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,69,256,94,101,102,110,103,105,98,24,
28,29,256,256,28,29,28,29,28,29,28,29, 28,29,256,256,28,29,28,29,28,29,28,29,
}, },
-- 40 -- 40
{ {
28,29,28,29,28,29,28,29,8,9,26,27, 24,29,28,29,28,29,28,29,8,9,26,27,
256,256,256,256,256,256,256,256,8,9,25,25, 24,256,256,256,256,256,256,256,8,9,25,25,
256,256,256,256,256,256,256,256,8,9,26,27, 24,256,256,256,256,256,256,256,8,9,26,27,
256,256,256,256,256,256,256,256,8,9,25,25, 24,256,114,121,256,256,112,256,8,9,25,25,
256,256,256,256,256,256,256,256,8,9,26,27, 24,256,256,101,102,103,256,256,8,9,26,27,
28,29,28,29,28,29,28,29,28,29,25,25, 24,29,28,29,28,29,28,29,28,29,25,25,
}, },
-- 41 -- 41
@@ -452,10 +452,10 @@ mapa={
-- 46 -- 46
{ {
18,19,18,19,256,256,256,20,21,20,21,20, 18,19,18,19,256,256,256,20,21,20,21,20,
18,19,256,256,17,256,256,256,256,256,256,256, 18,19,72,256,17,256,256,256,256,256,256,256,
18,19,256,256,256,0,256,256,256,256,256,256, 18,19,88,256,256,0,256,256,256,256,256,256,
18,19,256,256,256,256,0,256,256,256,256,256, 18,19,256,75,76,78,0,256,256,116,256,256,
18,19,256,256,256,256,256,0,256,256,256,256, 18,19,256,91,92,94,95,0,256,101,102,256,
18,19,18,19,18,19,18,19,18,19,18,19, 18,19,18,19,18,19,18,19,18,19,18,19,
}, },
@@ -463,40 +463,40 @@ mapa={
{ {
20,21,20,21,20,21,20,21,20,21,20,21, 20,21,20,21,20,21,20,21,20,21,20,21,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256, 256,97,96,98,97,256,256,96,97,98,96,256,
256,256,256,256,256,256,256,256,256,256,256,256, 114,99,256,256,100,114,114,99,256,256,100,114,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,256,256,256,256,256,256,256,256,
18,19,18,19,18,19,18,19,18,19,18,19, 18,19,18,19,18,19,18,19,18,19,18,19,
}, },
-- 48 -- 48
{ {
21,20,21,20,21,256,256,20,10,11,20,21, 20,21,20,21,17,256,256,17,10,11,20,21,
256,256,256,256,256,256,256,256,10,11,256,256, 256,256,256,256,256,256,69,256,10,11,256,256,
256,256,256,256,256,256,256,256,10,11,256,256, 256,256,96,97,256,256,69,256,10,11,256,256,
256,256,256,256,256,256,256,256,10,11,256,256, 256,115,99,100,256,256,256,256,10,11,256,256,
256,256,256,256,256,256,256,256,10,11,256,256, 256,101,102,103,256,69,256,256,10,11,256,256,
19,18,19,18,19,256,256,18,19,18,19,18, 19,18,19,18,19,256,256,18,19,18,19,18,
}, },
-- 49 -- 49
{ {
20,21,256,256,20,21,20,21,20,21,20,21, 20,21,256,69,18,19,18,19,20,21,20,21,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,256,256,256,256,256,256,114,256,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,69,256,256,256,114,256,256,256,256,256,
256,256,256,256,256,256,256,256,256,256,256,256, 256,114,69,256,256,256,256,256,17,18,19,17,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,18,19,18,19,18,19,18,19,
18,19,256,256,18,19,18,19,18,19,18,19, 18,19,256,256,17,18,19,18,19,18,19,17,
}, },
-- 50 -- 50
{ {
20,21,20,21,20,21,20,21,20,21,20,16, 20,21,20,21,20,21,20,21,20,21,20,16,
256,256,256,256,256,256,256,256,256,256,256,16, 256,114,256,256,256,256,256,256,256,256,98,16,
256,256,256,256,256,256,256,256,256,256,256,16, 256,256,256,256,256,256,256,256,256,256,100,16,
256,256,256,256,256,256,256,256,256,256,256,16, 17,19,256,256,256,114,256,256,256,256,78,16,
256,256,256,256,256,256,256,256,256,256,256,16, 18,19,18,19,256,256,256,256,256,256,94,16,
19,18,19,18,19,18,19,256,80,17,18,19, 17,18,19,18,19,18,19,256,80,17,18,19,
}, },
-- 51 -- 51
@@ -571,19 +571,19 @@ mapa={
}, },
-- 58 -- 58
{ {
35,34,35,34,35,256,256,34,35,34,35,34, 35,34,35,34,35,69,256,34,35,34,35,34,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,256,69,256,256,256,256,256,256,
256,113,70,71,114,256,256,112,107,108,113,256, 256,113,70,71,114,256,256,112,107,108,113,256,
256,256,86,87,256,256,256,256,109,110,256,256, 256,256,86,87,256,256,69,256,109,110,256,256,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,256,256,256,69,256,256,256,256,256,
37,36,37,36,37,256,256,36,37,36,37,36, 37,36,37,36,37,256,256,36,37,36,37,36,
}, },
-- 59 -- 59
{ {
34,35,256,256,34,35,34,35,34,35,34,35, 34,35,256,256,34,35,34,35,34,35,34,35,
256,256,256,256,256,256,256,256,256,256,256,256, 256,256,256,69,256,256,256,256,256,256,256,256,
256,256,256,256,256,256,97,96,256,256,256,256, 256,256,69,256,256,256,97,96,256,256,256,256,
256,256,256,256,256,256,99,100,256,256,256,256, 256,256,256,256,256,256,99,100,256,256,256,256,
256,41,120,119,41,256,256,256,8,9,256,256, 256,41,120,119,41,256,256,256,8,9,256,256,
3,41,46,47,41,3,36,37,8,9,36,37, 3,41,46,47,41,3,36,37,8,9,36,37,
@@ -592,10 +592,10 @@ mapa={
-- 60 -- 60
{ {
35,34,35,34,35,34,35,256,256,33,34,35, 35,34,35,34,35,34,35,256,256,33,34,35,
256,256,256,256,256,256,256,256,256,33,34,35, 256,256,36,37,256,256,256,256,256,33,34,35,
256,256,256,256,256,256,256,256,2,256,34,35, 256,256,256,256,256,256,256,256,2,77,34,35,
256,256,256,256,256,256,256,2,256,256,34,35, 256,256,116,256,256,256,256,2,256,93,34,35,
256,256,256,256,256,256,2,256,256,256,34,35, 256,256,101,102,103,256,2,256,256,256,34,35,
36,37,36,37,36,37,36,37,36,37,36,37, 36,37,36,37,36,37,36,37,36,37,36,37,
}, },
@@ -671,32 +671,32 @@ mapa={
}, },
-- 68 -- 68
{ {
25,28,29,28,29,256,256,28,29,28,29,28, 25,28,29,26,27,256,69,26,27,28,29,28,
24,256,256,256,256,256,256,256,256,256,256,256, 24,97,256,256,256,256,256,256,256,256,256,256,
24,256,256,256,256,256,256,256,256,256,256,256, 24,99,256,256,256,69,256,256,256,256,256,256,
24,256,256,256,256,256,256,256,256,256,256,256, 24,256,95,256,113,69,256,256,114,75,76,256,
24,256,256,256,256,256,256,256,256,256,256,256, 24,101,102,103,256,256,256,256,256,91,92,256,
28,28,29,28,29,256,256,28,29,28,29,28, 28,28,29,28,29,256,69,28,29,28,29,28,
}, },
-- 69 -- 69
{ {
28,29,28,29,28,29,28,29,8,9,28,29, 28,29,26,27,26,27,28,29,8,9,28,29,
256,256,256,28,29,256,256,256,8,9,256,256,
256,256,256,256,256,256,256,256,8,9,256,256, 256,256,256,256,256,256,256,256,8,9,256,256,
256,256,256,256,256,256,256,256,8,9,256,256, 75,76,75,76,75,76,75,76,8,9,256,256,
256,256,256,256,256,256,256,256,8,9,256,256, 91,92,91,92,91,92,91,92,8,9,256,256,
256,256,256,256,256,256,256,256,8,9,256,256, 28,29,1,26,27,1,28,29,8,9,28,29,
28,29,28,29,28,29,28,29,8,9,28,29,
}, },
-- 70 -- 70
{ {
28,29,26,27,26,27,26,27,26,27,26,27, 28,29,26,27,25,25,256,256,65,256,256,256,
256,256,256,256,28,29,26,27,26,27,26,27, 256,256,256,77,26,27,256,256,256,68,256,256,
256,256,256,256,256,256,256,256,28,29,26,27, 256,256,256,93,25,25,256,256,256,256,66,256,
256,256,256,256,256,69,256,256,256,256,256,256, 256,256,256,78,26,27,256,66,256,256,256,67,
256,256,256,256,256,256,256,256,26,27,26,27, 256,256,95,94,25,25,256,256,256,256,256,256,
28,29,28,29,26,27,26,27,26,27,26,27, 28,29,28,29,26,27,54,56,54,56,55,54,
}, },
-- 71 -- 71
@@ -772,8 +772,8 @@ mapa={
-- 78 -- 78
{ {
51,52,53,51,52,256,256,52,53,51,52,17, 51,52,53,51,52,256,256,52,53,51,52,17,
256,256,256,256,256,256,256,256,256,256,256,17, 256,256,256,256,256,256,69,256,256,256,256,17,
256,256,256,256,256,256,256,106,256,256,256,17, 256,256,256,256,256,69,256,106,256,256,256,17,
256,256,256,256,17,256,256,17,256,256,78,17, 256,256,256,256,17,256,256,17,256,256,78,17,
256,256,256,256,17,118,119,17,256,95,94,17, 256,256,256,256,17,118,119,17,256,95,94,17,
51,52,53,53,51,53,52,53,51,52,51,17, 51,52,53,53,51,53,52,53,51,52,51,17,

View File

@@ -62,7 +62,7 @@ function mapa_save()
io.close(file) io.close(file)
end end
anim_tiles={113,114,112,116,117,115,119,120,118} anim_tiles={113,114,112,116,117,115,119,120,118,122,121}
function mapa_update(hab1,hab2) function mapa_update(hab1,hab2)
mapa.wait=mapa.wait+1 mapa.wait=mapa.wait+1

View File

@@ -1,4 +1,4 @@
premiere={hab=44,x=24,y=24,flip=true,frame=0,wait=0,step=0,anim={11,12,11,13},bb={x=4,y=0,w=8,h=16}} premiere={hab=44,x=24,y=24,flip=true,frame=11,wait=0,step=0,anim={11,12,11,13},bb={x=4,y=0,w=8,h=16},scene_intro=false,scene_object=false}
function premiere.init() function premiere.init()
premiere.hit=premiere.hit premiere.hit=premiere.hit
@@ -49,12 +49,17 @@ function premiere.update_normal()
premiere.update=premiere.update_falling premiere.update=premiere.update_falling
end end
-- if premiere.hab==abad.hab then if premiere.hab==abad.hab then
-- if aabb(abad,premiere) then if aabb(abad,premiere) then
-- if abad.energia>0 then abad.energia=abad.energia-1 end if not premiere.scene_intro then
-- cls(3) start_scene(scenes.premiere_intro)
-- end premiere.scene_intro=true
-- end elseif not premiere.scene_object and abad.objects.gorro~=nil then
start_scene(scenes.premiere_gorro)
premiere.scene_object=true
end
end
end
end end
end end

117
scenes.lua Normal file
View File

@@ -0,0 +1,117 @@
scenes={
abad_inici={
{x=4,y=0,flip=false,text={"Be, millor me fique a","buscar... com s'eixia","d'esta habitacio???"}},
{x=4,y=0,flip=true,text={"Perque parles en","tu mateix?",""}},
{x=4,y=0,flip=false,text={"No se, tio...","",""}}
}
--premiere_intro={x=4,y=0,text={"Be, millor me fique a","buscar... com s'eixia","d'esta habitacio???"}}
}
function start_scene(scene)
bkg=newsurf(128,96)
setdest(bkg)
setsource(0)
sspr(0,0,128,96,0,0)
setsource(tiles)
setdest(0)
_update=update_scene
scenes.current_scene=scene
scenes.dnum=1
scenes.step=0
scenes.char=1
scenes.wait=0
end
function draw_scene()
local txt_x = not scenes.current_scene[scenes.dnum].flip and 38 or 8
camera(0,-28)
if scenes.step==0 then
rectfill(0,16,128,17,12)
line(0,15,128,15,16)
line(0,18,128,18,16)
elseif scenes.step==1 then
rectfill(0,8,128,26,12)
line(0,7,128,7,16)
line(0,27,128,27,16)
elseif scenes.step==2 then
rectfill(0,0,128,34,12)
line(0,0,128,0,16)
line(0,34,128,34,16)
elseif scenes.step==3 then
if not scenes.current_scene[scenes.dnum].flip then
rectfill(8,12,31,23,16)
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,9,13,20,10)
else
rectfill(97,12,120,23,16)
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,98,13,20,10,true)
end
elseif scenes.step==4 then
if not scenes.current_scene[scenes.dnum].flip then
rectfill(8,7,31,28,16)
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,9,8,20,20)
else
rectfill(97,7,120,28,16)
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,98,8,20,20,true)
end
elseif scenes.step==5 then
text(string.sub(scenes.current_scene[scenes.dnum].text[1],1,scenes.char),txt_x,7,2)
if scenes.char<#scenes.current_scene[scenes.dnum].text[1] then
scenes.step=scenes.step-1
scenes.char=scenes.char+1
else
scenes.char=1
end
elseif scenes.step==6 then
text(string.sub(scenes.current_scene[scenes.dnum].text[2],1,scenes.char),txt_x,15,2)
if scenes.char<#scenes.current_scene[scenes.dnum].text[2] then
scenes.step=scenes.step-1
scenes.char=scenes.char+1
else
scenes.char=1
end
elseif scenes.step==7 then
text(string.sub(scenes.current_scene[scenes.dnum].text[3],1,scenes.char),txt_x,23,2)
if scenes.char<#scenes.current_scene[scenes.dnum].text[3] then
scenes.step=scenes.step-1
scenes.char=scenes.char+1
else
scenes.char=1
end
elseif scenes.step==8 then
rectfill(0,0,128,34,12)
line(0,0,128,0,16)
line(0,34,128,34,16)
if not scenes.current_scene[scenes.dnum].flip then
rectfill(8,7,31,28,16)
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,9,8,20,20)
else
rectfill(97,7,120,28,16)
sspr(scenes.current_scene[scenes.dnum].x,scenes.current_scene[scenes.dnum].y,10,10,98,8,20,20,true)
end
text(scenes.current_scene[scenes.dnum].text[1],txt_x,7,2)
text(scenes.current_scene[scenes.dnum].text[2],txt_x,15,2)
text(scenes.current_scene[scenes.dnum].text[3],txt_x,23,2)
end
if scenes.step<=8 then scenes.step=scenes.step+1 end
camera(0,0)
end
function update_scene()
scenes.wait=scenes.wait+1
if scenes.wait==6 then
scenes.wait=0
draw_scene()
end
if btnp(KEY_SPACE) and scenes.step>8 then
if scenes.dnum==#scenes.current_scene then
freesurf(bkg)
_update=update_game
else
scenes.dnum=scenes.dnum+1
scenes.step=2
end
elseif anykey() then
scenes.step=8
end
end

23
starter.lua Normal file
View File

@@ -0,0 +1,23 @@
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

BIN
tiles.gif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB