having trouble with screen scroll when in car

0 favourites
  • 9 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hi everyone, I'm really new to construct 2, and I'm trying to make a top down free roam game. Right now it's really rough with rectangles and such instead of real sprites, but it's worked well so far. I know how to do most things, and have found the forum really useful when I can't figure stuff out, but I can't find anything about this problem.

    So what is my problem?

    I made a car, and I have it set so that I can enter it, drive it, and exit it. This all works very nicely, however, when I drive around, the screen starts to glitch and shakes a lot, although it still scrolls with the player pinned to the car. This doesn't happen when walking or when I set the screen scroll to the car instead of the player.

    Can anyone help me fix this? I know it's a pretty ambitious project, but I have most of the basic events and variables down for the game, and this is the first major problem I've had.

  • You may want to make it so that when you are in the car, you control the car, instead of controlling the player. Disable the players controls, pin it to the car, and then control the car instead. The issue is most likely that the player is turning, etc.. and the car is trying to calculate how to stay pinned to it as it rotates, etc... just a thought, hope it helps.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the quick response!

    That's how I've had it set. A little clarification on what is happening though: the screen is shaking a lot when I drive the car. The car itself shakes along with everything else in view. But again, thanks for your response.

  • I'm having similar problems when using pin. I have a shield around my spaceship and when i use pin it warps all over the place.

    I changed it to: set position on every tick and that's working fine.

  • Thanks for the response, but can you please explain what you changed? I know you can create an event in system called "every tick" but wouldn't that mean the player would always be attached to the car?

    Thanks again.

  • Well my shield needed to be attached but in your case i can see that would be a problem. I guess you could make a separate event for it that also checks if you are in the car or not.

    <img src="http://imageshack.us/a/img201/5585/clipboard01ogs.jpg" border="0" />

    Just make an instance variable and set the type to boolean. When its true the car will set position to the player. When its false it will not.

    Just set the boolean to true when you enter the car.

  • Wow! Thanks a lot. This works pretty much flawlessly. The only slight problem is that the player's sprite doesn't rotate with the car, but that's not an issue since I can just make the player invisible and edit the sprite on the car.

    Again, thanks a ton!

  • If needed you could always add a "set angle" to the list. In case you want to add a cabrio ;)

  • oh, that makes sense. Thanks again

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