Moguda la comprovació de pintar fora de la funció draw de cada actor

This commit is contained in:
2026-03-29 17:02:05 +02:00
parent 2c93003fe2
commit 7f4f29ecc2
12 changed files with 44 additions and 53 deletions

View File

@@ -8,7 +8,8 @@ caco={}
function caco.new(_hab,_x,_y,_flip)
local world_x, world_y = coords.room_to_world(_hab,_x,_y)
return {hab=_hab,
return {name="caco",
hab=_hab,
x=world_x,
y=world_y,
w=arcade_config.sprite_size.w,
@@ -29,7 +30,7 @@ function caco:draw()
-- if self.frame>0 then draw.surf((self.frame&7)*16,(self.frame>>3)*16,16,16,self.x,self.y,16,16,self.flip) end
-- if self.frame>0 then draw.surf((self.frame&7)*cw,(self.frame>>cxr2)*ch,cw,ch,self.x*o2aX,self.y*o2aX,cw,ch,self.flip) end
if self.frame>0 and viewp:inside(self.x, self.y, self.w, self.h) then
if self.frame>0 then
local scr_x, scr_y = viewp:screen_coords( self.x, self.y )
draw.surf((self.frame&7)*cw, (self.frame>>cxr2)*ch, cw, ch, scr_x, scr_y, cw, ch, self.flip)
end