Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | DevAwk |
I am curently following this 3.5 tutorial on a Strategy Game in Godot (https://www.youtube.com/watch?v=_pMbxkFOltw) and I am having trouble translating this to Godot 4.
I’m currently on the first part of the tutorial, and for some reason whenever I want to send out a “soldier” it spwans a sprite at the center of my camera and doesn’t move (even though it should be moving as I have added a _physics_process to my soldier scene to have it move automatically).
Relevant code for my castle scene:
var soldiers_node = preload("res://Scenes/soldiers.tscn")
func send_soldiers(target):
if soldiers > 1:
var instance = soldiers_node.instantiate()
add_child(instance)
instance.position = position
instance.send_out(target, soldier_speed, floor(soldiers / 2), player_owned)
soldiers -= floor(soldiers / 2)
Relevant code for my soldier scene:
func _physics_process(delta):
if target != null:
velocity = (target.position - position).normalized() * speed
position += velocity * delta
I can provide more context if needed, but I’ve been on this problem for a day now and I’m stumped… Is it a translation problem from Godot 3.5 to 4, or am I missing something crucial?