mirror of
https://github.com/libretro/lutro-platformer.git
synced 2024-11-30 03:30:25 +00:00
Resolve collisions with the sword
This commit is contained in:
parent
aa789106e9
commit
2e4303ba77
@ -201,6 +201,12 @@ function demon:on_collide(e1, e2, dx, dy)
|
||||
end
|
||||
end
|
||||
elseif e2.type == "sword" and e2.anim.id >= 4 and e2.anim.id <= 5 and self.hit == 0 and self.die == 0 then
|
||||
|
||||
if dx ~= 0 then
|
||||
self.xspeed = 0
|
||||
self.x = self.x + dx
|
||||
end
|
||||
|
||||
self.hp = self.hp - 2
|
||||
screen_shake = 15
|
||||
if self.hp <= 0 then
|
||||
|
@ -113,6 +113,11 @@ function obake:on_collide(e1, e2, dx, dy)
|
||||
end
|
||||
|
||||
elseif e2.type == "sword" and e2.anim.id >= 4 and e2.anim.id <= 5 and self.hit == 0 and self.die == 0 then
|
||||
if dx ~= 0 then
|
||||
self.xspeed = 0
|
||||
self.x = self.x + dx
|
||||
end
|
||||
|
||||
self.hit = 30
|
||||
if e2.direction == "right" then
|
||||
self.xspeed = 100
|
||||
|
5
porc.lua
5
porc.lua
@ -189,6 +189,11 @@ function porc:on_collide(e1, e2, dx, dy)
|
||||
end
|
||||
end
|
||||
elseif e2.type == "sword" and e2.anim.id >= 4 and e2.anim.id <= 5 and self.hit == 0 and self.die == 0 then
|
||||
if dx ~= 0 then
|
||||
self.xspeed = 0
|
||||
self.x = self.x + dx
|
||||
end
|
||||
|
||||
self.hp = self.hp - 1
|
||||
screen_shake = 15
|
||||
if self.hp <= 0 then
|
||||
|
Loading…
Reference in New Issue
Block a user