2 Identical Actors collide to make 1 big one
So i've came to bit of a mental block here and I'm hoping someone can help:
I've set up a scene where instances of an actor are spawned in regularly. The player can touch and drag these actors around, and the idea is that if they collide with one another, they 'merge' into one larger actor. My first attempt:
On collision with the actor type, the actor is destroyed and the new large actor spawned in its place. However as this is on both actors, i just spawn 2 large actors. How can I have two identical actors collide and spawn 1 new type?
Hair. Pulled.
(other than that, really enjoying my first game with GS, so much fun!)
I've set up a scene where instances of an actor are spawned in regularly. The player can touch and drag these actors around, and the idea is that if they collide with one another, they 'merge' into one larger actor. My first attempt:
On collision with the actor type, the actor is destroyed and the new large actor spawned in its place. However as this is on both actors, i just spawn 2 large actors. How can I have two identical actors collide and spawn 1 new type?
Hair. Pulled.
(other than that, really enjoying my first game with GS, so much fun!)
Comments
_______________________________________________
http://www.gamesaladforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/
Just a thought, may not work.
@design219 - Interesting, could work yeah. I get the logic definitely - although would the collisions be handled simultaneously? or will one precede the other?
1) create a game integer attribute - game.actorcount
2) in the actor being spawned create a self integer attribute - self.actorID
3) in the actor being spawned have these two behaviors at the top:
change game.actorcount to game.actorcount + 1
chage self.actorID to game.actorcount
4) create a game integer attribute - game.currentlyGrabbed
5) back in the actor being spawned add this rule to the dragging rules that you are currently using:
change game.currentlyGrabbed to self.actorID
Then have a rule that says
when collides with actor AND
self.actorID ≠ game.currentlyGrabbed
destroy
OTHERWISE
change width to blah blah (double the width)
change height to blah blah
change image (maybe??)
Haven't tried it but it should work.
good luck
________________________________________________________________________________________________
http://www.gamesaladforum.com/
http://gshelper.com/
http://www.youtube.com/user/GameSaladCookbook#p/