Gorro possat
This commit is contained in:
@@ -9,6 +9,7 @@ require "caco"
|
|||||||
require "zombie"
|
require "zombie"
|
||||||
require "gota"
|
require "gota"
|
||||||
require "bol"
|
require "bol"
|
||||||
|
require "gorro"
|
||||||
|
|
||||||
local tile_w = arcade_config.tiles_width
|
local tile_w = arcade_config.tiles_width
|
||||||
local tile_h = arcade_config.tiles_height
|
local tile_h = arcade_config.tiles_height
|
||||||
@@ -27,6 +28,9 @@ function game_init(menu)
|
|||||||
abad_init()
|
abad_init()
|
||||||
table.insert(actors,abad)
|
table.insert(actors,abad)
|
||||||
|
|
||||||
|
gorro.init()
|
||||||
|
table.insert(actors,gorro)
|
||||||
|
|
||||||
bol.init()
|
bol.init()
|
||||||
table.insert(actors,bol)
|
table.insert(actors,bol)
|
||||||
|
|
||||||
@@ -63,7 +67,7 @@ function game_init(menu)
|
|||||||
table.insert( actors, zombie.new(73, 3, 3,false) )
|
table.insert( actors, zombie.new(73, 3, 3,false) )
|
||||||
|
|
||||||
local abad_x, abad_y = arc_mapa_get_coords ( 10, 4, 3 )
|
local abad_x, abad_y = arc_mapa_get_coords ( 10, 4, 3 )
|
||||||
local abad_x, abad_y = arc_mapa_get_coords ( 77, 3, 2 )
|
-- local abad_x, abad_y = arc_mapa_get_coords ( 77, 3, 2 )
|
||||||
abad:move(abad_x, abad_y)
|
abad:move(abad_x, abad_y)
|
||||||
abad_make_safe( true )
|
abad_make_safe( true )
|
||||||
|
|
||||||
|
|||||||
53
data/gorro.lua
Normal file
53
data/gorro.lua
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
o2aX = arcade_config.org2arc_escala
|
||||||
|
cxr = arcade_config.character_per_row-1
|
||||||
|
cxr2 = arcade_config.character_per_row_base2
|
||||||
|
cw = arcade_config.character_width
|
||||||
|
ch = arcade_config.character_height
|
||||||
|
-- posició en el gif
|
||||||
|
gorro_gif_col = 6
|
||||||
|
gorro_gif_row = 2
|
||||||
|
|
||||||
|
gorro={hab=5,x=6,y=3,w=32,h=32,bb={x=0,y=0,w=16,h=16}}
|
||||||
|
|
||||||
|
function gorro.init()
|
||||||
|
local habs={{60,5},{4,5},{34,4},{62,7},{75,4}}
|
||||||
|
local r=1+math.random(0,#habs-1)
|
||||||
|
gorro.hab=habs[r][1]
|
||||||
|
-- gorro.x=habs[r][2]*8
|
||||||
|
gorro.x=habs[r][2]
|
||||||
|
|
||||||
|
local world_x, world_y = arc_mapa_get_coords(gorro.hab,gorro.x,gorro.y)
|
||||||
|
gorro.x=world_x
|
||||||
|
gorro.y=world_y
|
||||||
|
gorro.update=gorro.update
|
||||||
|
gorro.draw=gorro.draw
|
||||||
|
end
|
||||||
|
|
||||||
|
function gorro.draw()
|
||||||
|
-- draw.surf(96,32,16,16,gorro.x,gorro.y,16,16)
|
||||||
|
-- local x = gorro_gif_col*cw
|
||||||
|
-- local y = gorro_gif_row*ch
|
||||||
|
-- draw.surf(x,y,cw,ch,gorro.x*o2aX,gorro.y*o2aX,cw,ch)
|
||||||
|
|
||||||
|
local x = gorro_gif_col*cw
|
||||||
|
local y = gorro_gif_row*ch
|
||||||
|
if viewp:inside(gorro.x, gorro.y, gorro.w, gorro.h) then
|
||||||
|
local scr_x, scr_y = viewp:screen_coords( gorro.x, gorro.y )
|
||||||
|
draw.surf(x,y,gorro.w,gorro.h,scr_x,scr_y,gorro.w,gorro.h)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function gorro.update()
|
||||||
|
-- if gorro.hab==abad.hab then
|
||||||
|
-- if aabb(abad,gorro) then
|
||||||
|
-- abad.objects.gorro=true
|
||||||
|
-- if premiere.scene_intro then
|
||||||
|
-- start_scene(scenes.gorro_trobat)
|
||||||
|
-- else
|
||||||
|
-- start_scene(scenes.gorro_trobat_nointro)
|
||||||
|
-- end
|
||||||
|
-- if abad.objects.gps~=nil then current_camera=3 end
|
||||||
|
-- remove_actor(gorro)
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user