car lane and image overlapping

0 favourites
  • 11 posts
From the Asset Store
Template for a police car chase game, fully documented in comments and video
  • Hmmm, I hope I can explain this well.

    I'm working a game with 4 lanes. Every say 2 seconds I generate images from two different families on any of the four lanes using the choose function(I use two different events for each of the families). But what happens sometimes is the same lane is selected by the two events hence the two images are generated on the same position and overlapping

    Any hints on how to handle this exception.

  • Can you set a "This lane is in use" variable?

    when it picks a lane, that lane is checked to see if it's already in use. You unmark them when they become available.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Paradox, thanks but I'm not sure how to implement that. Thinking.. Cld it be assigning no 1 to4 to d variable lane in use depending on which lane was picked and den checking dat for d oda pick image event such that.. I'm stuck. Lemme try n upload a capx file

  • Not a great example but I threw something together real fast:

    https://dl.dropboxusercontent.com/u/85412219/Frogger/Frogger.capx

    Click on layout 1 and preview it to see Variables preventing spawning for a few seconds.

    Click on layout 2 and preview to see another idea where the spawner sprites are extra wide, and new sprites won't spawn while another is still on it.

  • Paradox here is the capx file showing the problemlane issu

  • Paradox thanks. Had imternet issue since morning so cldn't upload d doc ondropbox, was just uploading this now when d alert came in. I hope the link works cos the internet is bad. Wld try to look what u did. Thanks a lot

  • Paradox thanks. Had imternet issue since morning so cldn't upload d doc on dropbox, was just abt to upload when the alert came in. Wld try to look what u did. Thanks a lot

  • Paradox!! Wow!! Really cool implementations. Really wish I could think like that. Thanks a lot

  • I had forgot to add the "destroy outside layout" behavior, so the count builds up after awhile. I added it, but I think you got it first.

    The wide spawner version makes a nice pattern if you take out the random variance.

  • Paradox, sorry but for the second event what is the work of the system random(20)<1?

  • Just making it a bit more random, there is a 1 in 20 ticks chance it will be true.

    It's the "random variance" I mentioned, if you leave it out, the cars will spawn as soon as the last one has cleared the spawner.

    I'm not online much at the moment, I'm trying to finish my entry for the Tizen contest, and still have too much to do.

    Edit: That's not an ideal way to do random, I was rushing a bit. The faster a computer processes ticks, the faster it will come up true.

    In other words, faster computers would spawn cars faster.

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