Actor will only spawn once and no more

Hi everyone, so Im still getting to know Gamesalad and I seem to be having trouble with spawning. Im setting up an actor that whenever key ( lets say spacebar) is pressed will spawn actor 2 in a random location. I want to be able to spawn actor 2 in a different location every time spacebar is pressed. However when pressing space bar actor 2 only spawns once and no more even though spacebar is pressed multiple times.

Here's what I have so far for reference: https://www.mediafire.com/?oyfdqdpde3phay2

Comments

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

    @ben.n3974 said:

    You change the 'random angle' to a random value between 0-180

    Then whenever the mouse button is pressed the spawner will spawn Actor 2 using this 'random angle' to position Actor 2 on the permitter of a circular area.

    At no point does the chosen 'random angle' ever change, once you have chosen (for example) 60°, the spawned actor will be spawned at 60°, then when you press the mouse button again the next actor will be spawned at 60° - on top of the previous actor (which to you looks like nothing is happening) - and the next one and so on . . . .

    There is nothing in your rules telling the 'random angle' to change for each button press.

    Try putting the change 'random angle' where the Spawn Actor behaviour is, so it is triggered each time the button is pressed.

  • Hi @ben.n3974, You logic is correct, just you need to move RandomAngle inside the rule so that when you press the mouse or touch (use always touch instead of mouse), random number is regenerated instead of actors spawning in same location which seems like it is not spawning.

  • ben.n3974ben.n3974 Member Posts: 4

    @Nabbo @Socks I cant believe I missed something so simple! It works now, thanks you guys! I can always count on the Gamesalad community!

Sign In or Register to comment.