Hi, with this code in the above tutorial the player moves on a 2d axis not a isometric axis.
The question Im asking is how to apply the cartesian to isometric func to make the movement
move on a isometric axis.
Here is the code from the tutorial which I`m referring to...
`extends CharacterBody2D
const speed = 100
const acceleration =1000
const friction = 50
var input = Vector2.ZERO
#var screen_size = get_viewport_rect().size
func _physics_process(delta):
player_movement(delta)
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_pos
func get_input():
input.x = int(Input.is_action_pressed("move_right")) - int(Input.is_action_pressed("move_left"))
input.y = int(Input.is_action_pressed("move_down")) - int(Input.is_action_pressed("move_up"))
return input.normalized()
func player_movement(delta):
input = get_input()
if input == Vector2.ZERO:
if velocity.length() > (friction * delta):
velocity -= velocity.normalized() * (friction * delta)
else:
velocity = Vector2.ZERO
else:
velocity += (input * acceleration * delta)
velocity = velocity.limit_length(speed)
#velocity = cartesian_to_isometric(input)
move_and_slide()`