Browse Source

show pickups on bonus

Arnaud Vergnet 2 years ago
parent
commit
75eb918bfa

BIN
mini-game/ressources/sprites/plus1.png View File


+ 34
- 0
mini-game/ressources/sprites/plus1.png.import View File

@@ -0,0 +1,34 @@
1
+[remap]
2
+
3
+importer="texture"
4
+type="StreamTexture"
5
+path="res://.import/plus1.png-cc79269c0c50fcad6d2e64ff1f8fd09b.stex"
6
+metadata={
7
+"vram_texture": false
8
+}
9
+
10
+[deps]
11
+
12
+source_file="res://mini-game/ressources/sprites/plus1.png"
13
+dest_files=[ "res://.import/plus1.png-cc79269c0c50fcad6d2e64ff1f8fd09b.stex" ]
14
+
15
+[params]
16
+
17
+compress/mode=0
18
+compress/lossy_quality=0.7
19
+compress/hdr_mode=0
20
+compress/bptc_ldr=0
21
+compress/normal_map=0
22
+flags/repeat=0
23
+flags/filter=true
24
+flags/mipmaps=false
25
+flags/anisotropic=false
26
+flags/srgb=2
27
+process/fix_alpha_border=true
28
+process/premult_alpha=false
29
+process/HDR_as_SRGB=false
30
+process/invert_color=false
31
+stream=false
32
+size_limit=0
33
+detect_3d=true
34
+svg/scale=1.0

+ 19
- 0
mini-game/scenes/players/player.gd View File

@@ -27,6 +27,9 @@ var au_sol = true
27 27
 var current_lives = max_lives
28 28
 
29 29
 onready var animation = $AnimatedSprite
30
+onready var bonus_texture = $BonusControl/TextureRect
31
+onready var bonus_tween = $BonusControl/Tween
32
+onready var bonus_timer = $BonusControl/Timer
30 33
 
31 34
 signal hit()
32 35
 signal die()
@@ -74,6 +77,7 @@ func start():
74 77
 
75 78
 func stop():
76 79
 	hide()
80
+	bonus_texture.modulate = Color(1, 1, 1, 0)
77 81
 	player_enabled = false
78 82
 
79 83
 
@@ -86,6 +90,21 @@ func hit():
86 90
 		emit_signal("die")
87 91
 
88 92
 
93
+func play_bonus_anim():
94
+	bonus_texture.show()
95
+	bonus_tween.stop_all()
96
+	bonus_timer.stop()
97
+	bonus_tween.interpolate_property(bonus_texture, "modulate", null, Color(1, 1, 1, 1), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
98
+	bonus_tween.start()
99
+	bonus_timer.start()
100
+
101
+
89 102
 func bonus():
103
+	play_bonus_anim()
90 104
 	emit_signal("score")
91 105
 
106
+
107
+func _on_Timer_timeout() -> void:
108
+	bonus_tween.stop_all()
109
+	bonus_tween.interpolate_property(bonus_texture, "modulate", null, Color(1, 1, 1, 0), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT)
110
+	bonus_tween.start()

+ 27
- 1
mini-game/scenes/players/player.tscn View File

@@ -1,4 +1,4 @@
1
-[gd_scene load_steps=25 format=2]
1
+[gd_scene load_steps=26 format=2]
2 2
 
3 3
 [ext_resource path="res://mini-game/ressources/sprites/player/dino/dino_run7.png" type="Texture" id=1]
4 4
 [ext_resource path="res://mini-game/ressources/sprites/player/dino/dino_run5.png" type="Texture" id=2]
@@ -21,6 +21,7 @@
21 21
 [ext_resource path="res://mini-game/ressources/sprites/player/man/6.png" type="Texture" id=19]
22 22
 [ext_resource path="res://mini-game/ressources/sprites/player/man/7.png" type="Texture" id=20]
23 23
 [ext_resource path="res://mini-game/ressources/sprites/player/man/9_1.png" type="Texture" id=21]
24
+[ext_resource path="res://mini-game/ressources/sprites/plus1.png" type="Texture" id=22]
24 25
 
25 26
 [sub_resource type="SpriteFrames" id=1]
26 27
 animations = [ {
@@ -72,5 +73,30 @@ position = Vector2( -0.0400658, 9.23466 )
72 73
 scale = Vector2( 0.609429, 0.281311 )
73 74
 shape = SubResource( 3 )
74 75
 
76
+[node name="BonusControl" type="Control" parent="."]
77
+margin_right = 40.0
78
+margin_bottom = 40.0
79
+__meta__ = {
80
+"_edit_use_anchors_": false
81
+}
82
+
83
+[node name="TextureRect" type="TextureRect" parent="BonusControl"]
84
+margin_left = -10.7864
85
+margin_top = -26.3001
86
+margin_right = 10.2136
87
+margin_bottom = -11.3001
88
+texture = ExtResource( 22 )
89
+expand = true
90
+stretch_mode = 6
91
+__meta__ = {
92
+"_edit_use_anchors_": false
93
+}
94
+
95
+[node name="Tween" type="Tween" parent="BonusControl"]
96
+
97
+[node name="Timer" type="Timer" parent="BonusControl"]
98
+wait_time = 1.5
99
+
75 100
 [connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]
76 101
 [connection signal="body_exited" from="Area2D" to="." method="_on_Area2D_body_exited"]
102
+[connection signal="timeout" from="BonusControl/Timer" to="." method="_on_Timer_timeout"]

Loading…
Cancel
Save