Car Traffic Sprite Behavior

  • 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: 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)?

  • This thread MIGHT be helpful (or not):

    Objects recognizing when another object is nearby

  • 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.

  • You need to do your own wrapping:

    car traffic test_BHT.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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.

  • 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.

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