How do I Enter/Exit Vehicles (Solved)

Get help using Construct 2

Post » Mon Dec 08, 2014 6:26 pm

I am trying to find the best way to exit and leave vehicles

players walks up to vehicle do a check to see if player is with in 16 pixels of vehicle then player can press the "E" key to enter vehicle. when the player is done the player can press E to exit vehicle and the vehicle stays at the location is was driven too. and the player will spawn right next tot he vehicle.



I got most of this done, the hard part I am having it pressing the E key to enter on 16 pixel radius check.

I have it set to if player is on collusion then enter vehicle. with no Key press action.
Last edited by mordiaky on Thu Dec 11, 2014 10:33 pm, edited 1 time in total.
B
8
S
1
Posts: 74
Reputation: 725

Post » Mon Dec 08, 2014 9:33 pm

Do you need a 16 pixel check? Why not just press E when overlapping the vehicle sprite?
Anyway, what I would do in that situation is create an invisible sprite that is pinned to the vehicle which is the size of the area you want for entering the vehicle. Then E pressed, if overlapping the invisible sprite, enter vehicle.

I'm sure there is a way to do it with expressions, so maybe someone else will bring up another solution. :)
Be sure to check out my Metroidvania game, A Hole in the Earth
B
59
S
24
G
3
Posts: 359
Reputation: 5,683

Post » Mon Dec 08, 2014 11:36 pm

Another way is to pin an invisible box to the character itself for all the intreraction triggering so you don't need to have it on everything. So when the box ovelapps the car, a door etc you can perform the interaction.

And I think it it easier to just hide the character and align it with the cars front door and pin it there while driving and unhide it when exiting the vehicle. Then you don't have to destroy and spawn the character again and all of its assets and settings.
B
58
S
25
G
14
Posts: 793
Reputation: 13,302

Post » Tue Dec 09, 2014 6:10 pm

Thank you for the insight, I am still however having some issues using the keyboard command to enter my car.

Right now I have it set to on collusion to enter the car. but I want to do 2 checks, is player next to car, is key E pressed. so far I am un able to run both checks
B
8
S
1
Posts: 74
Reputation: 725

Post » Tue Dec 09, 2014 6:21 pm

if you upload some simple capx..You'll quickly come to a solution.. ;)
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Tue Dec 09, 2014 7:56 pm

You should make an event like this: When the E key is pressed and the triggerbox is colliding with the car as another condition --> then enter car or whatever setup you have.

You don't want to make a check to see if the E key is pressed. The pressing of the E key is the trigger itself and tells C2 you are pressing that key.
B
58
S
25
G
14
Posts: 793
Reputation: 13,302

Post » Tue Dec 09, 2014 7:57 pm

as soon as I get off of work I will send a copy of my master peic.... err I mean my project :D
B
8
S
1
Posts: 74
Reputation: 725

Post » Tue Dec 09, 2014 11:14 pm

Here is the file,
You do not have the required permissions to view the files attached to this post.
B
8
S
1
Posts: 74
Reputation: 725

Post » Wed Dec 10, 2014 1:54 am

the issue is when I set event to keyboard key pressed E I cannot add On collision with event in the same area ( guessing it is the AND logic)

Image
B
8
S
1
Posts: 74
Reputation: 725

Post » Thu Dec 11, 2014 8:25 pm

I think you should be checking for overlaps not collisions
B
7
S
1
Posts: 27
Reputation: 511

Next

Return to How do I....?

Who is online

Users browsing this forum: totoe, Yahoo [Bot] and 29 guests