having trouble with screen scroll when in car

Get help using Construct 2

Post » Sat Feb 09, 2013 6:07 pm

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.
B
2
Posts: 5
Reputation: 310

Post » Sat Feb 09, 2013 6:55 pm

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.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Sat Feb 09, 2013 7:11 pm

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.wfreeman2013-02-09 19:13:20
B
2
Posts: 5
Reputation: 310

Post » Sat Feb 09, 2013 7:28 pm

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.
B
12
S
2
G
3
Posts: 59
Reputation: 2,628

Post » Sat Feb 09, 2013 9:16 pm

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.
B
2
Posts: 5
Reputation: 310

Post » Sat Feb 09, 2013 9:45 pm

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.



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.
B
12
S
2
G
3
Posts: 59
Reputation: 2,628

Post » Sat Feb 09, 2013 9:54 pm

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!
B
2
Posts: 5
Reputation: 310

Post » Sat Feb 09, 2013 10:22 pm

If needed you could always add a "set angle" to the list. In case you want to add a cabrio ;)
B
12
S
2
G
3
Posts: 59
Reputation: 2,628

Post » Sat Feb 09, 2013 10:31 pm

oh, that makes sense. Thanks again
B
2
Posts: 5
Reputation: 310


Return to How do I....?

Who is online

Users browsing this forum: Shanetastic, Yahoo [Bot] and 26 guests