Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | BraveHeartMA |
extends KinematicBody2D
const ACCELERATION = 500
const MAX_SPEED = 80
const FRICTION = 500
var velocity = Vector2.ZERO
func _physics_process(delta):
var input_vector = Vector2.ZERO
input_vector.x = Input.get_action_strength(“ui_right”) - Input.get_action_strength(“ui_left”)
input_vector.y = Input.get_action_strength(“ui_down”) - Input.get_action_strength(“ui_up”)
input_vector = input_vector.normalized()
if input_vector != Vector2.ZERO:
velocity = velocity.move_toward(input_vector * MAX_SPEED * ACCELERATION * delta)
else:
velocity = velocity.move_toward(Vector2.ZERO, FRICTION * delta)
move_and_collide(velocity * delta)
This is the code and I am not sure what the problem is. Also i keep getting errors that mention C++ even though I am using gdscript.
The C++ error comes with GDscript error btw, since GDscript isnt a real programming language its made using another (C++) and of course godot itself is a program that was coded in C++ its only natural to get a C++ error
Kurotsuki | 2021-03-09 06:26
Oh I see, I appreciate the information and will keep that in mind moving forward.
BraveHeartMA | 2021-03-09 20:12