Im really sorry for how dumb I'm being it must be really easy for you too understand but since im working on vector2 am I able to change the z cord of the player and how would i go about writing it in GDscript. If you want i can show you my player script and the tree only has a staticBody2D and its child is Collision shape2D of the rectangle shape.
My GDscript for the player is this:
extends KinematicBody2D
Get player sprite
var sprite_node
Player speed
export (int) var speed = 200
var velocity = Vector2()
Camera follow player
var look_direction = Vector2(1, 0)
func ready():
spritenode = get_node("playerSprite")
Movement with keyboard
func get_input():
velocity = Vector2()
if Input.is_action_pressed('right'):
velocity.x += 1
sprite_node.set_flip_h(true)
if Input.is_action_pressed('left'):
velocity.x -= 1
sprite_node.set_flip_h(false)
if Input.is_action_pressed('up'):
velocity.y -= 1
if Input.is_action_pressed('down'):
velocity.y += 1
velocity = velocity.normalized() * speed
if Input.is_action_pressed('right') or Input.is_action_pressed('left') or Input.is_action_pressed('up') or Input.is_action_pressed('down'):
emit_signal("move")
func physicsprocess(delta):
# Calls get_input function
get_input()
# Moves the character
move_and_slide(velocity)
Its probably really inefficient the method i have done it but as i staated before im new too this engine and honestly I'm really bad at coding my mind set is not that great but I'm trying to push myself too actually learn to code because making games is pretty fun, especially sandbox adventure games just seeing it grow is really the only reason im making it.
Thanks
Jack