mirror of
https://git.kittycat.homes/zoe/pegchamp.git
synced 2024-08-15 03:15:39 +00:00
powerup system
This commit is contained in:
parent
c8747328cf
commit
77ca16be36
149 changed files with 2472 additions and 331 deletions
|
|
@ -33,14 +33,15 @@ func bouncy():
|
|||
|
||||
# below is the slowmo stuff
|
||||
func _on_Area2D_body_entered(_body):
|
||||
Engine.time_scale = clamp(Engine.time_scale * 0.25, 0.1, 1)
|
||||
$SlowmoTimer.start()
|
||||
if GameStats.camera_fx:
|
||||
Engine.time_scale = clamp(Engine.time_scale * 0.25, 0.1, 1)
|
||||
$SlowmoTimer.start()
|
||||
|
||||
func _on_Area2D_body_exited(_body):
|
||||
Engine.time_scale = 1
|
||||
|
||||
func _on_LastPegCollision_body_entered(_body):
|
||||
if GameStats.pinks_left <= 1:
|
||||
if GameStats.pinks_left <= 1 && GameStats.camera_fx:
|
||||
Engine.time_scale = clamp(Engine.time_scale * 0.15, 0.1, 1)
|
||||
$SlowmoTimer.start()
|
||||
|
||||
|
|
|
|||
BIN
Pegs/Yellow/CardIcons/default.png
Normal file
BIN
Pegs/Yellow/CardIcons/default.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 412 B |
34
Pegs/Yellow/CardIcons/default.png.import
Normal file
34
Pegs/Yellow/CardIcons/default.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/default.png-ba07210c8175a7083cdce8d9520a5fea.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Pegs/Yellow/CardIcons/default.png"
|
||||
dest_files=[ "res://.import/default.png-ba07210c8175a7083cdce8d9520a5fea.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=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
|
||||
BIN
Pegs/Yellow/CardIcons/default1.png
Normal file
BIN
Pegs/Yellow/CardIcons/default1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 412 B |
34
Pegs/Yellow/CardIcons/default1.png.import
Normal file
34
Pegs/Yellow/CardIcons/default1.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/default1.png-73551975554b9daf91ca5bb238dd192c.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Pegs/Yellow/CardIcons/default1.png"
|
||||
dest_files=[ "res://.import/default1.png-73551975554b9daf91ca5bb238dd192c.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=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
|
||||
BIN
Pegs/Yellow/CardIcons/default2.png
Normal file
BIN
Pegs/Yellow/CardIcons/default2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 412 B |
34
Pegs/Yellow/CardIcons/default2.png.import
Normal file
34
Pegs/Yellow/CardIcons/default2.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/default2.png-a0ad125785fe4eb452fad490273110f4.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Pegs/Yellow/CardIcons/default2.png"
|
||||
dest_files=[ "res://.import/default2.png-a0ad125785fe4eb452fad490273110f4.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=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
|
||||
BIN
Pegs/Yellow/CardIcons/default3.png
Normal file
BIN
Pegs/Yellow/CardIcons/default3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 412 B |
34
Pegs/Yellow/CardIcons/default3.png.import
Normal file
34
Pegs/Yellow/CardIcons/default3.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/default3.png-c353cc3e193c1c563538671b1d4ccdcc.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Pegs/Yellow/CardIcons/default3.png"
|
||||
dest_files=[ "res://.import/default3.png-c353cc3e193c1c563538671b1d4ccdcc.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=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
|
||||
15
Pegs/Yellow/PowerupCard.gd
Normal file
15
Pegs/Yellow/PowerupCard.gd
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
extends TextureButton
|
||||
|
||||
var spawn_position = Vector2() setget set_spawn_position, get_spawn_position
|
||||
|
||||
func set_spawn_position(value):
|
||||
spawn_position = value
|
||||
|
||||
func get_spawn_position():
|
||||
return spawn_position
|
||||
|
||||
|
||||
func _on_TextureButton_pressed() -> void:
|
||||
get_tree().paused = false
|
||||
GameStats.pick_powerup()
|
||||
queue_free()
|
||||
30
Pegs/Yellow/PowerupCard.tscn
Normal file
30
Pegs/Yellow/PowerupCard.tscn
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://Menu/Theme.tres" type="Theme" id=1]
|
||||
[ext_resource path="res://icon.png" type="Texture" id=2]
|
||||
[ext_resource path="res://Pegs/Yellow/CardIcons/default3.png" type="Texture" id=3]
|
||||
[ext_resource path="res://Pegs/Yellow/CardIcons/default2.png" type="Texture" id=4]
|
||||
[ext_resource path="res://Pegs/Yellow/CardIcons/default.png" type="Texture" id=5]
|
||||
[ext_resource path="res://Pegs/Yellow/PowerupCard.gd" type="Script" id=6]
|
||||
|
||||
[node name="TextureButton" type="TextureButton"]
|
||||
anchor_right = 0.167
|
||||
anchor_bottom = 0.296
|
||||
margin_right = -0.127998
|
||||
margin_bottom = 0.0639992
|
||||
hint_tooltip = "a powerup!!!"
|
||||
theme = ExtResource( 1 )
|
||||
shortcut_in_tooltip = false
|
||||
texture_normal = ExtResource( 5 )
|
||||
texture_pressed = ExtResource( 4 )
|
||||
texture_hover = ExtResource( 3 )
|
||||
script = ExtResource( 6 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
position = Vector2( 32, 32 )
|
||||
texture = ExtResource( 2 )
|
||||
|
||||
[connection signal="pressed" from="." to="." method="_on_TextureButton_pressed"]
|
||||
23
Pegs/Yellow/PowerupCards.gd
Normal file
23
Pegs/Yellow/PowerupCards.gd
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
extends Node2D
|
||||
|
||||
var scenes = []
|
||||
|
||||
func _ready():
|
||||
GameStats.connect("powerup_picked", self, "queue_free")
|
||||
scenes.append("res://Pegs/Yellow/PowerupCards/Scattershot.tscn")
|
||||
|
||||
spawn_powerups(3)
|
||||
get_tree().paused = true
|
||||
GameStats.powerup_screen_active = true
|
||||
|
||||
|
||||
func spawn_powerups(value):
|
||||
var i = 0
|
||||
while i < value:
|
||||
var NewPowerup = load(scenes[rand_range(0, scenes.size())])
|
||||
var new_powerup = NewPowerup.instance()
|
||||
new_powerup.set_spawn_position(self.global_position)
|
||||
var main = get_tree().current_scene
|
||||
$CanvasLayer/CenterContainer/HBoxContainer.add_child(new_powerup)
|
||||
i += 1
|
||||
|
||||
25
Pegs/Yellow/PowerupCards.tscn
Normal file
25
Pegs/Yellow/PowerupCards.tscn
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Pegs/Yellow/PowerupCards.gd" type="Script" id=1]
|
||||
|
||||
[node name="PowerupCards" type="Node2D"]
|
||||
pause_mode = 2
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="CanvasLayer"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/CenterContainer"]
|
||||
margin_left = 192.0
|
||||
margin_top = 108.0
|
||||
margin_right = 192.0
|
||||
margin_bottom = 108.0
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
6
Pegs/Yellow/PowerupCards/Scattershot.tscn
Normal file
6
Pegs/Yellow/PowerupCards/Scattershot.tscn
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://Pegs/Yellow/PowerupCard.tscn" type="PackedScene" id=1]
|
||||
|
||||
[node name="Scattershot" instance=ExtResource( 1 )]
|
||||
hint_tooltip = "scattershot!"
|
||||
28
Pegs/Yellow/YellowPeg.gd
Normal file
28
Pegs/Yellow/YellowPeg.gd
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
extends StaticBody2D
|
||||
|
||||
# turns the pegs green
|
||||
func make_green():
|
||||
# preload a green peg
|
||||
var Green_peg = load("res://Pegs/Green/GreenPeg.tscn")
|
||||
# instance it
|
||||
var green_peg = Green_peg.instance()
|
||||
# take care of positioning
|
||||
# green_peg.rotation = rotation + 5
|
||||
green_peg.global_position = global_position
|
||||
|
||||
|
||||
# add score
|
||||
$ScoreCounter.trigger()
|
||||
|
||||
# get the main scene of current peg and add new peg to it
|
||||
var main = get_tree().current_scene
|
||||
main.add_child(green_peg)
|
||||
|
||||
var Powerups = preload("res://Pegs/Yellow/PowerupCards.tscn")
|
||||
var powerups = Powerups.instance()
|
||||
powerups.position = global_position
|
||||
|
||||
main.add_child(powerups)
|
||||
|
||||
#finally delete the old peg
|
||||
queue_free()
|
||||
17
Pegs/Yellow/YellowPeg.tscn
Normal file
17
Pegs/Yellow/YellowPeg.tscn
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://Pegs/Yellow/yellow.png" type="Texture" id=1]
|
||||
[ext_resource path="res://Pegs/DefaultPegCollisionShape.tscn" type="PackedScene" id=2]
|
||||
[ext_resource path="res://Pegs/ScoreCounter.tscn" type="PackedScene" id=3]
|
||||
[ext_resource path="res://Pegs/Yellow/YellowPeg.gd" type="Script" id=4]
|
||||
|
||||
[node name="YellowPeg" type="StaticBody2D"]
|
||||
collision_mask = 0
|
||||
script = ExtResource( 4 )
|
||||
|
||||
[node name="Sprite" type="Sprite" parent="."]
|
||||
texture = ExtResource( 1 )
|
||||
|
||||
[node name="DefaultPegCollisionShape" parent="." instance=ExtResource( 2 )]
|
||||
|
||||
[node name="ScoreCounter" parent="." instance=ExtResource( 3 )]
|
||||
BIN
Pegs/Yellow/yellow.png
Normal file
BIN
Pegs/Yellow/yellow.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 155 B |
34
Pegs/Yellow/yellow.png.import
Normal file
34
Pegs/Yellow/yellow.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/yellow.png-50fc212920f49451d8c0e83182479efc.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Pegs/Yellow/yellow.png"
|
||||
dest_files=[ "res://.import/yellow.png-50fc212920f49451d8c0e83182479efc.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=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
|
||||
Loading…
Add table
Add a link
Reference in a new issue