- git init
This commit is contained in:
commit
78d62d0173
394 changed files with 8494 additions and 0 deletions
35
code/player.gd
Normal file
35
code/player.gd
Normal file
|
@ -0,0 +1,35 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
@export var gravity: float = 300
|
||||
@export var move_speed: float = 120
|
||||
@export var Hüpfen_inpuls: float = 340
|
||||
|
||||
func _physics_process(delta):
|
||||
velocity.y = velocity.y + gravity *delta
|
||||
velocity.y += gravity * delta
|
||||
velocity.x = 0
|
||||
if Input.is_action_pressed("move_left"):
|
||||
velocity.x -= move_speed
|
||||
if Input.is_action_pressed("move_right"):
|
||||
velocity.x += move_speed
|
||||
velocity.x += $"../Control/left/Joystick".posVector.x*move_speed
|
||||
if Input.is_action_pressed("Hüpfen"):
|
||||
jump()
|
||||
move_and_slide()
|
||||
|
||||
|
||||
|
||||
func jump():
|
||||
if is_on_floor():
|
||||
velocity.y -= Hüpfen_inpuls
|
||||
|
||||
func die():
|
||||
# sterben
|
||||
$"../Charakter".global_position = $"../RespawnMarker".global_position
|
||||
|
||||
func _on_area_2d_area_entered(area: Area2D) -> void:
|
||||
# Falls die Playerhitbox eine are betritt
|
||||
if area.is_in_group("die"):
|
||||
# Ist die Area in der "die" Gruppe?
|
||||
# dann stirb!!!
|
||||
die()
|
Loading…
Add table
Add a link
Reference in a new issue