diff --git a/MyObsidianVault/Godot_Training/2D/Tutorial Game - to space and beyond/turning image towards direction (setting rotation).md b/MyObsidianVault/Godot_Training/2D/Tutorial Game - to space and beyond/01. turning image towards direction (setting rotation).md similarity index 100% rename from MyObsidianVault/Godot_Training/2D/Tutorial Game - to space and beyond/turning image towards direction (setting rotation).md rename to MyObsidianVault/Godot_Training/2D/Tutorial Game - to space and beyond/01. turning image towards direction (setting rotation).md diff --git a/MyObsidianVault/Godot_Training/2D/Tutorial Game - to space and beyond/Player Input.md b/MyObsidianVault/Godot_Training/2D/Tutorial Game - to space and beyond/02. Player Input.md similarity index 100% rename from MyObsidianVault/Godot_Training/2D/Tutorial Game - to space and beyond/Player Input.md rename to MyObsidianVault/Godot_Training/2D/Tutorial Game - to space and beyond/02. Player Input.md diff --git a/MyObsidianVault/Godot_Training/2D/Tutorial Game - to space and beyond/03. Increasing speed.md b/MyObsidianVault/Godot_Training/2D/Tutorial Game - to space and beyond/03. Increasing speed.md new file mode 100644 index 0000000..a474601 --- /dev/null +++ b/MyObsidianVault/Godot_Training/2D/Tutorial Game - to space and beyond/03. Increasing speed.md @@ -0,0 +1,19 @@ +```python +func _process(delta: float) -> void: + var direction := Vector2(0, 0) + direction.x = Input.get_axis("move_left", "move_right") + direction.y = Input.get_axis("move_up", "move_down") + + if direction.length() > 1.0: + direction = direction.normalized() + + if Input.is_action_just_pressed("boost"): + max_speed = boost_speed + get_node("Timer").start() + + velocity = direction * max_speed + position += velocity * delta + + if direction.length() > 0.0: + rotation = velocity.angle() +```