show pickups on bonus

This commit is contained in:
Arnaud Vergnet 2021-05-05 19:32:14 +02:00
parent f8a8cc959d
commit 75eb918bfa
4 changed files with 80 additions and 1 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

View file

@ -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

View file

@ -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()

View file

@ -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"]