How do I Clockwise driving?

0 favourites
  • 7 posts
  • I'm making top view racing game and almost everything works as I planned, except one thing.

    Player is able to pass current lap regardles he drives, either he drive clockwise or back clockwise laps and checkpoints are counted. OK checkpoint counter is fine, but I want to force on track only clockwise direction of driving.

    draft

    red arrows - direction I want to block

    green arrows - desired direction

    http://scr.hu/1yl7/ofufq[/code:3rt9axye]
    
    [i]Eventsheet[/i]
    [code:3rt9axye]http://scr.hu/1yl7/2rt6v[/code:3rt9axye]
    
    Thank you in advance.
  • There's probably MUCH better ways of doing this but something that comes to mind is that you could divide the track into zones, and each zone would have a range of directions (angles) the car is allowed to have, and if it's outside of those angles then it's going in the wrong direction. For example in the track you showed us, the left side of the track would restrict the car to angles 180 to 360 (or whatever). The right hand side would be 0 to 180, etc. To know which zone the car is in you could use invisible sprites that cover each zone and do an overlapping test with that sprite and the car, or check x,y coordinates to determine which zone the car is in.

    Another thought is that if the driver is collecting checkpoints in the wrong order, you'd know they are going in the wrong direction.

  • There's probably MUCH better ways of doing this but something that comes to mind is that you could divide the track into zones, and each zone would have a range of directions (angles) the car is allowed to have, and if it's outside of those angles then it's going in the wrong direction. For example in the track you showed us, the left side of the track would restrict the car to angles 180 to 360 (or whatever). The right hand side would be 0 to 180, etc. To know which zone the car is in you could use invisible sprites that cover each zone and do an overlapping test with that sprite and the car, or check x,y coordinates to determine which zone the car is in.

    Another thought is that if the driver is collecting checkpoints in the wrong order, you'd know they are going in the wrong direction.

    Yes, the order of chekpoints would do the trick, but as you saw in my sheet there is set instance variable to Pick instance with lowest (variable) but (I don't know how it is possible) always counts checkpoint. In other words, Sprite called checkpoint has uniqe variable and I pick the lowest value of this variable but always when I get through checkpoint system counts that checkpoint as correct.

    If my words are too confusing I will provide necessary files.

  • I basically threw this together.. hope it helps some.

    https://dl.dropboxusercontent.com/u/666 ... oints.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I basically threw this together.. hope it helps some.

    https://dl.dropboxusercontent.com/u/666 ... oints.capx

    Thank you very very much <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile" /> I owe you big one ;]

  • No problem. Hope it's useful. There are flaws of course, but if you design your tracks right, that method should be fine.

  • Yes, very usefull. You know, I'm getting old but I remember when I was in Highschool (IT school) my teacher told me that

    [quote:2ldn2zit]One person can make great things, imagine what would create a group of individuals

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