[NEW] Afegida una capa al mapa per a fer coses especials
This commit is contained in:
@@ -25,8 +25,9 @@ require "trigger_event"
|
||||
|
||||
require "batman"
|
||||
require "health_potion"
|
||||
require "tiles_layer2"
|
||||
|
||||
local DEBUG = false
|
||||
local DEBUG = true
|
||||
|
||||
local tile_w = arcade_config.tiles_width
|
||||
local tile_h = arcade_config.tiles_height
|
||||
@@ -187,6 +188,7 @@ end
|
||||
function world_update()
|
||||
-- Actualitzar moviment del mapa (ex: tiles animats)
|
||||
arc_mapa_update()
|
||||
tiles_layer2.update()
|
||||
|
||||
-- Moure a tots
|
||||
for key,actor in pairs(actors) do
|
||||
@@ -227,6 +229,7 @@ end
|
||||
function world_draw()
|
||||
-- Pintar la finestra del mon
|
||||
render_map(sf_mapa, tiles, viewp.x, viewp.y)
|
||||
tiles_layer2.draw()
|
||||
|
||||
if stages.boss_loaded then stage_draw_back() end
|
||||
|
||||
|
||||
@@ -91,8 +91,11 @@ function stages.stage1_init()
|
||||
table.insert( actors, zombie.new(73, 7, 3,false) )
|
||||
table.insert( actors, zombie.new(75, 3, 3,true) )
|
||||
|
||||
local hp_x, hp_y = coords.room_to_world(11, 7, 4)
|
||||
table.insert( actors, health_potion.new(11, hp_x, hp_y, 0, 0, 1) )
|
||||
local hp_x, hp_y = coords.room_to_world(14, 10, 4)
|
||||
table.insert( actors, health_potion.new(14, hp_x, hp_y, 0, 0, 2) )
|
||||
local hp_x, hp_y = coords.room_to_world(77, 7, 4)
|
||||
table.insert( actors, health_potion.new(77, hp_x, hp_y, 0, 0, 3) )
|
||||
|
||||
|
||||
-- TRIGGERS
|
||||
-- if not menu then table.insert(actors,trigger.new(10,57,32,triggers.escena_abad_inici)) end
|
||||
@@ -149,6 +152,10 @@ function stages.stage1_init()
|
||||
nil,
|
||||
elalien, abad, 150, "I les tisores de podar?", 250)
|
||||
|
||||
tiles_layer2.new(13,11,3,144,144,16,16)
|
||||
tiles_layer2.new(13,11,4,144,144,16,16)
|
||||
tiles_layer2.new(11,10,2,128,208,16,16)
|
||||
|
||||
local abad_x, abad_y = coords.room_to_world ( 10, 4, 3 )
|
||||
-- local abad_x, abad_y = coords.room_to_world ( 54, 8, 3 )
|
||||
-- local abad_x, abad_y = coords.room_to_world ( 18, 9, 3 )
|
||||
@@ -349,7 +356,8 @@ stage1_mapa={
|
||||
-- 28,29,28,29,28,29,29,256,256,256,26,27,
|
||||
28, 29, 28, 29, 28, 29, 29, 1,256,256, 26, 27,
|
||||
256,256,256,256,256,256,256,256,256, 25, 72,256,
|
||||
256,256,73,74,256,256,256,256,1,256,88,256,
|
||||
-- 256,256, 73, 74,256,256,256,256, 1,256, 88,256,
|
||||
256,256, 73, 74,256,256,256,256, 1,256,256,256,
|
||||
256,256, 89, 90,256,256,256, 1,256,256,256,256,
|
||||
256,256,256,256,256,256, 1,256,256,256,256,256,
|
||||
28, 29, 28, 29, 28, 29, 28, 29, 28, 29, 28, 29,
|
||||
@@ -370,9 +378,11 @@ stage1_mapa={
|
||||
{
|
||||
28, 29, 28, 29, 28, 29, 28, 29, 10, 11, 28, 25,
|
||||
256,256,256,256,256,256,256,256, 10, 11,256, 25,
|
||||
256,73,74,256,256,256,256,256,10,11,256,256,
|
||||
256,89,90,256,256,75,76,256,10,11,256,25,
|
||||
256,256,256,256,256,91,92,256,10,11,256,25,
|
||||
-- 256, 73, 74,256,256,256,256,256, 10, 11,256,256,
|
||||
256, 73, 74,256,256,256,256,256, 10, 11,256, 25,
|
||||
256, 89, 90,256,256, 75, 76,256, 10, 11,256,256,
|
||||
-- 256,256,256,256,256, 91, 92,256, 10, 11,256, 25,
|
||||
256,256,256,256,256, 91, 92,256, 10, 11,256,256,
|
||||
28, 29, 28, 29, 28, 29, 28, 29, 28, 29, 28, 29,
|
||||
|
||||
},
|
||||
|
||||
BIN
data/tiles.gif
BIN
data/tiles.gif
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
41
data/tiles_layer2.lua
Normal file
41
data/tiles_layer2.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
tiles_layer2={
|
||||
surf = nil,
|
||||
tiles = {},
|
||||
}
|
||||
|
||||
function tiles_layer2.new(_hab, _x, _y, _tx, _ty, _tw, _th)
|
||||
local world_x, world_y = coords.room_to_world(_hab,_x,_y)
|
||||
print(world_x.." "..world_y)
|
||||
table.insert(
|
||||
tiles_layer2.tiles,
|
||||
{ hab = _hab,
|
||||
x = world_x,
|
||||
y = world_y,
|
||||
w = _tw,
|
||||
h = _th,
|
||||
tx = _tx,
|
||||
ty = _ty,
|
||||
tw = _tw,
|
||||
th = _th,
|
||||
}
|
||||
)
|
||||
end
|
||||
|
||||
function tiles_layer2.draw()
|
||||
for i, tile in ipairs(tiles_layer2.tiles) do
|
||||
if viewp:inside(tile.x, tile.y, tile.w, tile.h) then
|
||||
local curr_surf = surf.source()
|
||||
if tiles_layer2.surf ~= nil then
|
||||
surf.source(tiles_layer2.surf)
|
||||
end
|
||||
local scr_x, scr_y = viewp:screen_coords( tile.x, tile.y )
|
||||
draw.surf(tile.tx, tile.ty, tile.tw, tile.th,
|
||||
scr_x, scr_y, tile.tw, tile.th)
|
||||
surf.source(curr_surf)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function tiles_layer2.update()
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user