Increased Glowling speed and added delta time scaling

Significant changes include:
- The Glowling entity's speed has been quadrupled from 10 to 40.
- The _process function now scales the movement speed by the elapsed time (delta) for smoother motion.
- VSync mode has been disabled in project settings.
This commit is contained in:
Dan 2024-06-01 20:05:16 +01:00
parent 9f9f1a7502
commit 217f0ab18c
2 changed files with 4 additions and 3 deletions

View file

@ -4,19 +4,19 @@ class_name Glowling
@onready var tilemap = $"../TileMap" # This needs rectifying @onready var tilemap = $"../TileMap" # This needs rectifying
var current_path : Array[Vector2i] = [] var current_path : Array[Vector2i] = []
var speed : int = 10 var speed : int = 40
func _ready(): func _ready():
$GlowlingAnimations.play("GlowingPulse") $GlowlingAnimations.play("GlowingPulse")
pass pass
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta): func _process(delta):
if current_path.is_empty(): if current_path.is_empty():
return return
var target_position = tilemap.map_to_local(current_path.front()) var target_position = tilemap.map_to_local(current_path.front())
global_position = global_position.move_toward(target_position, speed) global_position = global_position.move_toward(target_position, speed * delta)
if global_position == target_position: if global_position == target_position:
current_path.pop_front() current_path.pop_front()

View file

@ -20,6 +20,7 @@ config/icon="res://icon.svg"
window/stretch/mode="canvas_items" window/stretch/mode="canvas_items"
window/stretch/scale=2.0 window/stretch/scale=2.0
window/stretch/scale_mode="integer" window/stretch/scale_mode="integer"
window/vsync/vsync_mode=0
[editor_plugins] [editor_plugins]