How to make actors spawn randomly

J_gorinacJ_gorinac Member Posts: 33
edited November -1 in Working with GS (Mac)
Im making a game thats pretty much like wack a mole but with my friends head poping up instead lol but i have no clue on how to make his head pop up from the wholes randomly and to make it difficult

Pls help

thanks

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Let's say you have six holes.

    Make an integer attribute - call it 'popup' or whatever you like.

    Then have an actor in your scene as a controller.

    Have a timer behaviour in this actor

    Say 'every 3 seconds'

    Behaviour: Change popup to random(1,6)

    Then have six new rules.

    If popup = 1

    Make first mole pop-up

    If popup = 2

    Make second mole pop-up

    etc etc

    You can even use random in the timer, so for example:

    Every Random(1,4) seconds

    Change pop-up to Random(1,6)

    The first number is the lowest, the second the highest and together they stipulate a range to draw a random number from.

    Hope that helps!

    QS :D

    Good luck with your game. Hope you and your friend enjoy it.

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • J_gorinacJ_gorinac Member Posts: 33
    Thanks but will the fact that my holes are part of my background image effect this advice? or do I just put the pop-up as my friends face?
  • J_gorinacJ_gorinac Member Posts: 33
    and I have 12 holes so i would have 12 actors that are my friends head right? and also how do you make them "invisible" when there not being spawned?
  • J_gorinacJ_gorinac Member Posts: 33
    I already started with his and now im stuck... I don't know how to make them not visible before they are spawned
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    notice that T's method does not use spawning. just image changing. I would go with that
  • J_gorinacJ_gorinac Member Posts: 33
    Could i just make a "base" actor with 0 opacity and do the change image thing? instead of having to import an image for each one
  • J_gorinacJ_gorinac Member Posts: 33
    Yeah I ended up doin what you said lol way easier ha
Sign In or Register to comment.