Help Randomly Spawning Actors on screen...

timbojilltimbojill Member Posts: 13
edited November -1 in Working with GS (Mac)
Help Randomly Spawning Actors on screen... I have an actor that starts on the top of the screen with gravity pulling it down. I need to spawn another actor directly above it once the actor goes down a certain hieght can someone assist me with this ?

Comments

  • OctappusOctappus Member Posts: 68
    A simple rule within the actor will work.

    For example

    When .. attribute ... self.Postion.Y ... = 160

    Spawn Actor ... Position ... 0 ... 160 ... Relative to actor
  • timbojilltimbojill Member Posts: 13
    To complicate thinks I want to set a random number. So I want to Randomize an integer call it X. Such that when actor reaches position y at 160 it randomly chooses a number between 1 and 5. Then if X = 1 spawn actor 1, if x = 2 spawn actor 2 and so forth. Can someone help me out.
  • StuartYStuartY Member Posts: 134
    Something like this should do...

    Set an integer attribute, e.g. "numbertospawn" up for your original actor. Make it equal to 6 or any other integer.

    When .. attribute ... self.Postion.Y ... = 160
    Change attribute numbertospawn to random(1,5)

    When .. attribute.. numbertospawn = 1
    Spawn Actor ... Position ... 0 ... 160 ... Relative to actor
    Change attribute numbertospawn to 6

    When .. attribute.. numbertospawn = 2
    Spawn Actor ... Position ... 0 ... 160 ... Relative to actor
    Spawn Actor ... Position ... 0 ... 180 ... Relative to actor
    Change attribute numbertospawn to 6

    etc... don't know if you want them overlapping or stacked, but you get the picture.
Sign In or Register to comment.