55 lines
1.5 KiB
Lua
55 lines
1.5 KiB
Lua
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=6,y=3,w=32,h=32,bb={x=0,y=0,w=16,h=16}}
|
|
|
|
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.x=habs[r][2]
|
|
|
|
local world_x, world_y = coords.room_to_world(peu.hab,peu.x,peu.y)
|
|
peu.x=world_x
|
|
peu.y=world_y
|
|
|
|
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)
|
|
|
|
local x = peu_gif_col*cw
|
|
local y = peu_gif_row*ch
|
|
if viewp:inside(peu.x, peu.y, peu.w, peu.h) then
|
|
local scr_x, scr_y = viewp:screen_coords( peu.x, peu.y )
|
|
draw.surf(x,y,peu.w,peu.h,scr_x,scr_y,peu.w,peu.h)
|
|
end
|
|
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
|