Ok, so you have some collision handling code in on_message()
right? So what you want to do is to set a flag when you collide with the player, something like:
function on_message(self, message_id, message, sender)
if message_id == hash("collision_response") then
-- check if collision was with the player (make sure its collision group is set to "player"!)
if message.other_group == hash("player") then
-- set flag
self.player_collision = true
end
end
end
Next you need to use the self.player_collision
flag in your update() logic where you move the enemy:
function update(self, dt)
-- only move player if not colliding with player
if not self.player_collision then
-- your movement code here
end
-- reset flag (it will be set again next frame if you are still colliding with the player
self.player_collision = false
end