How do I switch a bouncing ball actor when it collides with another actor?

I have a platform, a red ball and a yellow ball. The yellow ball bounces off the platform. What I need is to have the yellow ball switch to the red ball when it comes into contact with the floor but still maintain all of its attributes so its still bouncing. Been looking for a solution but can't find it. Please help. Thanks in advance.

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Can you just change the actor's color or self.Image and have rules based on the value of that?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Guns10Guns10 Member Posts: 4

    I'm afraid they have to be separate objects. Once the ball changes to a different actor, that actor has a different set of rules. thanks

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @Guns10 said:
    I'm afraid they have to be separate objects. Once the ball changes to a different actor, that actor has a different set of rules. thanks

    Those aren't mutually exclusive. A single actor can have different sets of rules based on an attribute value.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Guns10Guns10 Member Posts: 4

    Thanks Tatiang. I'll give it a shot

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Another option is to change two game attributes (e.g. game.velocityX and game.velocityY) to the yellow ball actor's self.linear velocity.x and y, then spawn the red actor and destroy the yellow actor and then in the red actor, change its velocity x and y to game.velocityX and Y.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Guns10Guns10 Member Posts: 4

    That sound like what I'm looking for. Many thanks. Will try it out tomorrow night after I'm rested!

Sign In or Register to comment.