How can you add items to a background on timer or based on score?

butterbeanbutterbean Member Posts: 4,315
edited November -1 in Working with GS (Mac)
I wanted to be able to add items to the background on a timer, or based on score.

Are you able to, mid-game, say 2 minutes into a game, make a flower bloom? Or reveal a graphic in the background in a specific area, like say, a tree?

Thanks!

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Use the Timer Attribute with a game controller (a game controller is just an invisible actor you place somewhere in your scene. Make sure the collision and movement is set to off on this actor).

    Make it say 'After' x amount of time

    Then drag a 'spawn actor' attribute into the timer attribute. You can set its location relative to the scene (if it's a tree, say).

    Alternatively, drag an 'animate' attribute into the timer attribute. Thus you can make a flower bloom.

    If you want to spawn or animate something based on score, then you will have to place a rule in your game controller that says 'if attribute changes (score) = 1200

    The drag the spawn actor attribute into the rule.

    1200 is just an example of a score - put what you want in there!

    Hope that helps! Royalty cheques to the usual address please ;)

    QS

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

  • butterbeanbutterbean Member Posts: 4,315
    Thanks Quantum! Royalty checks huh? You have helped me out a great deal, I will give this a shot over the weekend :)
  • butterbeanbutterbean Member Posts: 4,315
    How do you coordinate where to spawn the object? Is it spawn X and Y and just play with the numbers until you get it right?

    Thanks!
  • JGary321JGary321 Member Posts: 1,246
    exactly, you could also make use of th Random expression, if you want it different everytime.
  • butterbeanbutterbean Member Posts: 4,315
    As far as putting invisible actors on the screen, how many on average in a game do you have on a screen at once?

    I didn't want to bog down the game, but if it works, the more features I can put in a level, the better :)
  • JGary321JGary321 Member Posts: 1,246
    Not so much 'how many' it's probably more to do with how many rules/behaviors are involved. I'm sure the number would make a difference, but alot of rules/behaviors can take up precious memory.

    Personally if it's a hidden actor that spawns enemies, I have 1 actor that handles all the spawning. You could also have it handle all spawning of items too.

    As far as how many I seem to remember one of the Mods saying that one of their games had over 100. They were just basic invisible actors, basically 'walls' if I'm not mistaken. So, it would depend on what these invisible actors were there to do. I would imagine you could add a good number though.
Sign In or Register to comment.