So im following tutorial “Your first 2D game” from GDQuest, probably bunch of you know already this one. Im stuck pretty early.
After adding mob i’ve lost ability to move character in f5 preview. First i though it was a problem of using int instead of float in mob code, i fixed it and for once controlls worked. After that one preview it doesnt work anymore. Below im publishing my code for player and mob:
extends CharacterBody2D
func _physics_process(delta):
var direction = Input.get_vector(“move_left”, “move_right”, “move_up”, “move_down”)
velocity = direction * 600.0
move_and_slide()
if velocity.length() > 0.0:
%HappyBoo.play_walk_animation()
else:
%HappyBoo.play_idle_animation()
extends CharacterBody2D
@onready var player = get_node(“/root/Game/Player”)
func _physics_process(delta):
var direction = global_position.direction_to(player.global_position)
velocity = direction * 300.0
move_and_slide()
I’d appreciate any help, coz im pretty new in game dev and have only basic knowlege of programming.