[WIP] Cacauaes començant a funcionar
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
arcade_config = require("arcade_config")
|
||||
viewport= require("viewport")
|
||||
|
||||
require "fps"
|
||||
require "mapa"
|
||||
require "abad"
|
||||
require "cacau"
|
||||
require "caco"
|
||||
@@ -189,7 +185,18 @@ function update_game()
|
||||
-- end
|
||||
-- end
|
||||
--end
|
||||
if viewp:inside(actor.x, actor.y, actor.w, actor.h) and actor~=abad then
|
||||
for _, cacau_shot in pairs(cacau.shots()) do
|
||||
if cacau_shot.alive and collision(actor,cacau_shot) then
|
||||
if actor.hit ~= nil then
|
||||
actor:hit()
|
||||
cacau:kill(cacau_shot)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
cacau.update()
|
||||
switches.update()
|
||||
|
||||
@@ -265,42 +272,10 @@ function update_game()
|
||||
-- end
|
||||
end
|
||||
|
||||
function msg_print(x, y, msg, direct_print )
|
||||
local scr_x, scr_y
|
||||
direct_print = direct_print or false
|
||||
if direct_print then
|
||||
scr_x = x
|
||||
scr_y = y
|
||||
else
|
||||
scr_x, scr_y = viewp:screen_coords(x, y)
|
||||
end
|
||||
draw.rectf(scr_x,scr_y,45,7,16)
|
||||
draw.text(msg,scr_x+1,scr_y+1,2)
|
||||
function collision(a, b)
|
||||
return (a.x+a.bb.x+a.bb.w >= b.x+b.bb.x)
|
||||
and (a.x+a.bb.x <= b.x+b.bb.x+b.bb.w)
|
||||
and (a.y+a.bb.y+a.bb.h >= b.y+b.bb.y)
|
||||
and (a.y+a.bb.y <= b.y+b.bb.y+b.bb.h)
|
||||
end
|
||||
|
||||
function view_coord(x, y, w, h, color)
|
||||
local scr_x, scr_y = viewp:screen_coords(x, y)
|
||||
draw.rect(scr_x, scr_y, w, h, color)
|
||||
end
|
||||
|
||||
function write_tile(x, y, yplus, print_type, align )
|
||||
local scr_x, scr_y = viewp:screen_coords(x, y)
|
||||
local hab, xx, yy = coords.world_to_tile(x, y)
|
||||
|
||||
yplus = yplus or 0
|
||||
print_type = print_type or false
|
||||
align = align or "R"
|
||||
|
||||
local txt_offset = -7
|
||||
if align=="R" then txt_offset = -14
|
||||
elseif align=="L" then txt_offset = 0
|
||||
end
|
||||
|
||||
draw.rectf(scr_x+txt_offset,scr_y+yplus,14,7,16)
|
||||
-- local msg = mapa_get_tile(hab,xx,yy)
|
||||
local msg = arc_get_tile(x,y)
|
||||
if print_type then
|
||||
msg = msg.." "..arc_check_tile(x, y)
|
||||
end
|
||||
draw.text(msg,scr_x+txt_offset+1,scr_y+1+yplus,2)
|
||||
end
|
||||
Reference in New Issue
Block a user