How to find a game objects collision group?

hiya,

I’m making an infinite runner sorta thing. theres a player, jumps, and rocks. if you collide with a jump, you jump, and if you collide with a rock, you die/fall/whatever. heres my code to do with triggering a jump -

function on_message(self, message_id, message, sender)
	
	if message_id == hash("collision_response") then 
               --if you're not jumping already then do a jump
		if self.jump == false then
			self.jumpspeed = self.yspeed/20
			self.jump = true
		end
		
	end
end

But the problem is the same thing happens when you hit a rock, or anything with a collision object on it. so how do i make this only happen if the thing you’re colliding with is in the collision group “jumps” ? Is that the way i should handle this? or is there some other way this is meant to work?

Hi @bill.northcott!
In the documentation for collision_response you’ll find message.other_group which should do what you want.

4 Likes