Bol en el lloc
This commit is contained in:
42
data/bol.lua
Normal file
42
data/bol.lua
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
toff = arcade_config.tiles_offset
|
||||||
|
tw = arcade_config.tiles_width
|
||||||
|
th = arcade_config.tiles_height
|
||||||
|
-- posició en el gif des de l'offset de tiles
|
||||||
|
bol_gif_col = 14
|
||||||
|
bol_gif_row = 3
|
||||||
|
|
||||||
|
-- bol={hab=39,x=28,y=25,w=32,h=16,bb={x=0,y=0,w=16,h=8}}
|
||||||
|
bol={hab=39,x=4,y=3,w=32,h=16,bb={x=0,y=0,w=16,h=8}}
|
||||||
|
|
||||||
|
function bol.init()
|
||||||
|
local world_x, world_y = arc_mapa_get_coords(bol.hab,bol.x,bol.y)
|
||||||
|
bol.x=world_x-8
|
||||||
|
bol.y=world_y+2
|
||||||
|
bol.update=bol.update
|
||||||
|
bol.draw=bol.draw
|
||||||
|
end
|
||||||
|
|
||||||
|
function bol.draw()
|
||||||
|
-- draw.surf(112,88,16,8,bol.x,bol.y,16,8)
|
||||||
|
|
||||||
|
-- local x = bol_gif_col*tw
|
||||||
|
-- local y = toff+bol_gif_row*th
|
||||||
|
-- draw.surf(x,y,tw*2,th,bol.x*o2aX,bol.y*o2aX,tw*2,th)
|
||||||
|
|
||||||
|
local x = bol_gif_col*tw
|
||||||
|
local y = toff+bol_gif_row*th
|
||||||
|
if viewp:inside(bol.x, bol.y, bol.w, bol.h) then
|
||||||
|
local scr_x, scr_y = viewp:screen_coords( bol.x, bol.y )
|
||||||
|
draw.surf(x,y,bol.w,bol.h,scr_x,scr_y,bol.w,bol.h)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function bol.update()
|
||||||
|
-- if bol.hab==abad.hab then
|
||||||
|
-- if aabb(abad,bol) then
|
||||||
|
-- abad.objects.bol=true
|
||||||
|
-- start_scene(scenes.bol_trobat)
|
||||||
|
-- remove_actor(bol)
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
end
|
||||||
@@ -8,6 +8,7 @@ require "cacau"
|
|||||||
require "caco"
|
require "caco"
|
||||||
require "zombie"
|
require "zombie"
|
||||||
require "gota"
|
require "gota"
|
||||||
|
require "bol"
|
||||||
|
|
||||||
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
|
||||||
@@ -26,6 +27,9 @@ function game_init(menu)
|
|||||||
abad_init()
|
abad_init()
|
||||||
table.insert(actors,abad)
|
table.insert(actors,abad)
|
||||||
|
|
||||||
|
bol.init()
|
||||||
|
table.insert(actors,bol)
|
||||||
|
|
||||||
table.insert( actors, gota.new(70,5,1,20) )
|
table.insert( actors, gota.new(70,5,1,20) )
|
||||||
table.insert( actors, gota.new(70,9,1,30) )
|
table.insert( actors, gota.new(70,9,1,30) )
|
||||||
table.insert( actors, gota.new(63,5,1,25,2,-7) )
|
table.insert( actors, gota.new(63,5,1,25,2,-7) )
|
||||||
|
|||||||
@@ -42,9 +42,9 @@ function gota:draw_normal()
|
|||||||
if viewp:inside(self.x, self.y, self.w, self.h) then
|
if viewp:inside(self.x, self.y, self.w, self.h) then
|
||||||
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
|
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
|
||||||
draw.surf(x,y,self.w,self.h,scr_x,scr_y)
|
draw.surf(x,y,self.w,self.h,scr_x,scr_y)
|
||||||
local x_check = scr_x+self.bb.x+(self.bb.w/2)-1
|
-- local x_check = scr_x+self.bb.x+(self.bb.w/2)-1
|
||||||
local y_check = scr_y+self.bb.h
|
-- local y_check = scr_y+self.bb.h
|
||||||
draw.rectf(x_check,y_check,1,1,4)
|
-- draw.rectf(x_check,y_check,1,1,4)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user