Coin respawn

0 favourites
  • 9 posts
From the Asset Store
112 High-Quality Coins and Chest SFX specially crafted for video games
  • Hey guys!

    How can I simple respawn my Coins after my player died?

    I tried it with invisible and restart layout but every time the player collied the invisible coin he gets one. When I destroy the coin and spawn another object it doesn't work, either.

  • There are lots of options, to keep the system you have; on the player collide with coin event add another condition, coin is visible

  • cyborgsattack.com/files/showcoinsample.zip

    I did a quick C3 project in R106 beta, I think it's what your looking for, I used touch event, so the player can be moved to coin, on touch, add to money, if player touches X destroy player, respawn player if dead in 2 seconds, reshow coin, don't loose player current money count, and player doesn't pick up invisible coin, on player die, show coin again

  • The question is, what happens after the player dies? When the layout is restarted, all coins are back automatically. If you have previously created a save state and this loads, the coins are also back automatically.

  • The question I saw was how to respwn after player dies, not layout reset, but that's just as easy, use global variables, an array of coins with giving them an index on the coin with visible state, on load layout, simply look at the saved state, look at the array, walk it on layout load and show/hide which coins you want.

    That's a different question from OP

    Another point is this, why reload layout unless your totally wanting to trigger layout load again?

    Overkill

    If your simply wanting to reset player and keep state of game, move player after death back to start of level, and simply reset visible on all coin objects. Only reload layout if you need to trigger on layout load

  • zumwaltwood

    Reboot the layout or load a savegame are normal operations when the player dies. If you only reset the player, you would not only have to reset the coins, but also the enemies and all other stuff that have changed. An unnecessary effort. He would have to have very specific requirements for his game, so that a layout restart/savegame is unsuitable. But I suspect he is trying his first, simple platformer.

    xfairytale

    You can load the game demo 'Kiwi Story' on Construct 3 startpage. Here you can get some inspiration.

  • zumwaltwood Thx, it works! That was exactly what I've looked for.

  • Your welcome, hard to guess what people want, but i try to help when i can, this is such an awesome engine, after a few months at it you will be a pro!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Check out the system function: recreate initial objects

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