21 lines
574 B
GDScript
21 lines
574 B
GDScript
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 !")
|