mirror of
				https://git.kittycat.homes/zoe/pegchamp.git
				synced 2024-08-15 03:15:39 +00:00 
			
		
		
		
	more sfx
This commit is contained in:
		
							parent
							
								
									e08c2c3ef2
								
							
						
					
					
						commit
						7b67b3aef6
					
				
					 24 changed files with 238 additions and 167 deletions
				
			
		|  | @ -1,4 +1,17 @@ | |||
| extends Sprite | ||||
| 
 | ||||
| func animate(): | ||||
| func _ready() -> void: | ||||
| 	$AudioStreamPlayer2D.pitch_scale = rand_range(0.5, 1.5) | ||||
| 
 | ||||
| func animate_hit(): | ||||
| 	$AnimationPlayer.play("Spring") | ||||
| 
 | ||||
| func animate_spawn(delay): | ||||
| 		var timer = Timer.new() | ||||
| 		timer.connect("timeout", self, "play_spawn_animation") | ||||
| 		timer.one_shot = true | ||||
| 		add_child(timer) | ||||
| 		timer.start(delay * 0.02) | ||||
| 
 | ||||
| func play_spawn_animation(): | ||||
| 	$AnimationPlayer.play("Spawn") | ||||
|  |  | |||
|  | @ -1,7 +1,39 @@ | |||
| [gd_scene load_steps=4 format=2] | ||||
| [gd_scene load_steps=6 format=2] | ||||
| 
 | ||||
| [ext_resource path="res://Pegs/Yellow/Powerups/Spring/spring-Sheet.png" type="Texture" id=1] | ||||
| [ext_resource path="res://Pegs/Yellow/Powerups/Spring/Spring.gd" type="Script" id=2] | ||||
| [ext_resource path="res://SFX/popup.wav" type="AudioStream" id=3] | ||||
| 
 | ||||
| [sub_resource type="Animation" id=2] | ||||
| resource_name = "Spawn" | ||||
| length = 0.25 | ||||
| step = 0.025 | ||||
| tracks/0/type = "value" | ||||
| tracks/0/path = NodePath(".:offset") | ||||
| tracks/0/interp = 1 | ||||
| tracks/0/loop_wrap = true | ||||
| tracks/0/imported = false | ||||
| tracks/0/enabled = true | ||||
| tracks/0/keys = { | ||||
| "times": PoolRealArray( 0, 0.25 ), | ||||
| "transitions": PoolRealArray( 1, 1 ), | ||||
| "update": 0, | ||||
| "values": [ Vector2( 0, 32 ), Vector2( 0, 0 ) ] | ||||
| } | ||||
| tracks/1/type = "audio" | ||||
| tracks/1/path = NodePath("AudioStreamPlayer2D") | ||||
| tracks/1/interp = 1 | ||||
| tracks/1/loop_wrap = true | ||||
| tracks/1/imported = false | ||||
| tracks/1/enabled = true | ||||
| tracks/1/keys = { | ||||
| "clips": [ { | ||||
| "end_offset": 0.0, | ||||
| "start_offset": 0.0, | ||||
| "stream": ExtResource( 3 ) | ||||
| } ], | ||||
| "times": PoolRealArray( 0 ) | ||||
| } | ||||
| 
 | ||||
| [sub_resource type="Animation" id=1] | ||||
| resource_name = "Spring" | ||||
|  | @ -22,9 +54,15 @@ tracks/0/keys = { | |||
| [node name="Sprite" type="Sprite"] | ||||
| texture = ExtResource( 1 ) | ||||
| centered = false | ||||
| offset = Vector2( 0, 32 ) | ||||
| hframes = 9 | ||||
| region_rect = Rect2( 0, 0, 32, 32 ) | ||||
| script = ExtResource( 2 ) | ||||
| 
 | ||||
| [node name="AnimationPlayer" type="AnimationPlayer" parent="."] | ||||
| anims/Spawn = SubResource( 2 ) | ||||
| anims/Spring = SubResource( 1 ) | ||||
| 
 | ||||
| [node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."] | ||||
| stream = ExtResource( 3 ) | ||||
| bus = "SFX" | ||||
|  |  | |||
							
								
								
									
										7
									
								
								Pegs/Yellow/Powerups/Spring/SpringSFX.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Pegs/Yellow/Powerups/Spring/SpringSFX.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,7 @@ | |||
| [gd_scene load_steps=2 format=2] | ||||
| 
 | ||||
| [ext_resource path="res://SFX/bounce.wav" type="AudioStream" id=1] | ||||
| 
 | ||||
| [node name="BounceSFX" type="AudioStreamPlayer"] | ||||
| stream = ExtResource( 1 ) | ||||
| bus = "SFX" | ||||
|  | @ -1,16 +1,37 @@ | |||
| extends StaticBody2D | ||||
| 
 | ||||
| func _ready() -> void: | ||||
| 	if GameStats.powerup_active: | ||||
| 		queue_free() | ||||
| 	else: GameStats.powerup_active = true | ||||
| 	position = Vector2(0, 184) | ||||
| 	 | ||||
| 	# spawn all the springs with some delays | ||||
| 	var counter = 0 | ||||
| 	for child in get_children(): | ||||
| 		if child.has_method("animate_spawn"): | ||||
| 			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"): | ||||
| 			child.animate() | ||||
| 		if child.has_method("animate_hit"): | ||||
| 			child.animate_hit() | ||||
| 	$DeathTimer.start() | ||||
| 	 | ||||
| 	var SFX = preload("res://Pegs/Yellow/Powerups/Spring/SpringSFX.tscn") | ||||
| 	var main = get_tree().current_scene | ||||
| 	var sfx = SFX.instance() | ||||
| 	main.add_child(sfx) | ||||
| 	sfx.play(0.0) | ||||
| 	 | ||||
| 	if GameStats.camera_fx: | ||||
| 		Engine.time_scale = 0.25 | ||||
| 
 | ||||
| func spring(): | ||||
| 	pass | ||||
|  |  | |||
|  | @ -1,15 +1,19 @@ | |||
| [gd_scene load_steps=4 format=2] | ||||
| [gd_scene load_steps=5 format=2] | ||||
| 
 | ||||
| [ext_resource path="res://Pegs/Yellow/Powerups/Spring/Spring.tscn" type="PackedScene" id=1] | ||||
| [ext_resource path="res://Pegs/Yellow/Powerups/Spring/Springs.gd" type="Script" id=2] | ||||
| 
 | ||||
| [sub_resource type="RectangleShape2D" id=1] | ||||
| [sub_resource type="PhysicsMaterial" id=1] | ||||
| bounce = 1.0 | ||||
| 
 | ||||
| [sub_resource type="RectangleShape2D" id=2] | ||||
| extents = Vector2( 192, 16 ) | ||||
| 
 | ||||
| [node name="Springs" type="StaticBody2D"] | ||||
| z_index = -24 | ||||
| collision_layer = 8 | ||||
| collision_mask = 0 | ||||
| physics_material_override = SubResource( 1 ) | ||||
| script = ExtResource( 2 ) | ||||
| 
 | ||||
| [node name="Spring" parent="." instance=ExtResource( 1 )] | ||||
|  | @ -49,10 +53,10 @@ position = Vector2( 352, 0 ) | |||
| 
 | ||||
| [node name="CollisionShape2D2" type="CollisionShape2D" parent="."] | ||||
| position = Vector2( 192, 16 ) | ||||
| shape = SubResource( 1 ) | ||||
| shape = SubResource( 2 ) | ||||
| 
 | ||||
| [node name="DeathTimer" type="Timer" parent="."] | ||||
| wait_time = 0.24 | ||||
| wait_time = 0.1 | ||||
| one_shot = true | ||||
| 
 | ||||
| [connection signal="timeout" from="DeathTimer" to="." method="explode"] | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue