Need some help on my game

Get help using Construct 2

Post » Wed Sep 09, 2015 9:07 pm

So at the moment I'm making a traffic game (where there is a 4 way cross road and you have to control one of the sides with a set of traffic lights).
I'm stuck on 2 things:
First one is spawning. I need to spawn a car at random 1-3 seconds and also spawn different types of cars (as I have different coloured cars and I don't want them to be the same).
Second thing is stopping. once the first car is stopped, the car behind goes ontop. I know I :D :D could put collide but I want there to be a gap inbetween the two.

Help would be really appreciated and don't worry if you don't know both, just post me one!
Thanks!
:) :) :D
B
5
S
1
Posts: 37
Reputation: 463

Post » Wed Sep 09, 2015 9:59 pm

But you haven't describe what exactly problem do you have?

Revilo wrote:First one is spawning.

Spawning an object you can do by System -> Create object or by some sprite object -> spawn object.

Revilo wrote:I need to spawn a car at random 1-3 seconds...

You can use "Every x second" or any other loop with "wait" function, but there is a special way you have to build a delay between iterations. You can learn it here: https://www.scirra.com/tutorials/723/using-wait-in-loops.

Regarding random function, the most precise is the following format: "floor(random(b-a+1)) + a" which returns an integer number from "a" to "b" (including them).

Revilo wrote:and also spawn different types of cars (as I have different coloured cars and I don't want them to be the same).

If the only thing which differs is the color then I encourage to use one sprite and put various cars as separate frames.

Revilo wrote:Second thing is stopping. once the first car is stopped, the car behind goes ontop. I know I :D :D could put collide but I want there to be a gap inbetween the two.

Well this really depends on how exactly your game works. You can for instance check the distance between car1 and car2 by X and Y position.
ImageImageImage
B
28
S
16
G
82
Posts: 1,031
Reputation: 45,806


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests