Files
X2_cacaus/data/peu.lua

43 lines
1.1 KiB
Lua

local arcade_config = require("arcade_config")
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
peu_gif_col = 7
peu_gif_row = 2
peu={hab=5,x=48,y=24,bb={x=0,y=0,w=8,h=8}}
function peu.init()
local habs={{18,8},{16,2},{16,7},{15,5},{27,1},{27,10},{29,2},{38,8},{69,2},{79,3}}
local r=1+math.random(0,#habs-1)
peu.hab=habs[r][1]
peu.x=habs[r][2]*8
peu.update=peu.update
peu.draw=peu.draw
end
function peu.draw()
-- draw.surf(112,32,16,16,peu.x,peu.y,16,16)
local x = peu_gif_col*cw
local y = peu_gif_row*ch
draw.surf(x,y,cw,ch,peu.x*o2aX,peu.y*o2aX,cw,ch)
end
function peu.update()
if peu.hab==abad.hab then
if aabb(abad,peu) then
abad.objects.peu=true
if elalien.scene_intro then
start_scene(scenes.peu_trobat)
else
start_scene(scenes.peu_trobat_nointro)
end
if abad.objects.gps~=nil then current_camera=4 end
remove_actor(peu)
end
end
end