Compare commits

...

2 commits

Author SHA1 Message Date
75eb918bfa show pickups on bonus 2021-05-05 19:32:14 +02:00
f8a8cc959d add pickup sounds 2021-05-05 19:08:04 +02:00
11 changed files with 155 additions and 8 deletions

View file

@ -0,0 +1 @@
kenney interface sounds

Binary file not shown.

View file

@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/error_006.wav-438e664d4aa9fd9a3094b65b6b14697e.sample"
[deps]
source_file="res://mini-game/ressources/sounds/error_006.wav"
dest_files=[ "res://.import/error_006.wav-438e664d4aa9fd9a3094b65b6b14697e.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop=false
compress/mode=0

Binary file not shown.

View file

@ -0,0 +1,21 @@
[remap]
importer="wav"
type="AudioStreamSample"
path="res://.import/select_006.wav-751a8b3f8c877e8e8de092e911ac7aaf.sample"
[deps]
source_file="res://mini-game/ressources/sounds/select_006.wav"
dest_files=[ "res://.import/select_006.wav-751a8b3f8c877e8e8de092e911ac7aaf.sample" ]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop=false
compress/mode=0

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,11 +77,11 @@ func start():
func stop():
hide()
bonus_texture.modulate = Color(1, 1, 1, 0)
player_enabled = false
func hit():
print("hit")
current_lives -= 1
if current_lives > 0:
emit_signal("hit")
@ -87,7 +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():
print("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"]

View file

@ -5,15 +5,21 @@ export var type := "bonus" setget , get_type
export var scroll_speed = 9
onready var sprite = $Sprite
onready var notifier = $notifier
onready var audio_stream = $AudioStreamPlayer
onready var timer = $Timer
var malus_sound = preload("res://mini-game/ressources/sounds/error_006.wav")
var bonus_sound = preload("res://mini-game/ressources/sounds/select_006.wav")
var picked_up := false
func _ready():
sprite.texture = sprite_texture
notifier.connect("screen_exited", self, "_on_screen_exited")
func _on_screen_exited():
func _on_notifier_screen_exited() -> void:
if not picked_up:
queue_free()
@ -30,7 +36,14 @@ func move():
func pickup():
queue_free()
picked_up = true
timer.start()
sprite.hide()
if type == "bonus":
audio_stream.stream = bonus_sound
elif type == "malus":
audio_stream.stream = malus_sound
audio_stream.play()
func _on_Area2D_body_entered(body: Node) -> void:
@ -40,3 +53,7 @@ func _on_Area2D_body_entered(body: Node) -> void:
body.bonus()
elif type == "malus":
body.hit()
func _on_AudioStreamPlayer_finished() -> void:
queue_free()

View file

@ -20,5 +20,15 @@ scale = Vector2( 0.202437, 0.202437 )
shape = SubResource( 1 )
[node name="notifier" type="VisibilityNotifier2D" parent="."]
position = Vector2( 100, 0 )
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
[node name="Timer" type="Timer" parent="."]
wait_time = 3.0
one_shot = true
[connection signal="body_entered" from="Area2D" to="." method="_on_Area2D_body_entered"]
[connection signal="screen_exited" from="notifier" to="." method="_on_notifier_screen_exited"]
[connection signal="finished" from="AudioStreamPlayer" to="." method="_on_AudioStreamPlayer_finished"]
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]