Maybe someone can see what I'm doing wrongn-random spawn

SaveDaveSaveDave Member Posts: 140
edited November -1 in Working with GS (Mac)
Hi, I have the following set up but it's not working!

I have 3 actors - frog 1, 2 and 3

I also have a bar which one will colide with, when it colides, I want it to be destroyed and be randomly spawned for one of the selection of 3.

I have an scene integer called randomactor

On the collide bar I have this set:
Change attribute, randomactor = randomactor. Random (1,3)

Then on the frog actor 1 I have:

If actor colides with bar and randomactor = 1
destroy actor 1
Spawn actor 1 in the same position

If actor colides with bar and randomactor = 2
destroy actor 1
Spawn actor 2 in the same position

If actor colides with bar and randomactor = 3
destroy actor 1
Spawn actor 3 in the same position

What am I doing wrong???

Any help would be greatly appreciated!!

Comments

  • SaveDaveSaveDave Member Posts: 140
    Bump!

    Sorry!
  • SaveDaveSaveDave Member Posts: 140
    Ahem.?

    Anyone?

    Pleeeaaassseeeee
  • PhoticsPhotics Member Posts: 4,172
    Your example was too confusing for me to understand.

    However, I did notice something of importance. If you're going to do spawning and deleting within the same rule, the spawning should be first. Otherwise, the delete behavior will likely delete the actor before the spawn behavior can activate.

    Behaviors are launched top first, like words in a book are read.
  • SaveDaveSaveDave Member Posts: 140
    To make it less confusing, I need to have an actor colide with a wall and turn into a random actor from the chocie of 2 other actors....

    How would you go about this?
  • PhoticsPhotics Member Posts: 4,172
    For that scenario, I might set up the actor something like this...

    If actor "Overlaps or Collides" with "Wall"
    Change attribute self.random to random(1,2)
    --If "self.random" is "1"
    --Spawn actor "A"
    --destroy actor
    --otherwise
    ---Spawn Actor "B"
    ---destroy actor
  • SaveDaveSaveDave Member Posts: 140
    Okay, and self.random is an integer that I set up in scene attributes????

    Is that correct??
Sign In or Register to comment.