randomly spawing yet destroyed actor

aa233aa233 Member Posts: 8
edited November -1 in Working with GS (Mac)
Hi all,
I have one more minor speed-bump in the way of my first completed game on here. I was wondering how it would be possible to make a collectible item that randomly spawns somewhere else after it is destroyed. I followed the "how to make a collectible item like a coin" tutorial and that seemed to work, but i can't figure out how to make the item re appear somewhere else to be collected once again. Maybe an integer would work for this? And if the value is 0 then another actor should spawn? I'm pretty new at this so any ideas are appreciated. Thanks!

Comments

  • RattleheadRattlehead Member Posts: 485
    I would say that you are on the right track...

    Create a global variable of either boolean or integer (true/false or 1/0) and once you display the item in the scene, set this global variable to true. Once the player collects the item, set it back to false. From there you can make a part of your logic to display the item again in the future to first reference the state of the variable.

    For example, if your variable called 'isItemVisible' is currently false, then you can randomly place another item; otherwise you hold off.

    Hope that helps.
  • aa233aa233 Member Posts: 8
    I'll try it out. Thanks a lot!
Sign In or Register to comment.