Consistency/data/entities/animals/boss_gate/gate_monster_push.lua

18 lines
510 B
Lua
Raw Normal View History

2021-08-20 01:53:47 +00:00
dofile_once("data/scripts/lib/utilities.lua")
local entity_id = GetUpdatedEntityID()
local pos_x, pos_y = EntityGetTransform( entity_id )
--local t = GameGetFrameNum()
for _,id in pairs(EntityGetInRadiusWithTag(pos_x, pos_y, 90, "gate_monster")) do
if id ~= entity_id then
-- repel other gate monsters to prevent them from sticking together
local x,y = EntityGetTransform(id)
x = x- pos_x
y = y- pos_y
x, y = vec_normalize(x, y)
x, y = vec_mult(x, y, 800)
PhysicsApplyForce(id, x, y)
end
end