Problems with Simulate Car Control

0 favourites
  • 3 posts
From the Asset Store
Template for a police car chase game, fully documented in comments and video
  • Hi All!

    I'd like to ask a question, since my game crashes in very peculiar circumstances.

    I'm using Simulate Control for a top-down car-based game. However, when I am breaking and steering at the same time, the sprite I use for the player crashes. Now, there's some backstory to this.

    I have events with the following conditions (among others, but I think these two conflict in some way):

    1. Down arrow is down && Car speed <= 0 : Set Car max speed to 0

    2. Right Arrow is down : Simulate Car pressing Steer right

    3. Left Arrow is down : Simulate Car pressing Steer left

    Could the steering conflict with the max speed = 0 thingy?

    Thanks in advance!

  • Crashes, like it shuts down? Or the sprite is displayed incorrectly? I'm not sure how this would be caused by those events.

    But as for the events themselves, your first event effectively turns off movement. If you set "Car MAX speed" to 0, it means the sprite's top speed is 0, i.e. it's not going to move. IIRC with car behavior, if you're not moving then it's not going to turn either, so it'll just sit there. You want to set current speed to 0 and leave the max above 0.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Crashes like, the car sprite bugs out, displays at its default angle until the next button press, which would modify the car's movement. The next button pressed makes the game destroy the car instance.

    The max speed thingy is a workaround for a simple gears system. I'd like the car to go back, only when it's in reverse gear and the Up Arrow is pressed. So, to do that I have the following condition:

    • Down arrow is down && Car speed <= 0 && gear (instance variable) <= 1 : Set Car max speed to 0

    Once the down arrow is released, though, the car's speed is reset every tick. So, basically, while brakes are being pressed, max speed = 0. While not - max speed is reset every tick.

    Would there be a better way to disallow the car to move back without being in reverse gear?

    EDIT: I actually found a solution. Steering is now being simulated only if speed > 0. When the max speed = 0 and steering is active, the instance bugs out, so I implemented the speed check.

    EDIT 2: The first edit still had flaws. But I made it happen! And it works flawlessly with a completely different approach. I don't mess with max speed, but with acceleration, deceleration and current speed. Link to the event sheet below (top three are in System Every Tick):

    goo.gl/Xu1qmr

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