items/fromages: la princesse peut manger un fromage
En vrai, pour l'instant voilà ce qui est fait: - le fromage existe et est plaçable sur le niveau à convenance. Autant qu'on veut. - le fromage est une entité autonome dans ses animations et c'est lui qui va enoyer un signal à la princesse quand elle rentre en collision avec lui. Reste à mettre en place: - Un timer pour faire réaparaitre le fromage - Un affichager de jauge à prout pour la princesse
This commit is contained in:
11
items/fromage_normal.gd
Normal file
11
items/fromage_normal.gd
Normal file
@@ -0,0 +1,11 @@
|
||||
class_name normal_cheese extends Area2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
131
items/fromage_normal.tscn
Normal file
131
items/fromage_normal.tscn
Normal file
@@ -0,0 +1,131 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://bfff6uggijk4k"]
|
||||
|
||||
[ext_resource type="Script" path="res://items/normal_cheese.gd" id="1_2l3x1"]
|
||||
[ext_resource type="Texture2D" uid="uid://blh8aqj3ojadf" path="res://sprite/items.png" id="1_rx0yq"]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_7rdb1"]
|
||||
atlas = ExtResource("1_rx0yq")
|
||||
region = Rect2(16, 0, 16, 16)
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_xry4i"]
|
||||
radius = 6.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_r46qo"]
|
||||
resource_name = "RESET"
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = false
|
||||
tracks/1/path = NodePath("Sprite2D:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(),
|
||||
"transitions": PackedFloat32Array(),
|
||||
"update": 0,
|
||||
"values": []
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Sprite2D:self_modulate")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_fpj7j"]
|
||||
resource_name = "cheese"
|
||||
loop_mode = 1
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.1, 0.5, 1),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0, -2), Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_jemsl"]
|
||||
resource_name = "picked"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite2D:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0.1, 1),
|
||||
"transitions": PackedFloat32Array(1, 2.2974),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0, -50)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = false
|
||||
tracks/1/path = NodePath(".:modulate")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(),
|
||||
"transitions": PackedFloat32Array(),
|
||||
"update": 0,
|
||||
"values": []
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Sprite2D:self_modulate")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0.1, 1),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_4iwa0"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_r46qo"),
|
||||
"cheese": SubResource("Animation_fpj7j"),
|
||||
"picked": SubResource("Animation_jemsl")
|
||||
}
|
||||
|
||||
[node name="Fromage normal" type="Area2D"]
|
||||
collision_layer = 64
|
||||
script = ExtResource("1_2l3x1")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
texture = SubResource("AtlasTexture_7rdb1")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_xry4i")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
autoplay = "cheese"
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_4iwa0")
|
||||
}
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
8
items/normal_cheese.gd
Normal file
8
items/normal_cheese.gd
Normal file
@@ -0,0 +1,8 @@
|
||||
class_name NormalCheese extends Area2D
|
||||
|
||||
|
||||
@onready var animation_player := $AnimationPlayer as AnimationPlayer
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
animation_player.play(&"picked")
|
||||
(body as Princess).cheese_collected.emit()
|
||||
Reference in New Issue
Block a user