From 75eb918bfa2d5156fefb5e353511ac89ab935ef2 Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Wed, 5 May 2021 19:32:14 +0200 Subject: [PATCH] show pickups on bonus --- mini-game/ressources/sprites/plus1.png | Bin 0 -> 2365 bytes mini-game/ressources/sprites/plus1.png.import | 34 ++++++++++++++++++ mini-game/scenes/players/player.gd | 19 ++++++++++ mini-game/scenes/players/player.tscn | 28 ++++++++++++++- 4 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 mini-game/ressources/sprites/plus1.png create mode 100644 mini-game/ressources/sprites/plus1.png.import diff --git a/mini-game/ressources/sprites/plus1.png b/mini-game/ressources/sprites/plus1.png new file mode 100644 index 0000000000000000000000000000000000000000..18f46c4b8adcc9b036ec6afe32dad0b611f5d470 GIT binary patch literal 2365 zcmeAS@N?(olHy`uVBq!ia0y~yU;;9k7&zE~)R&4YzZe)8TQZ%U13aCb6$*;-(=u~X z85lGs)=sqbIP4(Nc7NHlt`L_u3YQd}OE)QKJz5c};nW(Sz2#Lx(Mx#~LlsTEzNYMh z2j?GM)!e;#9pAbpg&)k1o;_RgLP@o5x=7TKisOa+?`z+mzFXdKVTIAzS5nL-cg>7f zE}3z9eaFM_mW*%8O*78uB!^A9^g%ZMJI9B=dIvZEdHqjjZ`Q#i2M3jTiEWv}>xKPu zZ?QeEeWam%TI-|b#}%I9Ds@kGJ^Cp9e9~#A^F6a}o{=e>5}{MN;nKl1Iax<0A1MsI ztQmiza!t{_M{7c}*OdDIJLKUQANR;=twd170VS1=fBJ2X)=f@QbbjtB|9`^k z=_i&>Sk2_tSDE9`{N~re{}0OZ*FHM3W4eeZ(?ap%KPA`>?RMDw&f@;@zRNa@P3I3x zz4tBOq~WFirPsN-bu3?UnZ>W?`rc&LD{nZc?rfGC&UHzs%k{zEo_(79Ja?FESI6Ct zdTvq6u<6R`FT4c>96eJss?R>Zdv|W_@9oR3?w1$-U)1>Gqk;l3TG*1j-CY>=F^DoK z&9u}l1&VMMctjR6Fz6|RFk{71`!b*)dx@v7EBjMcRzY5k7jqndatx9st`Q~9`MJ5N zc_j?aMX8A;sVNHOnI#zt?w-B@;f;LaKy9L)E{-7;x8B}0%uWfFIR5ba+?m2`f-WMC z0xY>ME)kRGuH06f`^RHjor?D6u)N8;1Gyuu1vf?otZr?zOnC{W7r`(`|Pv1L8o?o-`CYq>T;*EF-{e{Cj6z z-fqBn;QsaM`rPfe*XGH5D_4H>_1^A60R{$P%Qw^4ZneJN{x`=gdh4}&TX~om60F*5 z^S0mq{_OKlEv0LFzlUbOJ=~!&v+}QDn-c?r%+JRE&;AAevr-CMyLI!;oNryua*PZH za}WP}dhJ$b%-x&om6Gm8Ri8HEU}$(L^X+rgYxa%%H^1MzK05oo`;jwN3LxPh`R~hi z+t;(M-})^uZQqvq`Hc=hw^+Q1&s}@B_iyr_9lLhdA2tFi<;-3?*Zs&!)d%y7#o0iG z575mGz>s2LU{C;3j0_AM3=9rH7B(rH%ZFHGyw-j-;`?uZ=l%2`xd{0K!XP8mFm)c7 z_@SJEA@BU;jtUXM!~b%7I`q#rF)+;NTQ2x9*M(=M<(cQ76^-ln{baoT_M48eZYu+W zMUbwNT>3MEzQ-4;_gh$6R?eBZI1?166KC4@KDJ1CCLnk?Y2yzyWAkZ_3=BTU^9xJ! z>kA(T{#&00=Bp{~>;Aj9Haj;$Z@T>~R$w5?CcFG8sLhubbk=%E0tAkD*kJIu81_DZIrcrPJojnSu8v-Aieloipyz?P$ Rp^qlWWKUN=mvv4FO#tUvHnso& literal 0 HcmV?d00001 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"]