How do I give player a power up only once when available?

0 favourites
  • 13 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I'm working on game achievements, and hopefully the logic will carry over to the store.

    When the player's ball collides with a star, 1 is added to the GV StarCount. When the StarCount is greater/equal at certain levels the player gets an achievement, and a certain number of shields is added to the GV Shields: starcount = 250 - 1 shield, starcount = 500 - 2 shields, etc. etc...

    How can i make the ball spawn a shield only once for every point the GV Shields has?

    And wouldn't I need to set the Shields to localstorage?

    Thank you for any help with this. It's been turning my brain to mush.

  • You might be able to get away with just a "Trigger once while true" or a "Start of layout" condition followed by a "Repeat X times" sub-event, unless I'm misunderstanding.

    On start of layout

    • Repeat [GV Shields] times --> Spawn shield

    This way the loop only runs once at the start. And yeah, you'd need to save your Shields value if you want it to persist after you close and reopen the game.

  • You might be able to get away with just a "Trigger once while true" or a "Start of layout" condition followed by a "Repeat X times" sub-event, unless I'm misunderstanding.

    On start of layout

    - Repeat [GV Shields] times --> Spawn shield

    This way the loop only runs once at the start. And yeah, you'd need to save your Shields value if you want it to persist after you close and reopen the game.

    Thanks for the reply.

    I'm trying to get the shield to spawn during gameplay, while the ball is visible. If the ball falls off a disk, it is destroyed - GAMEOVER. If the ball has the shield when it dies, the shield is destroyed also, and 1 subtracted from the GV Shields.

    I got the achievement to trigger, but no shield....yet.

  • Try to put it on local storage. Global variables is your best friend in your problem. If you want to show the shield only once. try Trigger once while true and put more condition in to it. i hope i helped you.

  • In that case maybe run a check to compare the variable to the number of shield objects for when it's time to spawn them.

    Shield.Count < GV Shields --> Spawn Shield

  • Try to put it on local storage. Global variables is your best friend in your problem. If you want to show the shield only once. try Trigger once while true and put more condition in to it. i hope i helped you.

    In that case maybe run a check to compare the variable to the number of shield objects for when it's time to spawn them.

    Shield.Count < GV Shields --> Spawn Shield

    Thanks for the help. I've been trying to add and change things around, unfortunately, i still haven't been able to find a way to get the shield to spawn. I've been trying to set the Shield localstorage to 0 or to clear the storage, since the Stars count keeps resetting or going up.

    This is what i have so far CAPX

    I still have some things to work out, though. Like getting the HighScore textbox to show if the total score is higher than the high score...among other things.

    Sometimes it's hard for my brain to comprehend things, like studying trigonometry in chemistry class.

    Again, thanks for the replies, and thank you so much for any help.

  • I can't see any hint of a shield in the game, where is it? I can see a global variable called magnashield but nothing adds to it and I can't see a shield asset.

  • I can't see any hint of a shield in the game, where is it? I can see a global variable called magnashield but nothing adds to it and I can't see a shield asset.

    Thanks for replying. Look at the Assets layout..the gold ring.

    The events (until i learn how to do them for the 'Store' purchases) will be under achievements.

    I may have been going back to try and edit and or learn how to do it when i uploaded the capx.

  • Well at the moment it's not spawning because you've not included your achievements event sheet in gameplay_common..once included it spawns the shield and works fine. What are you trying to do from this point?

  • Well at the moment it's not spawning because you've not included your achievements event sheet in gameplay_common..once included it spawns the shield and works fine. What are you trying to do from this point?

    Dang...easily overlooked. Sorry

    I had a problem with the shields spawning for each point in the GV MagnaShield. I could only get it to spawn all of them at once, or only a single time.

  • sent you a pm

  • To me? I didn't receive anything I guess the information that's missing (or it could be there I'm not sure as the thread has become longwinded), is what happens with the shield. Is it timed? Is it like a life for the player and stops them losing? Your problem probably lies with the fact that you have a shield spawn, your stars can keep increasing and you still have a shield equipped. I'm not sure what the point of the shield is though so if you could explain that. Does it equip automatically? I see that you add a shield point on every few starpoints but it's not clear what you want the shield to do in relation to the game.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Eventually, when the shield is equipped it will attract nearby stars to the ball. Acting as a sort of vacuum, and allowing the player to score more stars. Also, allowing the player to purchase more shields from the store when they have run out.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)