Sticky Objects
MaceOfTanis
Member Posts: 6
Hey there guys,
I’m making a game where meteors hit the earth and you shoot them with a cannon from below. I want the bullets from the cannon to stick to the meteors when they hit, is there any way to do that?
My original logic was to say
“If bullet collides with meteor object”
-Turn sticking true
If sticking is true
-Constantly move the bullet towards the meteor object.”
The trouble is, I can’t find a way in Game Salad to identify or reference the specific instances of the actors in a collision.
Does anyone have any ideas? Or other potential methods of creating sticky objects?
Thanks.
I’m making a game where meteors hit the earth and you shoot them with a cannon from below. I want the bullets from the cannon to stick to the meteors when they hit, is there any way to do that?
My original logic was to say
“If bullet collides with meteor object”
-Turn sticking true
If sticking is true
-Constantly move the bullet towards the meteor object.”
The trouble is, I can’t find a way in Game Salad to identify or reference the specific instances of the actors in a collision.
Does anyone have any ideas? Or other potential methods of creating sticky objects?
Thanks.
Comments
when actor overlaps or collides with meteor, change linear velocity to 0 and make an attribute called sticky. constrain stick to the meteors x and y velocity. and then to continue the rule, constrain the cannons bullets to that attribute. or move toward that attribute. that should work
DL
DL
On the meteor, when you detect a collision with a bullet, change the meteor object itself (maybe the graphic) to reflect the fact that the bullet is sticking to the meteor. Then make the bullet object simply destroy itself when it his the meteor. That way the the bullet will *look* like it's stuck to the meteor, but what's actually happened is that it's gone and the meteor object has changed. The main point here is that there doesn't seem to be a way I've found in GameSalad for object A to communicate with object B except for globals, collision detection, or using a scene object that can see the other two objects.
The general question of how instances of one object communicate with instances of another object is something I've been thinking about a lot recently. One way is to use globals, but that is very hard to do when you have bunch of randomly created objects. The other way is to use a scene controller in the scene itself, because an object actually in the scene can access the variables of any other object in the scene. This only seems to work when you have already created the objects in advance, I don't know how to use it with randomly created objects.