GPS comprat
This commit is contained in:
@@ -10,6 +10,7 @@ require "zombie"
|
|||||||
require "gota"
|
require "gota"
|
||||||
require "bol"
|
require "bol"
|
||||||
require "gorro"
|
require "gorro"
|
||||||
|
require "gps"
|
||||||
|
|
||||||
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
|
||||||
@@ -28,6 +29,9 @@ function game_init(menu)
|
|||||||
abad_init()
|
abad_init()
|
||||||
table.insert(actors,abad)
|
table.insert(actors,abad)
|
||||||
|
|
||||||
|
gps.init()
|
||||||
|
table.insert(actors,gps)
|
||||||
|
|
||||||
gorro.init()
|
gorro.init()
|
||||||
table.insert(actors,gorro)
|
table.insert(actors,gorro)
|
||||||
|
|
||||||
|
|||||||
56
data/gps.lua
Normal file
56
data/gps.lua
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
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
|
||||||
|
gps_gif_col = 7
|
||||||
|
gps_gif_row = 3
|
||||||
|
|
||||||
|
gps={hab=5,x=6,y=3,w=32,h=32,bb={x=0,y=0,w=16,h=16}}
|
||||||
|
|
||||||
|
function gps.init()
|
||||||
|
local habs={{33,8},{13,4},{51,9},{50,4},{42,7}}
|
||||||
|
local r=1+math.random(0,#habs-1)
|
||||||
|
gps.hab=habs[r][1]
|
||||||
|
-- gps.x=habs[r][2]*8
|
||||||
|
gps.x=habs[r][2]
|
||||||
|
|
||||||
|
local world_x, world_y = arc_mapa_get_coords(gps.hab,gps.x,gps.y)
|
||||||
|
gps.x=world_x
|
||||||
|
gps.y=world_y
|
||||||
|
|
||||||
|
gps.update=gps.update
|
||||||
|
gps.draw=gps.draw
|
||||||
|
end
|
||||||
|
|
||||||
|
function gps.draw()
|
||||||
|
-- draw.surf(112,48,16,16,gps.x,gps.y,16,16)
|
||||||
|
-- local x = gps_gif_col*cw
|
||||||
|
-- local y = gps_gif_row*ch
|
||||||
|
-- draw.surf(x,y,cw,ch,gps.x*o2aX,gps.y*o2aX,cw,ch)
|
||||||
|
|
||||||
|
local x = gps_gif_col*cw
|
||||||
|
local y = gps_gif_row*ch
|
||||||
|
if viewp:inside(gps.x, gps.y, gps.w, gps.h) then
|
||||||
|
local scr_x, scr_y = viewp:screen_coords( gps.x, gps.y )
|
||||||
|
draw.surf(x,y,gps.w,gps.h,scr_x,scr_y,gps.w,gps.h)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function gps.update()
|
||||||
|
--if gps.hab==abad.hab then
|
||||||
|
-- if aabb(abad,gps) then
|
||||||
|
-- abad.objects.gps=true
|
||||||
|
-- if abad.objects.gorro==nil then
|
||||||
|
-- current_camera=1
|
||||||
|
-- elseif abad.objects.peu==nil then
|
||||||
|
-- current_camera=2
|
||||||
|
-- else
|
||||||
|
-- current_camera=3
|
||||||
|
-- end
|
||||||
|
-- remove_actor(gps)
|
||||||
|
-- start_scene(scenes.gps_trobat)
|
||||||
|
-- end
|
||||||
|
--end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user