Car Traffic Sprite Behavior

Get help using Construct 2

Post » Thu Jul 25, 2013 10:07 pm

Hi all.

I'm trying to achieve the car traffic behavior - sprites move just in one direction (to the right) not bumping each other etc.
I created something like this for quick reference: https://www.dropbox.com/s/kv4w24n75qpyumj/car%20traffic%20test.capx
and sprites have wrap behavior added. Now...
The problem is that after leaving the layout on the right, sprites should show up on the left. They do, but they change their position upon (as I think) spawning one on another behind-the-scene.

How to keep up all the wrapped sprites in line, entering the layout?

Additional question: How to create a slight delay on car's start of movement (let's say - human factor)?
B
39
S
13
G
6
Posts: 148
Reputation: 5,384

Post » Thu Jul 25, 2013 10:45 pm

This thread MIGHT be helpful (or not):
Objects recognizing when another object is nearby
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Fri Jul 26, 2013 10:24 am

Thanks, but I think the problem lays in a way that wrapping works in this particular case.
Run the capx file to see how it looks, and how sprites are placed when re-entering the layout.
B
39
S
13
G
6
Posts: 148
Reputation: 5,384

Post » Fri Jul 26, 2013 3:07 pm

You need to do your own wrapping:
car traffic test_BHT.capx
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Fri Jul 26, 2013 8:38 pm

Great! It works smoothly. Digging through the code right now.
I owe You a beer :)
Make it double if You know how to make every car has a slight delay before continuing to move. I was trying the system "wait", but probably got it wrong.
Thank You very much.
B
39
S
13
G
6
Posts: 148
Reputation: 5,384

Post » Fri Jul 26, 2013 9:05 pm

You can use a Timer. Infinitely better than Wait.

Depending on what the cars end up doing, it might be easier to just have one car, with different frames/animations, rather than making a bunch of separate ones and then pushing them into a Family. It depends though on what they will be doing.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352

Post » Fri Jul 26, 2013 9:59 pm

Timer. I will give it a thought.

The concept behind this setup is: main heroine runs away on tops of the cars, from officials in pursuit. The cars will vary in size and type and since run will be from left to right, vehicle flow will be from right to left. Any jump made between cars and on collision with asphalt will be lethal (or not, depends on gameplay). I'm planning to have something like 18 different cars, either placed in fixed queue or placed randomly. Player needs to take a long road from one side of the layout to the other and the flow must be dense enough to provide platforms to jump on; wrapping was the way to save some cpu.
B
39
S
13
G
6
Posts: 148
Reputation: 5,384


Return to How do I....?

Who is online

Users browsing this forum: namaewayukidesu and 12 guests