Spawning Random Actors in Random Locations in iOS Games with GameSalad

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
4,652
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jan 27, 2011

This video shows how to spawn random actors in random locations in your iOS Games made with GameSalad.

Category:

Gaming

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (GameSaladCookbook)

  • Great tut

    How would I achieve the same thing but have them spawn randomly relative to where my "main actor" is within the scene?

    My "main actor" is traveling down on a scene that is 1500 high and I am trying to get the objects my character collects to spawn below it randomly rather than all over. Don't need them to spawn above my "main actor" (gravity is down, can't go up). Thanks in advance.

  • @smdstudiotampa As long as your actor does not rotate / is not able to rotate, that shouldn't be a problem. When your spawning is relative to actor, your actor becomes 0,0. As a result, you'll want the Y spawn to be from a negative amount (probably -1500) to 0, depending how far below your actor you want them to spawn.

    The X spawn in your example poses a slightly more difficult challenge, as I am assuming your actor will be able to move left or right as it travels downward.

  • @smdstudiotampa (cont.). You could just make the X spawn the width of your scene (say, -160 to 160 for a width of 320) but this may result in some spawns being off-screen. If you have some tracking on your main actor, you could do something like this: random(-[actor'sxposition],320­-[actor'sxposition]) where [actor'sxposition] is simply an attribute that track's the actor's X movement (constrain actor'sxposition to self.position.x). Feel free to message me if you are still having trouble!

  • it stops spawning actors after 6 are spawned, how do i make it so that it never ends?

  • @locoplanet That's unusual. Double-check to make sure your timer is "every 0.3" (or similar), rather than "for" or "after". If that doesn't help, please message me and I'll see what I can do to help clear it up!

see all

All Comments (22)

Sign In or Sign Up now to post a comment!
  • You do a great job with the tuts..I am new to this with a similar question. I am trying to get the objects, as they spawn into the game, to be able to collide with each other, and ricochet off each other & the walls. Also to include point values upon "destroying". Lastly - one of the objects (or maybe random objects) will end the game if "destroyed" or "popped" - how can you confirm all are destroyed except the game ending block or object? Thanks - and any links to vids answering is awesome.

  • thanks!

  • how do you spawn it moving from right to left?

  • hi ya one question when i spawn my moving object it becomes one block and it just go in a random area where i dont want it there

  • @creptoo59 Thanks man for a reply and it works

  • @MultiSimransingh I dong know if anyone has helped you in the last month but here is what you can do. Go into your actors and put a behavior called acceleration. you can set its speed and direction there

  • i have over 70 levels in my game how would i generate random levels

  • lol he says 4 twice

  • man... my actor is not falling.... it stuck at a particular location!!! help me out plz

    thanx in advance

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more