Godot Version
Question
Camera2D as seen in this photo
My animation and movement are working just fine, but the Camera2D won’t follow the Player. Tried to do the empty scene and rebuilt the player to no avail. I also tried to zoom, but it’s still not working. Figured out that all Camera2D aren’t working.
- Is it because of the movement script? (I have isometric 4d movement)
the script:
extends CharacterBody2D
@onready var animations = $AnimationPlayer
var is_rucksackopen = false
const speed = 100
const acceleration = 1000
const friction = 50
var moveStop = falsevar input = Vector2.ZERO
func _physics_process(delta):
player_movement(delta)if Input.is_action_just_pressed(“ui_rucksack”):
if is_rucksackopen:
rucksackclose()
else:
rucksackopen()func cartesian_to_isometric(cartesian):
var screen_pos = Vector2()
screen_pos.x = cartesian.x - cartesian.y
screen_pos.y = (cartesian.x + cartesian.y) / 2
return screen_posfunc get_input():
input.x = int(Input.get_action_strength(“ui_right”)) - int(Input.get_action_strength(“ui_left”))
input.y = int(Input.get_action_strength(“ui_down”)) - int(Input.get_action_strength(“ui_up”))
return input.normalized()func player_movement(delta):
input = get_input()if input == Vector2.ZERO:
moveStop = true
velocity = Vector2.ZERO
play_idle_animation()
else:
moveStop = false
velocity = velocity.limit_length(speed)
velocity += cartesian_to_isometric(input * acceleration * delta)
play_movement_animation(input)move_and_slide()
func play_movement_animation(input):
if input == Vector2(1, 0):
animations.play(“WalkSE”)
elif input == Vector2(0, 1):
animations.play(“WalkSW”)
elif input == Vector2(-1, 0):
animations.play(“WalkNW”)
elif input == Vector2(0, -1):
animations.play(“WalkNE”)func play_idle_animation():
if moveStop == true:
if Vector2(1, 0):
animations.play(“IdleSE”)
elif Vector2(0, 1):
animations.play(“IdleSW”)
elif Vector2(-1, 0):
animations.play(“IdleNW”)
elif Vector2(0, -1):
animations.play(“IdleNE”)
-
I did my research too but I can’t find the current properties. I tried with non-isometric 4d movement script but it’s working. Not sure why it’s not working with the isometric movement.
This is the picture of run scene result. I put the object on the corner to see if the camera moves, but no… Also, I tried to put the object on other places too but still not working.
-
No error comes.
-
If it’s not something related to isometric movement, may I know the problem behind this and the solution please? Thank you for the help.
→