El monstruitos ja fan pupa

This commit is contained in:
2026-03-29 19:32:13 +02:00
parent fa74a841e7
commit 8d84cdbda1
5 changed files with 30 additions and 9 deletions

View File

@@ -136,6 +136,7 @@ function abad_hurt(howmuch)
surf.cls(3)
end
end
abad.respawning = 120
end
function abad_do_jump ( jumpfwd )

View File

@@ -73,7 +73,12 @@ function caco:update_normal()
self.flip=not self.flip
end
if viewp:inside(self.x, self.y, self.w, self.h) then
if collision(abad,self) then
abad_hurt(1)
end
end
-- if self.hab==abad.hab then
-- if aabb(abad,self) then
-- abad_hurt(1)

View File

@@ -175,16 +175,11 @@ function update_game()
arc_mapa_update()
-- Moure a tots
for key,actor in pairs(actors) do
actor:update()
--if actor.hab==cacau.hab and actor~=abad then
-- if aabb(actor,cacau) then
-- if actor.hit~=nil then
-- actor:hit()
-- cacau.hab=-1
-- end
-- end
--end
-- Comprovar dispars contra "monstres"
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
@@ -200,6 +195,7 @@ function update_game()
cacau.update()
switches.update()
-- Moure el viewport
local vp_x = viewp.x
local vp_y = viewp.y
--viewp:position(vp_x, vp_y)
@@ -214,6 +210,8 @@ function update_game()
if vp_y < 0 then vp_y = 0 end
viewp:position(vp_x, vp_y)
-- Pintar la finestra del mon
render_map(sf_mapa, tiles, vp_x, vp_y)
for key,actor in pairs(actors) do

View File

@@ -74,6 +74,17 @@ function gota:update_normal()
--self.flip=not self.flip
end
if viewp:inside(self.x, self.y, self.w, self.h) then
if collision(abad,self) then
abad_hurt(1)
self.update=gota.update_splash
self.draw=gota.draw_splash
self.cx=self.x+2
self.dx=0
self.dy=-4
end
end
-- if self.hab==abad.hab then
-- if aabb(abad,self) then
-- abad_hurt(1)

View File

@@ -62,6 +62,12 @@ function zombie:update_normal()
self.flip=not self.flip
end
if viewp:inside(self.x, self.y, self.w, self.h) then
if collision(abad,self) then
abad_hurt(1)
end
end
-- if self.hab==abad.hab then
-- if aabb(abad,self) then
-- abad_hurt(1)