[NEW] Llibre de tècniques
[NEW] Escena llibre [NEW] El abad dispara en l'aire
This commit is contained in:
@@ -46,6 +46,7 @@ function abad_init()
|
|||||||
draw=abad.draw,
|
draw=abad.draw,
|
||||||
hurting=0,
|
hurting=0,
|
||||||
update=nil,
|
update=nil,
|
||||||
|
save_update=nil,
|
||||||
jumpfwd=false,
|
jumpfwd=false,
|
||||||
step_length=1,
|
step_length=1,
|
||||||
vmove_space=1,
|
vmove_space=1,
|
||||||
@@ -156,6 +157,7 @@ end
|
|||||||
function abad_shot_cacau ()
|
function abad_shot_cacau ()
|
||||||
if cacau:available(abad.cacau_num_shots, abad.cacau_type_shot) then
|
if cacau:available(abad.cacau_num_shots, abad.cacau_type_shot) then
|
||||||
sound.play(audio_abad_shot)
|
sound.play(audio_abad_shot)
|
||||||
|
abad.save_update=abad.update
|
||||||
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)
|
||||||
@@ -346,10 +348,17 @@ function abad_state_fire()
|
|||||||
|
|
||||||
if abad.wait==6 then
|
if abad.wait==6 then
|
||||||
abad.wait=0
|
abad.wait=0
|
||||||
|
if abad.save_update==nil then
|
||||||
abad.update=abad_state_normal
|
abad.update=abad_state_normal
|
||||||
|
else
|
||||||
|
abad.update=abad.save_update
|
||||||
|
abad.save_update=nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if abad.save_update~=nil then abad_advance() end
|
||||||
|
end
|
||||||
|
|
||||||
function abad_state_walking()
|
function abad_state_walking()
|
||||||
-- Limitar la velocitat de moviment
|
-- Limitar la velocitat de moviment
|
||||||
abad.wait=abad.wait+1
|
abad.wait=abad.wait+1
|
||||||
@@ -420,6 +429,10 @@ function abad_state_jumping()
|
|||||||
|
|
||||||
if abad.jumpfwd then abad_advance() end
|
if abad.jumpfwd then abad_advance() end
|
||||||
|
|
||||||
|
if abad.objects.llibre and controller:check("shoot") then
|
||||||
|
abad_shot_cacau()
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function abad_state_falling()
|
function abad_state_falling()
|
||||||
@@ -456,6 +469,10 @@ function abad_state_falling()
|
|||||||
abad.jump_height = abad.jump_height-1
|
abad.jump_height = abad.jump_height-1
|
||||||
abad.falling=abad.falling+1
|
abad.falling=abad.falling+1
|
||||||
if abad.jumpfwd then abad_advance() end
|
if abad.jumpfwd then abad_advance() end
|
||||||
|
|
||||||
|
if abad.objects.llibre and controller:check("shoot") then
|
||||||
|
abad_shot_cacau()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function abad_state_stairs()
|
function abad_state_stairs()
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
viewport= require("viewport")
|
viewport= require("viewport")
|
||||||
require "abad"
|
require "abad"
|
||||||
require "cacau"
|
require "cacau"
|
||||||
require "gps"
|
require "llibre"
|
||||||
require "gorro"
|
require "gorro"
|
||||||
require "peu"
|
require "peu"
|
||||||
require "premiere"
|
require "premiere"
|
||||||
@@ -98,8 +98,8 @@ function game_init(menu)
|
|||||||
abad_init()
|
abad_init()
|
||||||
table.insert(actors,abad)
|
table.insert(actors,abad)
|
||||||
|
|
||||||
gps.init()
|
llibre.init()
|
||||||
table.insert(actors,gps)
|
table.insert(actors,llibre)
|
||||||
|
|
||||||
gorro.init()
|
gorro.init()
|
||||||
table.insert(actors,gorro)
|
table.insert(actors,gorro)
|
||||||
@@ -222,7 +222,7 @@ function update_game()
|
|||||||
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
|
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
|
||||||
end
|
end
|
||||||
if key.press(key.N0) then
|
if key.press(key.N0) then
|
||||||
local abad_x, abad_y = coords.room_to_world ( 53, 3, 3 )
|
local abad_x, abad_y = coords.room_to_world ( 41, 3, 3 )
|
||||||
print(abad_x..", "..abad_y)
|
print(abad_x..", "..abad_y)
|
||||||
abad:move(abad_x, abad_y)
|
abad:move(abad_x, abad_y)
|
||||||
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
|
local scr_ax, scr_ay = viewp:screen_coords(abad_x, abad_y)
|
||||||
|
|||||||
40
data/llibre.lua
Normal file
40
data/llibre.lua
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
-- posició en el gif (tiles de 32)
|
||||||
|
llibre_gif_col = 7
|
||||||
|
llibre_gif_row = 3
|
||||||
|
|
||||||
|
llibre={name="llibre",hab=5,x=6,y=3,w=32,h=32,bb={x=0,y=0,w=32,h=32}}
|
||||||
|
|
||||||
|
function llibre.init()
|
||||||
|
-- local habs={{33,8},{13,4},{51,9},{50,4},{42,7}}
|
||||||
|
-- local r=1+math.random(0,#habs-1)
|
||||||
|
-- llibre.hab=habs[r][1]
|
||||||
|
-- llibre.x=habs[r][2]*8
|
||||||
|
-- llibre.x=habs[r][2]
|
||||||
|
llibre.hab = 41
|
||||||
|
llibre.x = 10
|
||||||
|
llibre.y = 2
|
||||||
|
|
||||||
|
local world_x, world_y = coords.room_to_world(llibre.hab,llibre.x,llibre.y)
|
||||||
|
llibre.x=world_x-4
|
||||||
|
llibre.y=world_y-3
|
||||||
|
|
||||||
|
llibre.update=llibre.update
|
||||||
|
llibre.draw=llibre.draw
|
||||||
|
end
|
||||||
|
|
||||||
|
function llibre.draw()
|
||||||
|
local x = llibre_gif_col*llibre.w
|
||||||
|
local y = llibre_gif_row*llibre.h
|
||||||
|
local scr_x, scr_y = viewp:screen_coords( llibre.x, llibre.y )
|
||||||
|
draw.surf(x,y,llibre.w,llibre.h,scr_x,scr_y,llibre.w,llibre.h)
|
||||||
|
end
|
||||||
|
|
||||||
|
function llibre.update()
|
||||||
|
if llibre.hab==abad.hab then
|
||||||
|
if collision(abad,llibre) then
|
||||||
|
abad.objects.llibre=true
|
||||||
|
remove_actor(llibre)
|
||||||
|
start_scene(scenes.llibre_trobat)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -86,7 +86,7 @@ function mini.init()
|
|||||||
surf.target(0)
|
surf.target(0)
|
||||||
surf.cls(16)
|
surf.cls(16)
|
||||||
|
|
||||||
flow:executar("logo")
|
flow:executar("game")
|
||||||
end
|
end
|
||||||
|
|
||||||
function mini.update()
|
function mini.update()
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ scenes={
|
|||||||
{x=avatar_imp_x, y=avatar_imp_y,flip=true,audio="abad",text={"","GROOOOAAAARRR",""},die=20},
|
{x=avatar_imp_x, y=avatar_imp_y,flip=true,audio="abad",text={"","GROOOOAAAARRR",""},die=20},
|
||||||
{x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"MERDA!!","S'HA ENFADAT!!!","CACAUS A MI!!!!"},die=20},
|
{x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"MERDA!!","S'HA ENFADAT!!!","CACAUS A MI!!!!"},die=20},
|
||||||
},
|
},
|
||||||
|
llibre_trobat={
|
||||||
|
{x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Este llibre...","Es el de les tècniques","especials ..."}},
|
||||||
|
{x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"...","TÈCNICA 'CACAU AERI'","salt i dispar"}},
|
||||||
|
{x=avatar_abad2_x,y=avatar_abad_y,flip=false,audio="abad",text={"Ja se"," 'CACAU AERI'",""}},
|
||||||
|
},
|
||||||
intro_01= {
|
intro_01= {
|
||||||
{x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Ah!, què bo!","Nit de Netflix amb","un bon bol de cacaus!"},die=20},
|
{x=avatar_abad_x,y=avatar_abad_y,flip=false,audio="abad",text={"Ah!, què bo!","Nit de Netflix amb","un bon bol de cacaus!"},die=20},
|
||||||
},
|
},
|
||||||
|
|||||||
BIN
data/tiles.gif
BIN
data/tiles.gif
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user