0 votes

I'm not sure about how could be done, i already have a "fps" with a player that can move, sprint, jump and shoot, based on the doom tutorial by miziziziz, and i know how to make a vehicle using the vehicle nodes and some scripts from the vehicle tutorials by Bastiaan Olij, now i need to make that the player can enter the vehicle, what do i do? make player = vehicle, but how would i make the controls work? or maybe i need to remove the player then add the vehicle, but removing the player may be not the right way. I would apreciate any help if possible.

in Engine by (99 points)

This isn't very specific. There are many ways to do this, it depends on how you wish to set it up, such as is the player going to be parented to the vehicle or be removed/invisible whilst controlling the vehicle?

the most basic way, probably making the player invisible, because if i add something like a capture the flag, removing the player may remove the flag, or drop the flag like team fortress 2 do when you enter a respawn room, but halo don't drop the flag when you enter the vehicle, my question is how would be made like changing the controls from player to vehicle and vice versa.

The easiest way to be to use bools to determine which to control.

if player:
    #player behaviour
elif vehicle:
    #vehicle behaviour

But depending on the setup of the game this may have to be done through separate scripts for each type of player.
E.g. the player script could be something like this

if !vehicle:
    #player behaviour
    Player.visible = false
    #call function in vehicle script

Interesting, thanks for the help!

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.