initial project with basic moevment setup
This commit is contained in:
parent
cabe78caf0
commit
be880bd228
9 changed files with 178 additions and 2 deletions
18
ship.gd
Normal file
18
ship.gd
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
extends RigidBody2D
|
||||
|
||||
@export var thrust_power : float = 1
|
||||
@export var turn_power : float = 1
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
var turning : float = Input.get_axis("turn_left","turn_right") * turn_power
|
||||
var thrust : float = Input.get_action_strength("thrust") * thrust_power
|
||||
|
||||
apply_torque(turning)
|
||||
apply_force(Vector2(-thrust,-thrust) * transform.y )
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue