Function on_message(....., sender) (SOLVED)

Hi can you help me with this.

I have setup a collision object on my player and a collision object on a target.
I can get detect the collision on both objects but can not get the position of the target from the player script.

I need the position of the target, for the player to look and aim at.

1 Like

when they collide,
just say,

if message_id== hash("collision_response") then
if message.group = hash("group_of_enemy") then
pprint(message.other_id)
end
end

This will print id of your target> You basically get the other id by message.other_id and do what ever you want with it.

2 Likes

Thank you for a fast reply, It works and I understand it a bit more now thank you TheKing009

1 Like

@TheKing0x9 typo here: if message.group = hash("group_of_enemy")
should be ==

3 Likes

Uh Oh! I will be careful next time .:face_with_monocle:

1 Like