I only changed the tile map and everything stopped working both animations, labels and bars. Please help
extends CharacterBody2D
var speed = 200
const jump_velocity = -400
var direction = Vector2()
var jetpack_fuel = 100
var points = 0
@onready var sprite_2d = $Sprite2D
@onready var fuel_label = $jetpack_fuel
@onready var health_label = $main_health
@onready var health_bar = $health_bar
@onready var fuel_bar = $fuel_bar
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
var animation = 'idle_no_jp'
func _ready():
health_bar.value = Global.health
fuel_bar.value = jetpack_fuel
func damage(delta):
if Input.is_action_just_pressed('Damage'):
Global.health -= 50 * delta
health_bar.value = Global.health
#Function for moving
func _jetpacking(delta):
if Input.is_action_pressed("Jump") and jetpack_fuel > 0:
velocity.y = jump_velocity * 0.5
jetpack_fuel -= 10 * delta
animation = 'jetpacking'
else:
velocity.y += gravity * delta
if not is_on_floor():
animation = 'jumping'
if not is_on_floor():
speed = 250
fuel_bar.value = jetpack_fuel
func _walking_n_running():
direction = Input.get_axis("GoLeft", "GoRight")
if direction != 0:
velocity.x = direction * speed
if speed > 200 and is_on_floor():
animation = "running_no_jp"
if speed <= 200 and is_on_floor():
animation = "walking_no_jp"
else:
velocity.x = move_toward(velocity.x, 0, 16)
if is_on_floor():
animation = "idle_no_jp"
func _jump(delta):
if is_on_floor() and Input.is_action_just_pressed("Jump"):
velocity.y = jump_velocity
animation = 'jumping'
elif not is_on_floor():
_jetpacking(delta)
func _running():
if Input.is_action_pressed('Sprint') and is_on_floor():
speed = 280
else:
speed = 200
func _flip():
if Input.is_action_just_pressed('GoLeft'):
sprite_2d.flip_h = false
if Input.is_action_just_pressed('GoRight'):
sprite_2d.flip_h = true
#Function for moving end
func _physics_process(delta):
#movements
_jump(delta)
_walking_n_running()
_running()
_flip()
move_and_slide()
#labelsetc_
sprite_2d.animation = animation
fuel_label.text = str(int(jetpack_fuel))
health_label.text = str(int(Global.health))
#healthchanges
damage(delta)