Tentative player
This commit is contained in:
parent
1511fbecbf
commit
ddbd53292c
5 changed files with 76 additions and 1 deletions
21
Scene/player.gd
Normal file
21
Scene/player.gd
Normal file
|
@ -0,0 +1,21 @@
|
|||
extends CharacterBody2D
|
||||
|
||||
|
||||
const move_speed = 100.0
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
move_and_slide()
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var direction : Vector2 = Vector2.ZERO
|
||||
direction.x = Input.get_action_raw_strength("BOUGER_DROITE") - Input.get_action_raw_strength("BOUGER_GAUCHE")
|
||||
direction.y = Input.get_action_raw_strength("BOUGER_BAS") - Input.get_action_raw_strength("BOUGER_HAUT")
|
||||
|
||||
velocity = direction * move_speed
|
||||
|
||||
|
||||
|
||||
func _on_area_2d_body_exited(body: CharacterBody2D) -> void:
|
||||
print(body)
|
||||
print("Le joueur essaie de quitter la zone !")
|
Loading…
Add table
Add a link
Reference in a new issue