Creating a random movement (New to gamesalad)

ElendoroElendoro Member Posts: 2

Hello (Not sure if this is in the right topic)
I just started with Gamesalad and I'm trying to create a movement to my character so that when I press on him, he will fly up in the air and then automatically fall down on the floor again. I do know how to do this so hes flying straight up, but how would I do if I want the character(actor) to randomly move to different locations? For example, if I press him once, he flies right up, if I press him again he randomly flies upwards but to the right aswell, and then perhaps next touch left and upwards.

Do I use the Move or Move to rule for this?

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    edited June 2014

    There are lots of ways to accomplish what you are asking. Here is one:

    Rule:
    When touch is pressed
    
    Change Attribute: self.motion.linear velocity X to random (50,300)
    Change Attribute: self.motion.linear velocity Y to random (50,300)
    

    You'd also need to have gravity set up and some sort of floor for the actor to hit and stop the jumping. I've included a little sample.

    You can change the jumping behavior by adjusting the numbers in the random statements.

  • ElendoroElendoro Member Posts: 2
    edited June 2014

    @jamie_c said:
    There are lots of ways to accomplish what you are asking. Here is one:

    Rule:
    When touch is pressed
    
    Change Attribute: self.motion.linear velocity X to random (50,300)
    Change Attribute: self.motion.linear velocity Y to random (50,300)
    

    You'd also need to have gravity set up and some sort of floor for the actor to hit and stop the jumping. I've included a little sample.

    You can change the jumping behavior by adjusting the numbers in the random statements.

    Thank you for the help! appreciate it! Can I download that even if I'm on PC? I heard it might only work for Mac?

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    I believe it should work fine, try it out and see :)

Sign In or Register to comment.