diff --git a/mini-game/ressources/sprites/plus1.png b/mini-game/ressources/sprites/plus1.png new file mode 100644 index 0000000..18f46c4 Binary files /dev/null and b/mini-game/ressources/sprites/plus1.png differ diff --git a/mini-game/ressources/sprites/plus1.png.import b/mini-game/ressources/sprites/plus1.png.import new file mode 100644 index 0000000..d91aeaf --- /dev/null +++ b/mini-game/ressources/sprites/plus1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/plus1.png-cc79269c0c50fcad6d2e64ff1f8fd09b.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://mini-game/ressources/sprites/plus1.png" +dest_files=[ "res://.import/plus1.png-cc79269c0c50fcad6d2e64ff1f8fd09b.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=true +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +stream=false +size_limit=0 +detect_3d=true +svg/scale=1.0 diff --git a/mini-game/scenes/players/player.gd b/mini-game/scenes/players/player.gd index 5850292..bc94021 100644 --- a/mini-game/scenes/players/player.gd +++ b/mini-game/scenes/players/player.gd @@ -27,6 +27,9 @@ var au_sol = true var current_lives = max_lives onready var animation = $AnimatedSprite +onready var bonus_texture = $BonusControl/TextureRect +onready var bonus_tween = $BonusControl/Tween +onready var bonus_timer = $BonusControl/Timer signal hit() signal die() @@ -74,6 +77,7 @@ func start(): func stop(): hide() + bonus_texture.modulate = Color(1, 1, 1, 0) player_enabled = false @@ -86,6 +90,21 @@ func hit(): emit_signal("die") +func play_bonus_anim(): + bonus_texture.show() + bonus_tween.stop_all() + bonus_timer.stop() + bonus_tween.interpolate_property(bonus_texture, "modulate", null, Color(1, 1, 1, 1), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT) + bonus_tween.start() + bonus_timer.start() + + func bonus(): + play_bonus_anim() emit_signal("score") + +func _on_Timer_timeout() -> void: + bonus_tween.stop_all() + bonus_tween.interpolate_property(bonus_texture, "modulate", null, Color(1, 1, 1, 0), 0.3, Tween.TRANS_CUBIC, Tween.EASE_IN_OUT) + bonus_tween.start() diff --git a/mini-game/scenes/players/player.tscn b/mini-game/scenes/players/player.tscn index fd971e0..9108dd8 100644 --- a/mini-game/scenes/players/player.tscn +++ b/mini-game/scenes/players/player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=25 format=2] +[gd_scene load_steps=26 format=2] [ext_resource path="res://mini-game/ressources/sprites/player/dino/dino_run7.png" type="Texture" id=1] [ext_resource path="res://mini-game/ressources/sprites/player/dino/dino_run5.png" type="Texture" id=2] @@ -21,6 +21,7 @@ [ext_resource path="res://mini-game/ressources/sprites/player/man/6.png" type="Texture" id=19] [ext_resource path="res://mini-game/ressources/sprites/player/man/7.png" type="Texture" id=20] [ext_resource path="res://mini-game/ressources/sprites/player/man/9_1.png" type="Texture" id=21] +[ext_resource path="res://mini-game/ressources/sprites/plus1.png" type="Texture" id=22] [sub_resource type="SpriteFrames" id=1] animations = [ { @@ -72,5 +73,30 @@ position = Vector2( -0.0400658, 9.23466 ) scale = Vector2( 0.609429, 0.281311 ) shape = SubResource( 3 ) +[node name="BonusControl" type="Control" parent="."] +margin_right = 40.0 +margin_bottom = 40.0 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="TextureRect" type="TextureRect" parent="BonusControl"] +margin_left = -10.7864 +margin_top = -26.3001 +margin_right = 10.2136 +margin_bottom = -11.3001 +texture = ExtResource( 22 ) +expand = true +stretch_mode = 6 +__meta__ = { +"_edit_use_anchors_": false +} + +[node name="Tween" type="Tween" parent="BonusControl"] + +[node name="Timer" type="Timer" parent="BonusControl"] +wait_time = 1.5 + [connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"] [connection signal="body_exited" from="Area2D" to="." method="_on_Area2D_body_exited"] +[connection signal="timeout" from="BonusControl/Timer" to="." method="_on_Timer_timeout"]