added cool animation to springs

This commit is contained in:
zoe 2021-10-18 13:25:09 +02:00
parent 7b67b3aef6
commit a88727b2d8
13 changed files with 267 additions and 47 deletions

View file

@ -0,0 +1,3 @@
source_md5="c7074158bb40576d10c37526ac6a0131"
dest_md5="39e883669776a9934ad90f82bc8ca7ff"

BIN
Aseprite/springSpawn.ase Normal file

Binary file not shown.

View file

@ -1,7 +1,7 @@
extends Label
func _ready():
GameStats.connect("score_changed", self, "update_score_text")
var _connect = GameStats.connect("score_changed", self, "update_score_text")
text = String(GameStats.score)
func update_score_text(value):

View file

@ -1,11 +1,24 @@
[gd_scene load_steps=3 format=2]
[gd_scene load_steps=4 format=2]
[ext_resource path="res://Pegs/Yellow/PowerupCard.tscn" type="PackedScene" id=1]
[ext_resource path="res://Pegs/Yellow/Powerups/Spring/spring-Sheet.png" type="Texture" id=2]
[ext_resource path="res://Pegs/Yellow/Powerups/Spawn/fromBottom.png" type="Texture" id=3]
[node name="Spring" instance=ExtResource( 1 )]
powerup = "res://Pegs/Yellow/Powerups/Spring/Springs.tscn"
[node name="Sprite" parent="." index="0"]
[node name="Sprite2" type="Sprite" parent="." index="0"]
position = Vector2( 21, 27 )
texture = ExtResource( 3 )
hframes = 7
frame = 1
[node name="Sprite4" type="Sprite" parent="." index="1"]
position = Vector2( 44, 27 )
texture = ExtResource( 3 )
hframes = 7
frame = 1
[node name="Sprite" parent="." index="2"]
texture = ExtResource( 2 )
hframes = 9

View file

@ -3,68 +3,68 @@
[ext_resource path="res://Pegs/Yellow/Powerups/Scattershot/Scattershot.gd" type="Script" id=1]
[ext_resource path="res://Pegs/Yellow/Powerups/Scattershot/ScattershoPortalt.png" type="Texture" id=2]
[sub_resource type="AtlasTexture" id=8]
[sub_resource type="AtlasTexture" id=1]
atlas = ExtResource( 2 )
region = Rect2( 0, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=2]
atlas = ExtResource( 2 )
region = Rect2( 32, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=3]
atlas = ExtResource( 2 )
region = Rect2( 64, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 2 )
region = Rect2( 96, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 2 )
region = Rect2( 128, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=6]
atlas = ExtResource( 2 )
region = Rect2( 160, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=7]
atlas = ExtResource( 2 )
region = Rect2( 160, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=8]
atlas = ExtResource( 2 )
region = Rect2( 128, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=9]
atlas = ExtResource( 2 )
region = Rect2( 128, 0, 32, 32 )
region = Rect2( 96, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=10]
atlas = ExtResource( 2 )
region = Rect2( 96, 0, 32, 32 )
region = Rect2( 64, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=11]
atlas = ExtResource( 2 )
region = Rect2( 64, 0, 32, 32 )
region = Rect2( 32, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=12]
atlas = ExtResource( 2 )
region = Rect2( 32, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=13]
atlas = ExtResource( 2 )
region = Rect2( 0, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=14]
atlas = ExtResource( 2 )
region = Rect2( 0, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=15]
atlas = ExtResource( 2 )
region = Rect2( 32, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=16]
atlas = ExtResource( 2 )
region = Rect2( 64, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=17]
atlas = ExtResource( 2 )
region = Rect2( 96, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=18]
atlas = ExtResource( 2 )
region = Rect2( 128, 0, 32, 32 )
[sub_resource type="AtlasTexture" id=19]
atlas = ExtResource( 2 )
region = Rect2( 160, 0, 32, 32 )
[sub_resource type="SpriteFrames" id=20]
[sub_resource type="SpriteFrames" id=13]
animations = [ {
"frames": [ SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ) ],
"loop": true,
"name": "appear",
"speed": 15.0
}, {
"frames": [ SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ) ],
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ) ],
"loop": false,
"name": "disappear",
"speed": 15.0
}, {
"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ],
"loop": true,
"name": "appear",
"speed": 15.0
} ]
[sub_resource type="ParticlesMaterial" id=21]
[sub_resource type="ParticlesMaterial" id=14]
emission_shape = 1
emission_sphere_radius = 16.0
flag_disable_z = true
@ -86,7 +86,7 @@ autostart = true
[node name="AnimatedSprite" type="AnimatedSprite" parent="."]
z_index = -15
frames = SubResource( 20 )
frames = SubResource( 13 )
animation = "appear"
[node name="Particles2D" type="Particles2D" parent="."]
@ -96,7 +96,7 @@ amount = 64
lifetime = 3.0
one_shot = true
explosiveness = 1.0
process_material = SubResource( 21 )
process_material = SubResource( 14 )
[connection signal="timeout" from="SlowmoTimer" to="." method="set_time_scale"]
[connection signal="animation_finished" from="AnimatedSprite" to="." method="_on_AnimatedSprite_animation_finished"]

View file

@ -0,0 +1,19 @@
extends Node2D
func _ready() -> void:
global_position = Vector2(0, 184)
spawn_animations()
$Particles2D.emitting = true
func spawn_animations():
var Sprite = preload("res://Pegs/Yellow/Powerups/Spawn/FromBottomSprite.tscn")
var counter = 0
while counter <= 12:
var sprite = Sprite.instance()
add_child(sprite)
sprite.play("spawn")
sprite.offset = Vector2(counter * 32, -32)
sprite.global_position = global_position
counter += 1

View file

@ -0,0 +1,35 @@
[gd_scene load_steps=3 format=2]
[ext_resource path="res://Pegs/Yellow/Powerups/Spawn/FromBottom.gd" type="Script" id=2]
[sub_resource type="ParticlesMaterial" id=1]
emission_shape = 2
emission_box_extents = Vector3( 192, 1, 1 )
flag_disable_z = true
direction = Vector3( 0, -100, 0 )
flatness = 1.0
gravity = Vector3( 0, 98, 0 )
initial_velocity = 224.0
orbit_velocity = 0.0
orbit_velocity_random = 0.0
color = Color( 0.454902, 0.337255, 0.607843, 1 )
[node name="FromBottom" type="Node2D"]
script = ExtResource( 2 )
[node name="Timer" type="Timer" parent="."]
wait_time = 10.0
one_shot = true
autostart = true
[node name="Particles2D" type="Particles2D" parent="."]
position = Vector2( 192, 0 )
z_index = -20
emitting = false
amount = 128
lifetime = 2.0
one_shot = true
explosiveness = 0.5
process_material = SubResource( 1 )
[connection signal="timeout" from="Timer" to="." method="queue_free"]

View file

@ -0,0 +1,11 @@
extends AnimatedSprite
var ready_for_delete = false
func play_backwards():
if ready_for_delete:
queue_free()
else:
play("despawn")
ready_for_delete = true

View file

@ -0,0 +1,98 @@
[gd_scene load_steps=18 format=2]
[ext_resource path="res://Pegs/Yellow/Powerups/Spawn/fromBottom.png" type="Texture" id=1]
[ext_resource path="res://Pegs/Yellow/Powerups/Spawn/FromBottomSprite.gd" type="Script" id=2]
[sub_resource type="AtlasTexture" id=1]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=2]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 32, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=3]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 64, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=4]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 96, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=5]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 128, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=6]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 160, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=7]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 192, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=9]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 192, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=10]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 160, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=11]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 128, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=12]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 96, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=13]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 64, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=14]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 32, 0, 32, 64 )
[sub_resource type="AtlasTexture" id=15]
flags = 2
atlas = ExtResource( 1 )
region = Rect2( 0, 0, 32, 64 )
[sub_resource type="SpriteFrames" id=8]
animations = [ {
"frames": [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ) ],
"loop": false,
"name": "spawn",
"speed": 15.0
}, {
"frames": [ SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ) ],
"loop": false,
"name": "despawn",
"speed": 15.0
} ]
[node name="FromBottomSprite" type="AnimatedSprite"]
position = Vector2( 0, -32 )
z_index = -200
z_as_relative = false
frames = SubResource( 8 )
animation = "despawn"
centered = false
script = ExtResource( 2 )
[connection signal="animation_finished" from="." to="." method="play_backwards"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/fromBottom.png-f61a8e364dfcd48f694cac6077108a99.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Pegs/Yellow/Powerups/Spawn/fromBottom.png"
dest_files=[ "res://.import/fromBottom.png-f61a8e364dfcd48f694cac6077108a99.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=1
flags/filter=false
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=false
svg/scale=1.0

View file

@ -3,7 +3,13 @@ extends StaticBody2D
func _ready() -> void:
if GameStats.powerup_active:
queue_free()
else: GameStats.powerup_active = true
else:
GameStats.powerup_active = true
# spawn animation
var main = get_tree().current_scene
var Anim = preload("res://Pegs/Yellow/Powerups/Spawn/FromBottom.tscn")
var anim = Anim.instance()
main.add_child(anim)
position = Vector2(0, 184)
# spawn all the springs with some delays
@ -13,16 +19,17 @@ func _ready() -> void:
counter += 1
child.animate_spawn(rand_range(1, counter))
func explode():
queue_free()
Engine.time_scale = 1
GameStats.powerup_active = false
func make_green():
for child in get_children():
if child.has_method("animate_hit"):
child.animate_hit()
$DeathTimer.start()
GameStats.powerup_active = false
var SFX = preload("res://Pegs/Yellow/Powerups/Spring/SpringSFX.tscn")
var main = get_tree().current_scene