Spawning Problems

Get help using Construct 2

Post » Sun Nov 17, 2013 8:45 pm

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
B
2
Posts: 3
Reputation: 158

Post » Sun Nov 17, 2013 11:31 pm

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
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Mon Nov 18, 2013 1:32 am

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
B
2
Posts: 3
Reputation: 158


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, ChesVCF, OBLIVION, shinkan, yiuyiu6666 and 25 guests