Spawning of actors

HI, in my app I have made my actors start from outside the scene and fly across the screen however I can only seem to do this from the left hand side.
My question is how to I get actors to randomly spawn and fly across my screen in different directions?

Thankyou

Comments

  • SocksSocks London, UK.Member Posts: 12,822

    How are you currently getting your actors to spawn on the left (and move right) ?

  • It just kind of happened :wink: but I spawn an actor from position:

    floor(random(0,0)), floor random(0,300))
    And under the the actor itself it has an linear velocity of X=200 and Y=50

    Not sure if that helps, im kind of new to this

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

    No need for the floor() function here since random() generates only whole numbers.

    You've set your spawn actor behavior to choose an x value between 0 and 0 and a y value between 0 and 300. Is that what you meant to do?

    The bottom-left of the scene is x=0, y=0. Do you have the spawn actor behavior set to relative to actor or relative to scene?

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

  • The x and y coordinates are correct as my actors always fly to the right from the left of
    the screen but i would like that to do the opposite as well but i cannot seem to do this.

    I am able to spawn actors in different positions but once they spawn i cant seem to make them move in different directions (However i would like them to spawn off the screen)

    And they spawn relative to the scene.

    Thank you for your help anyway

  • Any help is appreciated

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

    You might want to spawn one type of actor (a left-moving actor) on the right edge of the scene and another type (a right-moving actor) on the left edge of the scene.

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

  • Okay, how can i spawn an actor off the right hand side of the screen and move to the left?

  • I am able to spawn the actors but for some reason they always move to the right.

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

    Why do they move to the right? What behavior are you using and what values are in that behavior? What have you tried to make them move left?

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

  • I have finally figured it out i created a new actor (of the same kind) and spawned them off the right hand screen and made a move to command to let them go to the left but at a certain angle.

    Thank you for your help!!

Sign In or Register to comment.