360 car movement- collision help?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • Okay so I'm working on this 360 custom car movement that uses trigonometry (sin and cos). I'm trying to stray away from third party extensions such as the advanced race car object or the 360 degree object. So far everything has been going pretty well except for the collision part which is pretty important. Here's the general pseudo code of the 360 movement:

    • Start of Frame
    (Player) : Set Value A to 0.0
    (Player) : Set Value B to 0.0
    (Player) : Set Value C to X( "Player" ) + 0.0
    (Player) : Set Value D to Y( "Player" ) + 0.0

    • Repeat while 'Left' is pressed
    (Player) : Sub 5 to Value A

    • Repeat while 'Right' is pressed
    (Player) : Add 5 to Value A

    • Repeat while 'Up' is pressed
    (Player) : Add 0.1 to Value B

    • Repeat while 'Down' is pressed
    (Player) : Sub 0.1 to Value B

    • Always
    (Player) : Add Sin( Value A( "Player" ) ) * Value B( "Player" ) to Value C
    (Player) : Sub Cos( Value A( "Player" ) ) * Value B( "Player" ) to Value D
    (Player) : Set X Position to Value C( "Player" )
    (Player) : Set Y Position to Value D( "Player" )


    I've tried using fast loops to test for collisions, using past coordinates to offset the currents ones to try to move the car before it hits the wall, detectors to test the position before i can move the car... no luck. Anybody have any ideas and possibly examples? :) I know this is a touchy subject (I tried looking it up in the forum and no luck with answers)...

    Custom A* Pathfinding in MMF2: Please login to see this link.
    Random Tile World Generation: Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!