BGE, How to Exit a Car?

Hi guys, I am making a game for fun and I want to know how to get into a car!, I want to know whats the best way about doing this - I dont need it to be a fancy climb into the car, Just basically teleport in (Its easier, Right?)! So I want it to be when your near a car and press enter, You spawn in the car and can drive the car.(I know how to do the Near And Keyboard!)

Also I need to know how to change the logic bricks so that when I’m in the car, Its the cars logic, Not the characters.

Any help is greatly appreciated :smiley:

Thanks, and the game is in my sig :wink:

Attachments


Properties. When Player enters car, make an [“ACTIVE”] Property for him False, and at the same Time make the such a Property within the Logic of the Car True. The Property would be connected to the Movement of either Object, so while the Object is inactive it could not be moved. Easier to achieve when you are ursing Python (less Conncections needed).

I dont know python but I am trying to learn, Thanks for the help :slight_smile:

Expectin’ your Player has Boolean active and your Car as well:
Put all the Movement (which might be easy to adapt if you know some Basics) into an if Command:


if player["active"] == True:
 ...

Do that for the Car as well.

As soon as the Car is entered, change the Properties and that should be all.
(Of Course, you do not necessarily need Python for it. You also can connect the Property to all the Controllers that control the Motion Actions et cetera, but that might become a Hassle depending on how complex the Movement Bricks are.)

Thanks a bunch :smiley:

Attachments

python.blend (318 KB)

I set it up so For character: If near and keyboard enter in pressed- edit object,end object.
Car: if the car isn’t near the character and up arrow is pressed it moves.

Now I need to know how to make it look like I get out of the car (Spawn outside of the car) Does anyone know how I can do this using logic-bricks? :slight_smile: Thanks in advance, -Ross

I could even give you a set of logic bricks that can do this… I think.

Have an animation open the car door, and force the protagonist in. Use logic and Boolean properties, logic to play animations based on triggers, and properties so the character enters on True, and Leaves on False… or something similar.

The problem with my idea is that you have to get the character to be in a certain spot to enter the car, or he’d float inside or be stuck outside. Could a constrain location actuator (used with the car as a reference point, with local coordinates) put the character in the right spot? May be a good idea to try, but plan on a bit of experimentation.

Thanks, I ended up using messages but when I leave the car it still moves but I dont mind! Thanks everyone.

python.blend (318 KB)
Here’s the working python blend.
Just worked the code you had so you see why you were wrong.

Thanks but I still can’t seem to get it working in my game, I have sort of given upon python! Thanks anyway agoose! :slight_smile: