[Solved] Connecting objects to another

Hi, so I am making a game where there are enemies that can collect bubbles (circles) and the circles will stick to them. I have made other threads about this game. What I am facing is, when a enemy collided with the circles, it sometimes does not stick or sometimes moves the circles, but not to the enemy (Thinking that it is moving to another enemy). I tried linking them, it does not work. I tried using ID’s but could not find a way to check if that circle is part of that enemy unless l “use for each object” which make the game lag. Can someone help me? I tried fixing it for many hours, but for no good

Thanks for helping :heart:

Most basic use for this is to set the position of the bubble to you enemy on collision
Set an object variable to bubbles like obj_var_collided = 0

Enemy collision with bubbles
Cahnge bubble obj_var_collided = 1
In another event execute always
if obj_var_collided of bubbles = 1
Change position of bubbles to enemy.x, enemy.y

Then maybe add some timer or a tween to fade out the bubble after some time.

1 Like

Just because it didn’t work doesn’t mean it will never work. :slight_smile:
Try again and show the events when you’re stuck.

1 Like

You are right!! I found a way to solve it! WHat I am doing is when a enemy is created, it makes a ID for and when a object collides with it, that circle is assigned that enemies ID. Then, I created a “for each enemy” “if ID of circle = enemy” then, “put circle around the enmy”. It works, but it is a bit performance hog as I am using “for each enemy”. But it is fine as it is a jam game and also was my computer is very old. But, tips for improving performance is helpful. But, now I am having another problem, which I will make a thread about (Because it is not related to this problem)

1 Like