0 Favourites

Spawning Problems

  • Hi,

    I'm making a 'dodger' game and I'm having trouble with objects spawning after I die and go back to the level. It's quite hard to explain so I'll try and link my .capx on dropbox:

    dropbox.com/s/6xn14ri0tztmnhg/Dodger.capx

    hopefully that works, start the game from the start screen and choose a difficulty, then play it normally until you die and when you do go Menu -> and choose a difficulty again, now my problem occurs:

          The pick-ups' spawn time messes up

    If anyone understands this then please help!

    Any advice is appreciated, thanks

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hi

    Just to make sure i get this right.

    e.g.

    Are you trying to spawn a Score5 object every 5-16 secs?

    if so you are using the random function wrong. Random(X) is a random value between 0 and X.

    So if you want a random value between 5 and 16 you will have to use it like this 5+random(11)

    Your timing is also off because you do not restart the layout.

    By setting the time scale to 0 you just pause the game. So when you reenter the game you resume from where you died the last time.

    Use the System-->restart layout action

    On a side note. You are really over complication your project. You could just have 1 game screen and 1 event sheet for the easy, medium and hard.

    When you pick the difficulty on the startscreen just set a variable which holds the spawn time you want for that difficulty. and then use that variable in your "spawn enemy every x seconds" action

    so instead of:

    System-->every 4 seconds --> enemySpawn...

    use:

    System-->every spawnTime seconds --> enemySpawn...

    Where spawnTime is your variable. In easy set to 4, medium set to 2.5 and hard to 1.5

    It will cut your layouts and sheets by 2/3 and will make it much easier to maintain.

    Let me know if I did not make myself clear <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Thanks for the reply,

    I understand most of it but the only thing I have an issue with is the random function - I thought random(5, 16) meant choose a random number between 5 and 16?

    I will try to implement the restart layout action and see how it goes and then move on to compressing the number of levels

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