Tentative player
This commit is contained in:
parent
1511fbecbf
commit
ddbd53292c
5 changed files with 76 additions and 1 deletions
13
Scene/MaiEE0A.tmp
Normal file
13
Scene/MaiEE0A.tmp
Normal file
|
@ -0,0 +1,13 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://bvunk8qf230h4"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bvtebeu1wy2ak" path="res://Scene/player.tscn" id="1_kveqs"]
|
||||
|
||||
[node name="MainScene" type="Node2D"]
|
||||
position = Vector2(49, 153)
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("1_kveqs")]
|
||||
position = Vector2(111, -23)
|
||||
|
||||
[connection signal="area_exited" from="Area2D" to="Player" method="_on_area_2d_area_exited"]
|
20
Scene/MainScene.tscn
Normal file
20
Scene/MainScene.tscn
Normal file
|
@ -0,0 +1,20 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://bvunk8qf230h4"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bvtebeu1wy2ak" path="res://Scene/player.tscn" id="1_kveqs"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_gom25"]
|
||||
size = Vector2(1156, 647)
|
||||
|
||||
[node name="MainScene" type="Node2D"]
|
||||
position = Vector2(49, 153)
|
||||
|
||||
[node name="Area2D" type="Area2D" parent="."]
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
|
||||
position = Vector2(527, 168.5)
|
||||
shape = SubResource("RectangleShape2D_gom25")
|
||||
|
||||
[node name="Player" parent="." instance=ExtResource("1_kveqs")]
|
||||
position = Vector2(111, -23)
|
||||
|
||||
[connection signal="body_exited" from="Area2D" to="Player" method="_on_area_2d_body_exited"]
|
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 !")
|
17
Scene/player.tscn
Normal file
17
Scene/player.tscn
Normal file
|
@ -0,0 +1,17 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://bvtebeu1wy2ak"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scene/player.gd" id="1_4giad"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4viqupj5q0je" path="res://ressources/images/icon.svg" id="1_p44a3"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_mgmcf"]
|
||||
size = Vector2(119, 116)
|
||||
|
||||
[node name="Player" type="CharacterBody2D"]
|
||||
script = ExtResource("1_4giad")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
position = Vector2(-0.5, 1)
|
||||
shape = SubResource("RectangleShape2D_mgmcf")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("1_p44a3")
|
|
@ -11,10 +11,14 @@ config_version=5
|
|||
[application]
|
||||
|
||||
config/name="code-game-jam-drop-plafond-2025"
|
||||
run/main_scene="res://menu_principal/menu_principal_affichage.tscn"
|
||||
run/main_scene="res://Scene/MainScene.tscn"
|
||||
config/features=PackedStringArray("4.3", "GL Compatibility")
|
||||
config/icon="res://ressources/images/icon.svg"
|
||||
|
||||
[dotnet]
|
||||
|
||||
project/assembly_name="code-game-jam-drop-plafond-2025"
|
||||
|
||||
[input]
|
||||
|
||||
BOUGER_HAUT={
|
||||
|
|
Loading…
Add table
Reference in a new issue