This commit is contained in:
Fabio 2024-08-19 20:00:03 +02:00
commit 4982fc55bf
14 changed files with 90 additions and 44 deletions

View file

@ -29,7 +29,7 @@ func activate_plate():
print("wird aktiviert")
if not is_activated:
is_activated = true
if laser:
if laser and weakref(laser).get_ref():
laser.queue_free()
# TODO: fix error when called again

View file

@ -1,6 +1,8 @@
extends CharacterBody2D
@export var sfx : AudioStreamPlayer2D
@export var sfx_large : AudioStreamPlayer2D
@export var speed = 340
@export var gravity = 50
var jump_count = 1
@ -96,7 +98,7 @@ func _physics_process(delta):
var box = get_slide_collision(i).get_collider() as Box
if scale.x == 2:
if box and velocity.y >= 0:
box.velocity.x = velocity.x*0.8
box.velocity.x = velocity.x*1.2
else:
if box and velocity.y >= 0 and box.scale.x < 2:
box.velocity.x = velocity.x*0.8
@ -104,11 +106,12 @@ func _physics_process(delta):
update_cursor()
func Jump():
sfx.play()
if scale.x == 1:
velocity.y = -1 * jump_strength
sfx.play()
else :
velocity.y = -1 * jump_strength_large
sfx_large.play()
jump_count = 0
is_touching_floor = false