diff --git a/data/game.lua b/data/game.lua index 25426b5..52c2263 100644 --- a/data/game.lua +++ b/data/game.lua @@ -11,6 +11,7 @@ require "gota" require "bol" require "gorro" require "gps" +require "peu" local tile_w = arcade_config.tiles_width local tile_h = arcade_config.tiles_height @@ -35,6 +36,9 @@ function game_init(menu) gorro.init() table.insert(actors,gorro) + peu.init() + table.insert(actors,peu) + bol.init() table.insert(actors,bol) diff --git a/data/peu.lua b/data/peu.lua new file mode 100644 index 0000000..a984608 --- /dev/null +++ b/data/peu.lua @@ -0,0 +1,54 @@ +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 = arc_mapa_get_coords(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