prout: pét illimité
Pour le moment et par manque de gameplay, je préfère choisir de ne pas limiter le prout de quelque manière que ce soit. J'ai donc délibérément supprimé du HUD la geauge de prout et aussi le fait que le prout se recharge. Maintenant les fromages sont juste des fromages. Une sorte de truc à ramasser mais qui sert à rien. Le gameplay après le juyce.
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
class_name FartGauge extends Node2D
|
||||
|
||||
|
||||
@onready var animationPlayer := $AnimationPlayer as AnimationPlayer
|
||||
|
||||
signal reload_done()
|
||||
signal dash_done()
|
||||
|
||||
var loading = false
|
||||
var loaded = false
|
||||
|
||||
func load_cheese(speed) -> bool:
|
||||
animationPlayer.speed_scale = speed
|
||||
if not loading and not loaded:
|
||||
animationPlayer.play("reload")
|
||||
loading = true
|
||||
return true
|
||||
return false
|
||||
|
||||
func dash_fart() -> bool:
|
||||
if loaded:
|
||||
animationPlayer.play("DASH")
|
||||
return loaded
|
||||
|
||||
func reset():
|
||||
animationPlayer.play("RESET")
|
||||
loaded = false
|
||||
loading = false
|
||||
|
||||
func _on_animation_player_animation_finished(anim_name: StringName) -> void:
|
||||
if anim_name == "reload":
|
||||
loading = false
|
||||
loaded = true
|
||||
reload_done.emit()
|
||||
if anim_name == "DASH":
|
||||
loaded = false
|
||||
dash_done.emit()
|
||||
@@ -1,115 +0,0 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dsgt6b1bqi6ui"]
|
||||
|
||||
[ext_resource type="Script" path="res://HUD/fart_gauge.gd" id="1_jculu"]
|
||||
[ext_resource type="Texture2D" uid="uid://c8r4ylb5ygl5c" path="res://sprite/jauge-de-prout.png" id="1_rt22i"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_nsc8d"]
|
||||
resource_name = "DASH"
|
||||
length = 0.25
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Full:position")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, 0), Vector2(0, -72)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Full:region_rect")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Rect2(16, 0, 16, 144), Rect2(16, 0, 16, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_8hnm2"]
|
||||
resource_name = "RESET"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Full:region_rect")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Rect2(16, 0, 16, 0)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Full:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, -72)]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_eh7ry"]
|
||||
resource_name = "reload"
|
||||
length = 2.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Full:region_rect")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Rect2(16, 0, 16, 0), Rect2(16, 0, 16, 144)]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Full:position")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 2),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Vector2(0, -70), Vector2(0, 0)]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_hfkd0"]
|
||||
_data = {
|
||||
"DASH": SubResource("Animation_nsc8d"),
|
||||
"RESET": SubResource("Animation_8hnm2"),
|
||||
"reload": SubResource("Animation_eh7ry")
|
||||
}
|
||||
|
||||
[node name="FartGauge" type="Node2D"]
|
||||
script = ExtResource("1_jculu")
|
||||
|
||||
[node name="Empty" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("1_rt22i")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(0, 0, 16, 144)
|
||||
|
||||
[node name="Full" type="Sprite2D" parent="."]
|
||||
position = Vector2(0, -72)
|
||||
texture = ExtResource("1_rt22i")
|
||||
region_enabled = true
|
||||
region_rect = Rect2(16, 0, 16, 0)
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_hfkd0")
|
||||
}
|
||||
|
||||
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_player_animation_finished"]
|
||||
37
HUD/hud.gd
37
HUD/hud.gd
@@ -1,42 +1,23 @@
|
||||
class_name HUD extends CanvasLayer
|
||||
|
||||
@onready var gauge1 := $FartGauge1 as FartGauge
|
||||
@onready var gauge2 := $FartGauge2 as FartGauge
|
||||
@onready var gauge3 := $FartGauge3 as FartGauge
|
||||
|
||||
@onready var shader := $TransitionShader
|
||||
|
||||
signal fart_reloaded()
|
||||
signal screen_is_black()
|
||||
signal screen_is_ready()
|
||||
|
||||
var cheese_number = 0
|
||||
var gauges = []
|
||||
|
||||
func _ready() -> void:
|
||||
gauge1.connect("reload_done", cheese_loaded)
|
||||
gauge2.connect("reload_done", cheese_loaded)
|
||||
gauge3.connect("reload_done", cheese_loaded)
|
||||
gauges = [gauge1, gauge2, gauge3]
|
||||
func got_lactase():
|
||||
print("you got lactase, TODO HUD")
|
||||
pass
|
||||
|
||||
func reset():
|
||||
cheese_number = 0
|
||||
for gauge in gauges:
|
||||
gauge.reset()
|
||||
func got_cheese(speed):
|
||||
print("you got cheese, TODO HUD")
|
||||
pass
|
||||
|
||||
func load_cheese(speed):
|
||||
for gauge in gauges:
|
||||
if gauge.load_cheese(speed):
|
||||
return
|
||||
|
||||
func dash_fart():
|
||||
for x in gauges.size():
|
||||
var gauge = gauges[-x-1]
|
||||
if gauge.dash_fart():
|
||||
return
|
||||
|
||||
func cheese_loaded():
|
||||
fart_reloaded.emit()
|
||||
func dash():
|
||||
print("you dashed, TODO HUD")
|
||||
pass
|
||||
|
||||
func begin_scene_transition():
|
||||
print("start scene transition")
|
||||
|
||||
18
HUD/hud.tscn
18
HUD/hud.tscn
@@ -1,27 +1,11 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://dvlb4thqhqke"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://dvlb4thqhqke"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://dsgt6b1bqi6ui" path="res://HUD/fart_gauge.tscn" id="1_4e2i3"]
|
||||
[ext_resource type="Script" path="res://HUD/hud.gd" id="1_e1sc7"]
|
||||
[ext_resource type="PackedScene" uid="uid://17macg0q4k8l" path="res://shaders/transition_shader.tscn" id="2_gh8iu"]
|
||||
|
||||
[node name="HUD" type="CanvasLayer"]
|
||||
script = ExtResource("1_e1sc7")
|
||||
|
||||
[node name="FartGauge3" parent="." instance=ExtResource("1_4e2i3")]
|
||||
position = Vector2(242, 6)
|
||||
rotation = -1.5708
|
||||
scale = Vector2(0.7, 0.7)
|
||||
|
||||
[node name="FartGauge2" parent="." instance=ExtResource("1_4e2i3")]
|
||||
position = Vector2(147, 6)
|
||||
rotation = -1.5708
|
||||
scale = Vector2(0.7, 0.7)
|
||||
|
||||
[node name="FartGauge1" parent="." instance=ExtResource("1_4e2i3")]
|
||||
position = Vector2(51, 6)
|
||||
rotation = -1.5708
|
||||
scale = Vector2(0.7, 0.7)
|
||||
|
||||
[node name="TransitionShader" parent="." instance=ExtResource("2_gh8iu")]
|
||||
offset_right = 0.0
|
||||
offset_bottom = 0.0
|
||||
|
||||
29
game.gd
29
game.gd
@@ -47,8 +47,9 @@ func _on_hud_screen_is_black() -> void:
|
||||
var old_princesse :Princess = null
|
||||
if current_scence:
|
||||
old_princesse = current_scence.find_child("Princesse")
|
||||
old_princesse.disconnect("cheese_collected", hud_load_cheese)
|
||||
old_princesse.disconnect("dash_fart", hud_unload_cheese)
|
||||
old_princesse.disconnect("cheese_collected", hud.got_cheese)
|
||||
old_princesse.disconnect("lactase_collected", hud.got_lactase)
|
||||
old_princesse.disconnect("dash_fart", hud.dash)
|
||||
#old_princesse.disconnect("princess_is_dead", princess_death)
|
||||
remove_child(current_scence)
|
||||
|
||||
@@ -69,29 +70,11 @@ func _on_hud_screen_is_black() -> void:
|
||||
last_spawn_point = spawn_point
|
||||
if old_princesse:
|
||||
princesse.copy_from(old_princesse)
|
||||
princesse.connect("cheese_collected", hud_load_cheese)
|
||||
princesse.connect("lactase_collected", hud_reset_cheese)
|
||||
princesse.connect("dash_fart", hud_unload_cheese)
|
||||
princesse.connect("cheese_collected", hud.got_cheese)
|
||||
princesse.connect("lactase_collected", hud.got_lactase)
|
||||
princesse.connect("dash_fart", hud.dash)
|
||||
#princesse.connect("princess_is_dead", princess_death)
|
||||
hud.end_scene_transition()
|
||||
|
||||
# vient de la princesse quand elle a ramassé du lactase
|
||||
func hud_reset_cheese():
|
||||
Input.start_joy_vibration(0, 0.1, 0.1, 0.1)
|
||||
hud.reset()
|
||||
|
||||
# vient de la princesse quand elle a ramassé un fromage
|
||||
func hud_load_cheese(speed):
|
||||
Input.start_joy_vibration(0, 0, 1, 0.1)
|
||||
hud.load_cheese(speed)
|
||||
|
||||
# vient de la princesse quand elle ^ète
|
||||
func hud_unload_cheese():
|
||||
hud.dash_fart()
|
||||
|
||||
# quand le fromage est chargé, le jeu le signale à la princesse
|
||||
func _on_hud_fart_reloaded() -> void:
|
||||
princesse.reload_fart()
|
||||
|
||||
func _on_hud_screen_is_ready() -> void:
|
||||
princesse.go_out_and_play()
|
||||
|
||||
@@ -38,6 +38,5 @@ script = ExtResource("1_yny56")
|
||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||
environment = SubResource("Environment_egx7o")
|
||||
|
||||
[connection signal="fart_reloaded" from="HUD" to="." method="_on_hud_fart_reloaded"]
|
||||
[connection signal="screen_is_black" from="HUD" to="." method="_on_hud_screen_is_black"]
|
||||
[connection signal="screen_is_ready" from="HUD" to="." method="_on_hud_screen_is_ready"]
|
||||
|
||||
@@ -120,7 +120,6 @@ var dashing : bool = false
|
||||
var dash_step : int = -1
|
||||
var dash_direction_x : int = 1
|
||||
var dash_direction_y : int = 1
|
||||
var available_dashs = 1000
|
||||
|
||||
# Variables d'état relative au crouch
|
||||
var crouch : bool = false
|
||||
@@ -151,7 +150,6 @@ func copy_from(other : Princess):
|
||||
dash_step = other.dash_step
|
||||
dash_direction_x = other.dash_direction_x
|
||||
dash_direction_y = other.dash_direction_y
|
||||
available_dashs = other.available_dashs
|
||||
near_cliff = other.near_cliff
|
||||
|
||||
################################################################################
|
||||
@@ -517,7 +515,7 @@ func read_input() -> void:
|
||||
|
||||
|
||||
if Input.is_action_just_pressed("dash" + action_suffix):
|
||||
if not dashing and available_dashs > 0:
|
||||
if not dashing:
|
||||
var axis_x = Input.get_axis(
|
||||
"move_left" + action_suffix,
|
||||
"move_right" + action_suffix
|
||||
@@ -544,7 +542,6 @@ func read_input() -> void:
|
||||
# Ne dasher que si une direction est donnée avec le joystick
|
||||
if dash_direction_x or dash_direction_y:
|
||||
Input.start_joy_vibration(0, 1, 0.5, 0.2)
|
||||
available_dashs -=1
|
||||
dashing = true
|
||||
nuage_prout.restart()
|
||||
nuage_prout.emitting = true
|
||||
@@ -634,9 +631,9 @@ func _physics_process(_delta: float) -> void:
|
||||
|
||||
func you_got_cheese(speed:float=1) -> void:
|
||||
cheese_collected.emit(speed)
|
||||
reload_fart()
|
||||
|
||||
func reload_fart() -> void:
|
||||
available_dashs = min(available_dashs+1, MAX_FARTS)
|
||||
Input.start_joy_vibration(0, 0, 1, 0.2)
|
||||
|
||||
func you_got_lactase() -> void:
|
||||
@@ -644,7 +641,6 @@ func you_got_lactase() -> void:
|
||||
kill_farts()
|
||||
|
||||
func kill_farts() -> void:
|
||||
#available_dashs = 0
|
||||
cancel_dash()
|
||||
Input.start_joy_vibration(0, 0.5, 0, 0.1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user