Godot Version
Godot 4.2
Question
I want the creatures to actually interact with each other and not just a player, so i want one to chase the other and the other to run away when they get too close to each other
Godot 4.2
I want the creatures to actually interact with each other and not just a player, so i want one to chase the other and the other to run away when they get too close to each other
also they’re supposed to move on beat to music
Look at the move_toward function.
If you set negative values it will move away.
what i mean is when something gets too close something will either run away or chase what got too close
oh wait im dumb lol gimme a sec
i should prob also ask if there are better ways to do grid based movement than what i have
I;s using something similar in my tank game:
func _physics_process(delta):
var player = get_parent().get_node("tank")
#print("PLAYER", player.position)
#print("ENEMY", position)
if abs(position.x - player.position.x) < 700 and abs(position.y - player.position.y) < 700:
print ("CHASING") #, player.position)
position += (player.position - position)/speed #*randf_range(0.1,1.5)
#Rotaion work
look_at(player.global_position)
move_and_slide()
Sadly I haven’t built any tile based games.
im gonna try to remake the movement, until then consider this closed for now