mirror of
				https://git.kittycat.homes/zoe/pegchamp.git
				synced 2024-08-15 03:15:39 +00:00 
			
		
		
		
	add heart level, bugfixes
This commit is contained in:
		
							parent
							
								
									41c3dfa881
								
							
						
					
					
						commit
						c30cc4589e
					
				
					 9 changed files with 265 additions and 36 deletions
				
			
		|  | @ -15,6 +15,7 @@ func _ready(): | |||
| 	cameraTransform.position = Vector2.ZERO | ||||
| 	animation.play("reset") | ||||
| 	GameStats.balls_left = GameStats.max_balls | ||||
| 	GameStats.connect("game_won", self, "queue_free") | ||||
| 
 | ||||
| func _physics_process(_delta): | ||||
| 	match state: | ||||
|  | @ -32,7 +33,7 @@ func handle_collisions(): | |||
| 		for collider in collider_array: | ||||
| 			set_particle_direction(collider) | ||||
| 			bounce_of(collider) | ||||
| 			turn_pegs_green(collider) | ||||
| 			call_deferred("turn_pegs_green", collider) | ||||
| 
 | ||||
| func turn_pegs_green(collider): | ||||
| 	# check if pegs can be turned green | ||||
|  |  | |||
|  | @ -69,7 +69,7 @@ collision_mask = 13 | |||
| mass = 90.0 | ||||
| physics_material_override = ExtResource( 3 ) | ||||
| continuous_cd = 2 | ||||
| contacts_reported = 4 | ||||
| contacts_reported = 1 | ||||
| contact_monitor = true | ||||
| linear_velocity = Vector2( 0, -10 ) | ||||
| script = ExtResource( 2 ) | ||||
|  |  | |||
							
								
								
									
										19
									
								
								HUD/HUD.tscn
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								HUD/HUD.tscn
									
										
									
									
									
								
							|  | @ -1,10 +1,11 @@ | |||
| [gd_scene load_steps=6 format=2] | ||||
| [gd_scene load_steps=7 format=2] | ||||
| 
 | ||||
| [ext_resource path="res://Ball/sprite.png" type="Texture" id=1] | ||||
| [ext_resource path="res://HUD/BallCounter.gd" type="Script" id=2] | ||||
| [ext_resource path="res://HUD/Multiplier.gd" type="Script" id=3] | ||||
| [ext_resource path="res://Menu/Theme.tres" type="Theme" id=4] | ||||
| [ext_resource path="res://HUD/Score.gd" type="Script" id=5] | ||||
| [ext_resource path="res://HUD/PinksLabel.gd" type="Script" id=6] | ||||
| 
 | ||||
| [node name="HUD" type="CanvasLayer"] | ||||
| 
 | ||||
|  | @ -25,9 +26,9 @@ script = ExtResource( 2 ) | |||
| 
 | ||||
| [node name="Multiplier" type="Label" parent="."] | ||||
| margin_left = 336.0 | ||||
| margin_top = 176.0 | ||||
| margin_top = 170.0 | ||||
| margin_right = 376.0 | ||||
| margin_bottom = 190.0 | ||||
| margin_bottom = 188.0 | ||||
| grow_horizontal = 0 | ||||
| grow_vertical = 0 | ||||
| theme = ExtResource( 4 ) | ||||
|  | @ -38,6 +39,18 @@ __meta__ = { | |||
| "_edit_use_anchors_": false | ||||
| } | ||||
| 
 | ||||
| [node name="PinksLabel" type="Label" parent="."] | ||||
| margin_left = 16.0 | ||||
| margin_top = 188.0 | ||||
| margin_right = 72.0 | ||||
| margin_bottom = 206.0 | ||||
| theme = ExtResource( 4 ) | ||||
| text = "Left:" | ||||
| script = ExtResource( 6 ) | ||||
| __meta__ = { | ||||
| "_edit_use_anchors_": false | ||||
| } | ||||
| 
 | ||||
| [node name="Score" type="Label" parent="."] | ||||
| margin_left = 336.0 | ||||
| margin_top = 192.0 | ||||
|  |  | |||
							
								
								
									
										10
									
								
								HUD/PinksLabel.gd
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								HUD/PinksLabel.gd
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| extends Label | ||||
| 
 | ||||
| func _ready(): | ||||
| 	visible = false | ||||
| 	var _connected = GameStats.connect("pink_changed", self, "update_text") | ||||
| 	call_deferred("update_text", GameStats.pinks_left) | ||||
| 
 | ||||
| func update_text(value): | ||||
| 	visible = true | ||||
| 	text ="left " + String(value) | ||||
|  | @ -21,13 +21,14 @@ margin_top = 2.0 | |||
| margin_right = 170.0 | ||||
| margin_bottom = 438.0 | ||||
| 
 | ||||
| [node name="SceneSelectButton" parent="LevelListHBox" instance=ExtResource( 5 )] | ||||
| [node name="Heart" parent="LevelListHBox" instance=ExtResource( 5 )] | ||||
| anchor_right = 0.0 | ||||
| anchor_bottom = 0.0 | ||||
| margin_right = 168.0 | ||||
| margin_bottom = 40.0 | ||||
| text = "> Heart" | ||||
| icon = ExtResource( 2 ) | ||||
| scene = "res://Stages/EmptyStage.tscn" | ||||
| scene = "res://Stages/Heart.tscn" | ||||
| 
 | ||||
| [node name="SceneSelectButton2" parent="LevelListHBox" instance=ExtResource( 5 )] | ||||
| anchor_right = 0.0 | ||||
|  |  | |||
|  | @ -1,6 +1,7 @@ | |||
| extends StaticBody2D | ||||
| 
 | ||||
| func _ready(): | ||||
| 	var _connection = GameStats.connect("recount_pink", self, "count") | ||||
| 	GameStats.pinks_left += 1 | ||||
| 
 | ||||
| # turns the pegs green | ||||
|  | @ -19,10 +20,10 @@ func make_green(): | |||
| 	$ScoreCounter.trigger() | ||||
| 	 | ||||
| 	#finally delete the old peg | ||||
| 	GameStats.pinks_left -= 1 | ||||
| 	win_level() | ||||
| 	Engine.time_scale = 1 | ||||
| 	queue_free() | ||||
| 	GameStats.recount_pink() | ||||
| 	 | ||||
| func win_level(): | ||||
| 	if GameStats.pinks_left <= 0: | ||||
|  | @ -47,3 +48,7 @@ func _on_LastPegCollision_body_entered(_body): | |||
| 
 | ||||
| func _on_Timer_timeout(): | ||||
| 	Engine.time_scale = 1 | ||||
| 
 | ||||
| # adds count of 1 for every pink peg | ||||
| func count(): | ||||
| 	GameStats.pinks_left += 1 | ||||
|  |  | |||
|  | @ -1,13 +1,11 @@ | |||
| [gd_scene load_steps=26 format=2] | ||||
| [gd_scene load_steps=24 format=2] | ||||
| 
 | ||||
| [ext_resource path="res://Cannon/Cannon.tscn" type="PackedScene" id=1] | ||||
| [ext_resource path="res://Borders/tileset.png" type="Texture" id=2] | ||||
| [ext_resource path="res://Ball/Ball.tscn" type="PackedScene" id=3] | ||||
| [ext_resource path="res://Pegs/Yellow/YellowPeg.tscn" type="PackedScene" id=4] | ||||
| [ext_resource path="res://ControlElements/Killzone.tscn" type="PackedScene" id=5] | ||||
| [ext_resource path="res://Bucket/Bucket.tscn" type="PackedScene" id=6] | ||||
| [ext_resource path="res://HUD/HUD.tscn" type="PackedScene" id=7] | ||||
| [ext_resource path="res://Pegs/Pink/PinkPeg.tscn" type="PackedScene" id=8] | ||||
| [ext_resource path="res://Stages/Camera.gd" type="Script" id=9] | ||||
| [ext_resource path="res://Stages/World.gd" type="Script" id=10] | ||||
| [ext_resource path="res://Effects/FadeIn.tscn" type="PackedScene" id=11] | ||||
|  | @ -220,30 +218,6 @@ position = Vector2( 0, 248 ) | |||
| 
 | ||||
| [node name="Pegs" type="Node2D" parent="."] | ||||
| 
 | ||||
| [node name="PinkPeg" parent="Pegs" instance=ExtResource( 8 )] | ||||
| position = Vector2( 190, 72 ) | ||||
| 
 | ||||
| [node name="YellowPeg" parent="Pegs" instance=ExtResource( 4 )] | ||||
| position = Vector2( 136, 101 ) | ||||
| 
 | ||||
| [node name="YellowPeg3" parent="Pegs" instance=ExtResource( 4 )] | ||||
| position = Vector2( 149, 112 ) | ||||
| 
 | ||||
| [node name="YellowPeg4" parent="Pegs" instance=ExtResource( 4 )] | ||||
| position = Vector2( 164, 131 ) | ||||
| 
 | ||||
| [node name="YellowPeg5" parent="Pegs" instance=ExtResource( 4 )] | ||||
| position = Vector2( 189, 121 ) | ||||
| 
 | ||||
| [node name="YellowPeg6" parent="Pegs" instance=ExtResource( 4 )] | ||||
| position = Vector2( 204, 111 ) | ||||
| 
 | ||||
| [node name="YellowPeg7" parent="Pegs" instance=ExtResource( 4 )] | ||||
| position = Vector2( 212, 126 ) | ||||
| 
 | ||||
| [node name="YellowPeg2" parent="Pegs" instance=ExtResource( 4 )] | ||||
| position = Vector2( 163, 115 ) | ||||
| 
 | ||||
| [node name="Bucket" parent="." instance=ExtResource( 6 )] | ||||
| position = Vector2( 192, 206 ) | ||||
| 
 | ||||
|  |  | |||
							
								
								
									
										216
									
								
								Stages/Heart.tscn
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										216
									
								
								Stages/Heart.tscn
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,216 @@ | |||
| [gd_scene load_steps=5 format=2] | ||||
| 
 | ||||
| [ext_resource path="res://Stages/EmptyStage.tscn" type="PackedScene" id=1] | ||||
| [ext_resource path="res://Pegs/Pink/PinkPeg.tscn" type="PackedScene" id=2] | ||||
| [ext_resource path="res://Pegs/Yellow/YellowPeg.tscn" type="PackedScene" id=3] | ||||
| [ext_resource path="res://Pegs/Purple/PurplePeg.tscn" type="PackedScene" id=4] | ||||
| 
 | ||||
| [node name="World" instance=ExtResource( 1 )] | ||||
| stage_name = "Heart" | ||||
| powerup_card = "res://Pegs/Yellow/PowerupCards/Scattershot.tscn" | ||||
| 
 | ||||
| [node name="PinkPeg" parent="Pegs" index="0" instance=ExtResource( 2 )] | ||||
| position = Vector2( 192, 128 ) | ||||
| 
 | ||||
| [node name="PinkPeg2" parent="Pegs" index="1" instance=ExtResource( 2 )] | ||||
| position = Vector2( 176, 120 ) | ||||
| 
 | ||||
| [node name="PinkPeg3" parent="Pegs" index="2" instance=ExtResource( 2 )] | ||||
| position = Vector2( 208, 120 ) | ||||
| 
 | ||||
| [node name="PinkPeg6" parent="Pegs" index="3" instance=ExtResource( 2 )] | ||||
| position = Vector2( 136, 136 ) | ||||
| 
 | ||||
| [node name="PinkPeg7" parent="Pegs" index="4" instance=ExtResource( 2 )] | ||||
| position = Vector2( 152, 152 ) | ||||
| 
 | ||||
| [node name="PinkPeg8" parent="Pegs" index="5" instance=ExtResource( 2 )] | ||||
| position = Vector2( 168, 160 ) | ||||
| 
 | ||||
| [node name="PinkPeg9" parent="Pegs" index="6" instance=ExtResource( 2 )] | ||||
| position = Vector2( 184, 168 ) | ||||
| 
 | ||||
| [node name="PinkPeg10" parent="Pegs" index="7" instance=ExtResource( 2 )] | ||||
| position = Vector2( 200, 168 ) | ||||
| 
 | ||||
| [node name="PinkPeg11" parent="Pegs" index="8" instance=ExtResource( 2 )] | ||||
| position = Vector2( 216, 160 ) | ||||
| 
 | ||||
| [node name="PinkPeg12" parent="Pegs" index="9" instance=ExtResource( 2 )] | ||||
| position = Vector2( 232, 152 ) | ||||
| 
 | ||||
| [node name="PinkPeg13" parent="Pegs" index="10" instance=ExtResource( 2 )] | ||||
| position = Vector2( 248, 136 ) | ||||
| 
 | ||||
| [node name="PinkPeg4" parent="Pegs" index="11" instance=ExtResource( 2 )] | ||||
| position = Vector2( 168, 104 ) | ||||
| 
 | ||||
| [node name="PinkPeg5" parent="Pegs" index="12" instance=ExtResource( 2 )] | ||||
| position = Vector2( 216, 104 ) | ||||
| 
 | ||||
| [node name="PurplePeg" parent="Pegs" index="13" instance=ExtResource( 4 )] | ||||
| position = Vector2( 168, 88 ) | ||||
| 
 | ||||
| [node name="PurplePeg2" parent="Pegs" index="14" instance=ExtResource( 4 )] | ||||
| position = Vector2( 208, 72 ) | ||||
| 
 | ||||
| [node name="PurplePeg5" parent="Pegs" index="15" instance=ExtResource( 4 )] | ||||
| position = Vector2( 208, 56 ) | ||||
| 
 | ||||
| [node name="PurplePeg6" parent="Pegs" index="16" instance=ExtResource( 4 )] | ||||
| position = Vector2( 176, 56 ) | ||||
| 
 | ||||
| [node name="PurplePeg7" parent="Pegs" index="17" instance=ExtResource( 4 )] | ||||
| position = Vector2( 160, 48 ) | ||||
| 
 | ||||
| [node name="PurplePeg8" parent="Pegs" index="18" instance=ExtResource( 4 )] | ||||
| position = Vector2( 224, 48 ) | ||||
| 
 | ||||
| [node name="PurplePeg9" parent="Pegs" index="19" instance=ExtResource( 4 )] | ||||
| position = Vector2( 152, 64 ) | ||||
| 
 | ||||
| [node name="PurplePeg10" parent="Pegs" index="20" instance=ExtResource( 4 )] | ||||
| position = Vector2( 232, 64 ) | ||||
| 
 | ||||
| [node name="PurplePeg11" parent="Pegs" index="21" instance=ExtResource( 4 )] | ||||
| position = Vector2( 144, 88 ) | ||||
| 
 | ||||
| [node name="PurplePeg39" parent="Pegs" index="22" instance=ExtResource( 4 )] | ||||
| position = Vector2( 128, 48 ) | ||||
| 
 | ||||
| [node name="PurplePeg40" parent="Pegs" index="23" instance=ExtResource( 4 )] | ||||
| position = Vector2( 256, 48 ) | ||||
| 
 | ||||
| [node name="PurplePeg41" parent="Pegs" index="24" instance=ExtResource( 4 )] | ||||
| position = Vector2( 264, 64 ) | ||||
| 
 | ||||
| [node name="PurplePeg42" parent="Pegs" index="25" instance=ExtResource( 4 )] | ||||
| position = Vector2( 120, 64 ) | ||||
| 
 | ||||
| [node name="PurplePeg43" parent="Pegs" index="26" instance=ExtResource( 4 )] | ||||
| position = Vector2( 136, 64 ) | ||||
| 
 | ||||
| [node name="PurplePeg44" parent="Pegs" index="27" instance=ExtResource( 4 )] | ||||
| position = Vector2( 248, 64 ) | ||||
| 
 | ||||
| [node name="PurplePeg45" parent="Pegs" index="28" instance=ExtResource( 4 )] | ||||
| position = Vector2( 256, 80 ) | ||||
| 
 | ||||
| [node name="PurplePeg46" parent="Pegs" index="29" instance=ExtResource( 4 )] | ||||
| position = Vector2( 128, 80 ) | ||||
| 
 | ||||
| [node name="PurplePeg47" parent="Pegs" index="30" instance=ExtResource( 4 )] | ||||
| position = Vector2( 136, 96 ) | ||||
| 
 | ||||
| [node name="PurplePeg48" parent="Pegs" index="31" instance=ExtResource( 4 )] | ||||
| position = Vector2( 248, 96 ) | ||||
| 
 | ||||
| [node name="PurplePeg12" parent="Pegs" index="32" instance=ExtResource( 4 )] | ||||
| position = Vector2( 240, 88 ) | ||||
| 
 | ||||
| [node name="PurplePeg13" parent="Pegs" index="33" instance=ExtResource( 4 )] | ||||
| position = Vector2( 240, 104 ) | ||||
| 
 | ||||
| [node name="PurplePeg14" parent="Pegs" index="34" instance=ExtResource( 4 )] | ||||
| position = Vector2( 144, 104 ) | ||||
| 
 | ||||
| [node name="PurplePeg15" parent="Pegs" index="35" instance=ExtResource( 4 )] | ||||
| position = Vector2( 144, 120 ) | ||||
| 
 | ||||
| [node name="PurplePeg16" parent="Pegs" index="36" instance=ExtResource( 4 )] | ||||
| position = Vector2( 240, 120 ) | ||||
| 
 | ||||
| [node name="PurplePeg23" parent="Pegs" index="37" instance=ExtResource( 4 )] | ||||
| position = Vector2( 240, 40 ) | ||||
| 
 | ||||
| [node name="PurplePeg24" parent="Pegs" index="38" instance=ExtResource( 4 )] | ||||
| position = Vector2( 256, 32 ) | ||||
| 
 | ||||
| [node name="PurplePeg25" parent="Pegs" index="39" instance=ExtResource( 4 )] | ||||
| position = Vector2( 272, 40 ) | ||||
| 
 | ||||
| [node name="PurplePeg26" parent="Pegs" index="40" instance=ExtResource( 4 )] | ||||
| position = Vector2( 256, 120 ) | ||||
| 
 | ||||
| [node name="PurplePeg27" parent="Pegs" index="41" instance=ExtResource( 4 )] | ||||
| position = Vector2( 264, 104 ) | ||||
| 
 | ||||
| [node name="PurplePeg38" parent="Pegs" index="42" instance=ExtResource( 4 )] | ||||
| position = Vector2( 272, 88 ) | ||||
| 
 | ||||
| [node name="PurplePeg28" parent="Pegs" index="43" instance=ExtResource( 4 )] | ||||
| position = Vector2( 280, 72 ) | ||||
| 
 | ||||
| [node name="PurplePeg29" parent="Pegs" index="44" instance=ExtResource( 4 )] | ||||
| position = Vector2( 280, 56 ) | ||||
| 
 | ||||
| [node name="PurplePeg17" parent="Pegs" index="45" instance=ExtResource( 4 )] | ||||
| position = Vector2( 232, 136 ) | ||||
| 
 | ||||
| [node name="PurplePeg18" parent="Pegs" index="46" instance=ExtResource( 4 )] | ||||
| position = Vector2( 152, 136 ) | ||||
| 
 | ||||
| [node name="PurplePeg19" parent="Pegs" index="47" instance=ExtResource( 4 )] | ||||
| position = Vector2( 168, 144 ) | ||||
| 
 | ||||
| [node name="PurplePeg20" parent="Pegs" index="48" instance=ExtResource( 4 )] | ||||
| position = Vector2( 216, 144 ) | ||||
| 
 | ||||
| [node name="PurplePeg21" parent="Pegs" index="49" instance=ExtResource( 4 )] | ||||
| position = Vector2( 200, 152 ) | ||||
| 
 | ||||
| [node name="PurplePeg22" parent="Pegs" index="50" instance=ExtResource( 4 )] | ||||
| position = Vector2( 184, 152 ) | ||||
| 
 | ||||
| [node name="PurplePeg30" parent="Pegs" index="51" instance=ExtResource( 4 )] | ||||
| position = Vector2( 128, 120 ) | ||||
| 
 | ||||
| [node name="PurplePeg31" parent="Pegs" index="52" instance=ExtResource( 4 )] | ||||
| position = Vector2( 120, 104 ) | ||||
| 
 | ||||
| [node name="PurplePeg32" parent="Pegs" index="53" instance=ExtResource( 4 )] | ||||
| position = Vector2( 112, 88 ) | ||||
| 
 | ||||
| [node name="PurplePeg33" parent="Pegs" index="54" instance=ExtResource( 4 )] | ||||
| position = Vector2( 104, 72 ) | ||||
| 
 | ||||
| [node name="PurplePeg37" parent="Pegs" index="55" instance=ExtResource( 4 )] | ||||
| position = Vector2( 104, 56 ) | ||||
| 
 | ||||
| [node name="PurplePeg34" parent="Pegs" index="56" instance=ExtResource( 4 )] | ||||
| position = Vector2( 112, 40 ) | ||||
| 
 | ||||
| [node name="PurplePeg35" parent="Pegs" index="57" instance=ExtResource( 4 )] | ||||
| position = Vector2( 128, 32 ) | ||||
| 
 | ||||
| [node name="PurplePeg36" parent="Pegs" index="58" instance=ExtResource( 4 )] | ||||
| position = Vector2( 144, 40 ) | ||||
| 
 | ||||
| [node name="PurplePeg4" parent="Pegs" index="59" instance=ExtResource( 4 )] | ||||
| position = Vector2( 176, 72 ) | ||||
| 
 | ||||
| [node name="PurplePeg3" parent="Pegs" index="60" instance=ExtResource( 4 )] | ||||
| position = Vector2( 216, 88 ) | ||||
| 
 | ||||
| [node name="YellowPeg" parent="Pegs" index="61" instance=ExtResource( 3 )] | ||||
| position = Vector2( 192, 64 ) | ||||
| 
 | ||||
| [node name="YellowPeg2" parent="Pegs" index="62" instance=ExtResource( 3 )] | ||||
| position = Vector2( 192, 80 ) | ||||
| 
 | ||||
| [node name="YellowPeg4" parent="Pegs" index="63" instance=ExtResource( 3 )] | ||||
| position = Vector2( 184, 96 ) | ||||
| 
 | ||||
| [node name="YellowPeg5" parent="Pegs" index="64" instance=ExtResource( 3 )] | ||||
| position = Vector2( 200, 96 ) | ||||
| 
 | ||||
| [node name="YellowPeg6" parent="Pegs" index="65" instance=ExtResource( 3 )] | ||||
| position = Vector2( 192, 112 ) | ||||
| 
 | ||||
| [node name="YellowPeg3" parent="Pegs" index="66" instance=ExtResource( 3 )] | ||||
| position = Vector2( 192, 144 ) | ||||
| 
 | ||||
| [node name="PowerupCards" parent="." index="12"] | ||||
| position = Vector2( -8, 16 ) | ||||
| 
 | ||||
| [editable path="Ball"] | ||||
|  | @ -5,6 +5,9 @@ signal current_stage_changed(scene) | |||
| signal multiplier_changed(value) | ||||
| signal score_changed(value) | ||||
| signal powerup_picked() | ||||
| signal recount_pink() | ||||
| signal pink_changed(value) | ||||
| signal game_won() | ||||
| 
 | ||||
| var unlock_points = 10 | ||||
| var max_balls = 3 | ||||
|  | @ -48,7 +51,7 @@ func decide_game(): | |||
| 		var Winscreen = preload("res://Menu/WinScreen.tscn") | ||||
| 		var winscreen = Winscreen.instance() | ||||
| 		main.add_child(winscreen) | ||||
| 		 | ||||
| 		emit_signal("game_won") | ||||
| 
 | ||||
| 	# game is lost | ||||
| 	elif (balls_left <= 0): | ||||
|  | @ -98,3 +101,9 @@ func set_score_to(value): | |||
| func pick_powerup(): | ||||
| 	powerup_screen_active = false | ||||
| 	emit_signal("powerup_picked") | ||||
| 
 | ||||
| func recount_pink(): | ||||
| 	pinks_left = 0; | ||||
| 	emit_signal("recount_pink") | ||||
| 	pinks_left -= 1 | ||||
| 	emit_signal("pink_changed", pinks_left) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue