Term
| Syntax to get the angle() function from a vector. |
|
Definition
|
|
Term
| What does Input.get_axis() do, and how many arguments does it take. |
|
Definition
| 2 input action names as arguments, used to get a value between -1.0 and 1.0 |
|
|
Term
| How would I make a variable for the direction I want my character controller to go in and set it's direction. |
|
Definition
| Set up a variable called direction and assign it as a Vector2 with position (0.0). Use the vector.x = function to assign the x value. Set the value equal to the Input.get_axis() function to your left and right inputs, do the same for the Y value and then multiply by your velocity. |
|
|
Term
| If you're having trouble with your character moving faster diagonally, what is the solution? |
|
Definition
| Normalize your direction vector with an If statement. In your statement say If direction.length() > 1.0, then direction = direction.normalized(). Doing this without specifying only when over 1.0 would mean that you can't move less than 1.0. |
|
|
Term
| What would you write in your script to get a character controller to move smoothly between directions? |
|
Definition
|
|
Term
| What would you write in your script to get a character controller to move smoothly between directions? Write out the answer and compare it to the solution. |
|
Definition
[image]
The code shows here to first create a desired velocity and set it equal to your direction vector multiplied by your max speed. Then you should calculate your direction you will be turning. Do this by subtracting your velocity by your desired velocity (here it's set as the steering_vector). Then add your steering_vector to your velocity as you move. By not just equating velocity to the steering velocity, you make it so that you won't exceed your max speed because velocity is being subtracted from the desired_velocity. You will also make sure you don't stop moving because if you didn't add the speed to the velocity then when you reached max speed you would be subtacting your full speed from your desired speed and the total would be 0. |
|
|
Term
| What is the syntax for connecting a signal in code? |
|
Definition
| signal_name.connect(function_to_call) |
|
|
Term
| For a function that is connected to a signal which takes 1 argument that is an Area2D, how would you write the function the signal connects to? |
|
Definition
[image]
The name of the function: _on_area_entered()
along with the parameter (signals version of arguments) variable name "area_that_enteered()" with a ":" and Area2D to denote that it is an an Area2D type. Voiding the function let's Godot know that this function doesn't return anything. |
|
|
Term
| What is the function to remove a node and its children from the node tree? |
|
Definition
|
|