mirror of
https://github.com/Steffo99/particle-clash.git
synced 2024-11-21 23:24:18 +00:00
Complete (more or less) the game
This commit is contained in:
parent
98aded7b07
commit
85bc924680
21 changed files with 923 additions and 120 deletions
5
.vscode/settings.json
vendored
5
.vscode/settings.json
vendored
|
@ -1,7 +1,8 @@
|
||||||
{
|
{
|
||||||
"files.exclude": {
|
"files.exclude": {
|
||||||
"**/.import": true,
|
"**/*.import": true,
|
||||||
"**/*.tscn": true
|
"**/*.tscn": true,
|
||||||
|
"**/*.tres": true,
|
||||||
},
|
},
|
||||||
"editor.insertSpaces": false,
|
"editor.insertSpaces": false,
|
||||||
"editor.renderWhitespace": "all"
|
"editor.renderWhitespace": "all"
|
||||||
|
|
39
default_bus_layout.tres
Normal file
39
default_bus_layout.tres
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
[gd_resource type="AudioBusLayout" load_steps=3 format=2]
|
||||||
|
|
||||||
|
[sub_resource type="AudioEffectPanner" id=1]
|
||||||
|
resource_name = "Panner"
|
||||||
|
pan = -0.4
|
||||||
|
|
||||||
|
[sub_resource type="AudioEffectPanner" id=2]
|
||||||
|
resource_name = "Panner"
|
||||||
|
pan = 0.4
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
bus/1/name = "Sound"
|
||||||
|
bus/1/solo = false
|
||||||
|
bus/1/mute = false
|
||||||
|
bus/1/bypass_fx = false
|
||||||
|
bus/1/volume_db = 0.0
|
||||||
|
bus/1/send = "Master"
|
||||||
|
bus/2/name = "Left"
|
||||||
|
bus/2/solo = false
|
||||||
|
bus/2/mute = false
|
||||||
|
bus/2/bypass_fx = false
|
||||||
|
bus/2/volume_db = 0.0
|
||||||
|
bus/2/send = "Sound"
|
||||||
|
bus/2/effect/0/effect = SubResource( 1 )
|
||||||
|
bus/2/effect/0/enabled = true
|
||||||
|
bus/3/name = "Right"
|
||||||
|
bus/3/solo = false
|
||||||
|
bus/3/mute = false
|
||||||
|
bus/3/bypass_fx = false
|
||||||
|
bus/3/volume_db = 0.0
|
||||||
|
bus/3/send = "Sound"
|
||||||
|
bus/3/effect/0/effect = SubResource( 2 )
|
||||||
|
bus/3/effect/0/enabled = true
|
||||||
|
bus/4/name = "Music"
|
||||||
|
bus/4/solo = false
|
||||||
|
bus/4/mute = false
|
||||||
|
bus/4/bypass_fx = false
|
||||||
|
bus/4/volume_db = 0.0
|
||||||
|
bus/4/send = "Master"
|
|
@ -10,7 +10,7 @@ config_version=4
|
||||||
|
|
||||||
[application]
|
[application]
|
||||||
|
|
||||||
config/name="Atomic Fusion"
|
config/name="Particle Clash"
|
||||||
run/main_scene="res://src/Main.tscn"
|
run/main_scene="res://src/Main.tscn"
|
||||||
boot_splash/show_image=false
|
boot_splash/show_image=false
|
||||||
config/icon="res://src/sprites/atom.png"
|
config/icon="res://src/sprites/atom.png"
|
||||||
|
@ -73,6 +73,16 @@ p2_rotate={
|
||||||
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777221,"unicode":0,"echo":false,"script":null)
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":0,"physical_scancode":16777221,"unicode":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
mute_music={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":77,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
mute_sound={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":78,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
|
|
351
src/Main.gd
351
src/Main.gd
|
@ -6,6 +6,9 @@ func _on_LeftColorPicker_color_changed(color: Color):
|
||||||
$Gameplay/LeftPlayArea/Tiles.self_modulate = color
|
$Gameplay/LeftPlayArea/Tiles.self_modulate = color
|
||||||
$Gameplay/LeftPlayArea/Label.self_modulate = color
|
$Gameplay/LeftPlayArea/Label.self_modulate = color
|
||||||
$Gameplay/Minimap/Left.self_modulate = color
|
$Gameplay/Minimap/Left.self_modulate = color
|
||||||
|
$Transitions/LeftTransition.color = color
|
||||||
|
$Results/Container/Scores/Left.self_modulate = color
|
||||||
|
$Results/Container/Rounds/Left.self_modulate = color
|
||||||
|
|
||||||
func _on_RightColorPicker_color_changed(color: Color):
|
func _on_RightColorPicker_color_changed(color: Color):
|
||||||
$Background/Right.modulate = color
|
$Background/Right.modulate = color
|
||||||
|
@ -13,77 +16,299 @@ func _on_RightColorPicker_color_changed(color: Color):
|
||||||
$Gameplay/RightPlayArea/Tiles.self_modulate = color
|
$Gameplay/RightPlayArea/Tiles.self_modulate = color
|
||||||
$Gameplay/RightPlayArea/Label.self_modulate = color
|
$Gameplay/RightPlayArea/Label.self_modulate = color
|
||||||
$Gameplay/Minimap/Right.self_modulate = color
|
$Gameplay/Minimap/Right.self_modulate = color
|
||||||
|
$Transitions/RightTransition.color = color
|
||||||
|
$Results/Container/Scores/Right.self_modulate = color
|
||||||
|
$Results/Container/Rounds/Right.self_modulate = color
|
||||||
|
|
||||||
|
|
||||||
const SHAPE = [
|
const SHAPES = [
|
||||||
# Cross
|
# # Good intro level
|
||||||
|
# [
|
||||||
|
# " RRBB ",
|
||||||
|
# "RRBRBB",
|
||||||
|
# "RBRBRB",
|
||||||
|
# "BRBRBR",
|
||||||
|
# "BBRBRR",
|
||||||
|
# " BBRR "
|
||||||
|
# ],
|
||||||
|
# # With a trick
|
||||||
|
# [
|
||||||
|
# " RBBR ",
|
||||||
|
# "RBRRBR",
|
||||||
|
# "BRWWRB",
|
||||||
|
# "BRWWRB",
|
||||||
|
# "RBRRBR",
|
||||||
|
# " RBBR "
|
||||||
|
# ],
|
||||||
|
# # The Gap
|
||||||
|
# [
|
||||||
|
# " RRBB ",
|
||||||
|
# "RBBRRB",
|
||||||
|
# "BRRBBR",
|
||||||
|
# "RBB RB",
|
||||||
|
# "BRRBBR",
|
||||||
|
# " BBRR "
|
||||||
|
# ],
|
||||||
|
# # Larger
|
||||||
|
# [
|
||||||
|
# " GGBB ",
|
||||||
|
# " GRRYYB ",
|
||||||
|
# "GRRRYYYB",
|
||||||
|
# "GRRRYYYB",
|
||||||
|
# "YBBBGGGR",
|
||||||
|
# "YBBBGGGR",
|
||||||
|
# " YBBGGR ",
|
||||||
|
# " YYRR "
|
||||||
|
# ],
|
||||||
|
# # Donut
|
||||||
|
# [
|
||||||
|
# " RBBR ",
|
||||||
|
# " RBRRBR ",
|
||||||
|
# "RBRBBRBR",
|
||||||
|
# "BRB BRB",
|
||||||
|
# "BRB BRB",
|
||||||
|
# "RBRBBRBR",
|
||||||
|
# " RBRRBR ",
|
||||||
|
# " RBBR "
|
||||||
|
# ],
|
||||||
|
# # Huge
|
||||||
|
# [
|
||||||
|
# " BBBRRR ",
|
||||||
|
# " 22222222 ",
|
||||||
|
# "R22222222B",
|
||||||
|
# "R222 2222B",
|
||||||
|
# "R222222 2B",
|
||||||
|
# "B2 222222R",
|
||||||
|
# "B2222 222R",
|
||||||
|
# "B22222222R",
|
||||||
|
# " 22222222 ",
|
||||||
|
# " RRRBBB "
|
||||||
|
# ]
|
||||||
|
]
|
||||||
|
|
||||||
|
const RANDOM_SHAPES = [
|
||||||
|
# # Smol 2
|
||||||
|
# [
|
||||||
|
# " 2222 ",
|
||||||
|
# "222222",
|
||||||
|
# "222222",
|
||||||
|
# "222222",
|
||||||
|
# "222222",
|
||||||
|
# " 2222 ",
|
||||||
|
# ],
|
||||||
|
# # Smol 3
|
||||||
|
# [
|
||||||
|
# " 3333 ",
|
||||||
|
# "333333",
|
||||||
|
# "333333",
|
||||||
|
# "333333",
|
||||||
|
# "333333",
|
||||||
|
# " 3333 ",
|
||||||
|
# ],
|
||||||
|
# # Smol 4
|
||||||
|
# [
|
||||||
|
# " 4444 ",
|
||||||
|
# "444444",
|
||||||
|
# "444444",
|
||||||
|
# "444444",
|
||||||
|
# "444444",
|
||||||
|
# " 4444 ",
|
||||||
|
# ],
|
||||||
|
# # Larger 3
|
||||||
|
# [
|
||||||
|
# " 3333 ",
|
||||||
|
# " 333333 ",
|
||||||
|
# "33333333",
|
||||||
|
# "33333333",
|
||||||
|
# "33333333",
|
||||||
|
# "33333333",
|
||||||
|
# " 333333 ",
|
||||||
|
# " 3333 "
|
||||||
|
# ],
|
||||||
|
# # Larger 4
|
||||||
|
# [
|
||||||
|
# " 4444 ",
|
||||||
|
# " 444444 ",
|
||||||
|
# "44444444",
|
||||||
|
# "44444444",
|
||||||
|
# "44444444",
|
||||||
|
# "44444444",
|
||||||
|
# " 444444 ",
|
||||||
|
# " 4444 "
|
||||||
|
# ],
|
||||||
|
# # Larger 5
|
||||||
|
# [
|
||||||
|
# " 5555 ",
|
||||||
|
# " 555555 ",
|
||||||
|
# "55555555",
|
||||||
|
# "55555555",
|
||||||
|
# "55555555",
|
||||||
|
# "55555555",
|
||||||
|
# " 555555 ",
|
||||||
|
# " 5555 "
|
||||||
|
# ],
|
||||||
|
# # Donut 3
|
||||||
|
# [
|
||||||
|
# " 3333 ",
|
||||||
|
# " 333333 ",
|
||||||
|
# "33333333",
|
||||||
|
# "333 333",
|
||||||
|
# "333 333",
|
||||||
|
# "33333333",
|
||||||
|
# " 333333 ",
|
||||||
|
# " 3333 "
|
||||||
|
# ],
|
||||||
|
# # Huge mix
|
||||||
|
# [
|
||||||
|
# " 2222 ",
|
||||||
|
# " 233332 ",
|
||||||
|
# " 23555532 ",
|
||||||
|
# "2355555532",
|
||||||
|
# "2355555532",
|
||||||
|
# "2355555532",
|
||||||
|
# "2355555532",
|
||||||
|
# " 23555532 ",
|
||||||
|
# " 233332 ",
|
||||||
|
# " 2222 "
|
||||||
|
# ],
|
||||||
|
# Huge 3
|
||||||
[
|
[
|
||||||
" GG ",
|
" 3333 ",
|
||||||
" YY ",
|
" 33333333 ",
|
||||||
" YGGY ",
|
" 33333333 ",
|
||||||
"RBRWWRBR",
|
"3333333333",
|
||||||
"RBRWWRBR",
|
"3333333333",
|
||||||
" YGGY ",
|
"3333333333",
|
||||||
" YY ",
|
"3333333333",
|
||||||
" GG "
|
" 33333333 ",
|
||||||
],
|
" 33333333 ",
|
||||||
# Larger
|
" 3333 "
|
||||||
[
|
]
|
||||||
" GGBB ",
|
|
||||||
" GRRYYB ",
|
|
||||||
"GRRRYYYB",
|
|
||||||
"GRRRYYYB",
|
|
||||||
"YBBBGGGR",
|
|
||||||
"YBBBGGGR",
|
|
||||||
" YBBGGR ",
|
|
||||||
" YYRR "
|
|
||||||
],
|
|
||||||
# Donut
|
|
||||||
[
|
|
||||||
" RBBR ",
|
|
||||||
" RBRRBR ",
|
|
||||||
"RBRBBRBR",
|
|
||||||
"BRB BRB",
|
|
||||||
"BRB BRB",
|
|
||||||
"RBRBBRBR",
|
|
||||||
" RBRRBR ",
|
|
||||||
" RBBR "
|
|
||||||
],
|
|
||||||
# Good intro level
|
|
||||||
[
|
|
||||||
" RRBB ",
|
|
||||||
"RRBRBB",
|
|
||||||
"RBRBRB",
|
|
||||||
"BRBRBR",
|
|
||||||
"BBRBRR",
|
|
||||||
" BBRR "
|
|
||||||
],
|
|
||||||
# With a trick
|
|
||||||
[
|
|
||||||
" RBBR ",
|
|
||||||
"RBRRBR",
|
|
||||||
"BRWWRB",
|
|
||||||
"BRWWRB",
|
|
||||||
"RBRRBR",
|
|
||||||
" RBBR "
|
|
||||||
],
|
|
||||||
# TODO: Find solution?
|
|
||||||
[
|
|
||||||
" RRBB ",
|
|
||||||
"RBBRRB",
|
|
||||||
"BRRBBR",
|
|
||||||
"RBB RB",
|
|
||||||
"BRRBBR",
|
|
||||||
" BBRR "
|
|
||||||
],
|
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
func _on_Button_button_up():
|
func _on_Button_button_up():
|
||||||
$Menu.visible = false
|
$Menu.visible = false
|
||||||
$Gameplay.visible = true
|
$Transitions/MenuTransition/Fade.play("FadeIn")
|
||||||
$Gameplay/LeftPlayArea.tiles_init(SHAPE[0])
|
|
||||||
|
|
||||||
|
func init_round():
|
||||||
|
var shape = SHAPES.pop_front()
|
||||||
|
if shape == null:
|
||||||
|
shape = RANDOM_SHAPES[rng.randi_range(0, len(RANDOM_SHAPES)) - 1]
|
||||||
|
|
||||||
|
var current_time = OS.get_unix_time()
|
||||||
|
print("Using %d as seed" % current_time)
|
||||||
|
|
||||||
|
$Gameplay/LeftPlayArea.tiles_init(shape, current_time)
|
||||||
$Gameplay/LeftPlayArea.cursor_init()
|
$Gameplay/LeftPlayArea.cursor_init()
|
||||||
$Gameplay/RightPlayArea.tiles_init(SHAPE[0])
|
$Gameplay/RightPlayArea.tiles_init(shape, current_time)
|
||||||
$Gameplay/RightPlayArea.cursor_init()
|
$Gameplay/RightPlayArea.cursor_init()
|
||||||
|
|
||||||
|
|
||||||
|
func start_round():
|
||||||
$Gameplay/Timer.start()
|
$Gameplay/Timer.start()
|
||||||
|
$Gameplay/LeftPlayArea.can_act = true
|
||||||
|
$Gameplay/RightPlayArea.can_act = true
|
||||||
|
|
||||||
|
$Gameplay/Music/MusicBase.play()
|
||||||
|
|
||||||
|
if len($Gameplay/LeftPlayArea/Tiles.shape) >= 6:
|
||||||
|
$Gameplay/Music/MusicSine.play()
|
||||||
|
|
||||||
|
if len($Gameplay/LeftPlayArea/Tiles.shape) >= 8:
|
||||||
|
$Gameplay/Music/MusicSquare.play()
|
||||||
|
|
||||||
|
if len($Gameplay/LeftPlayArea/Tiles.shape) >= 10:
|
||||||
|
$Gameplay/Music/MusicSaw.play()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_MenuFade_animation_finished(anim_name: String):
|
||||||
|
if anim_name == "FadeIn":
|
||||||
|
$Gameplay.visible = true
|
||||||
|
init_round()
|
||||||
|
$Transitions/MenuTransition/Fade.play("FadeOut")
|
||||||
|
elif anim_name == "FadeOut":
|
||||||
|
start_round()
|
||||||
|
|
||||||
|
|
||||||
|
var which_transition
|
||||||
|
var left_rounds = 0
|
||||||
|
var right_rounds = 0
|
||||||
|
var completed_rounds = 0
|
||||||
|
|
||||||
|
func _on_PlayTimer_timeout():
|
||||||
|
$Gameplay/LeftPlayArea.can_act = false
|
||||||
|
$Gameplay/RightPlayArea.can_act = false
|
||||||
|
|
||||||
|
var left_score = $Gameplay/LeftPlayArea.score
|
||||||
|
var right_score = $Gameplay/RightPlayArea.score
|
||||||
|
|
||||||
|
completed_rounds += 1
|
||||||
|
|
||||||
|
if left_score > right_score:
|
||||||
|
$Results/Container/Winner.text = "Left wins the round!"
|
||||||
|
left_rounds += 1
|
||||||
|
which_transition = "Left"
|
||||||
|
$Transitions/LeftTransition/Fade.play("FadeIn")
|
||||||
|
elif left_score < right_score:
|
||||||
|
$Results/Container/Winner.text = "Right wins the round!"
|
||||||
|
right_rounds += 1
|
||||||
|
which_transition = "Right"
|
||||||
|
$Transitions/RightTransition/Fade.play("FadeIn")
|
||||||
|
else:
|
||||||
|
$Results/Container/Winner.text = "It's a tie!"
|
||||||
|
which_transition = "Tie"
|
||||||
|
$Transitions/TieTransition/Fade.play("FadeIn")
|
||||||
|
|
||||||
|
$Results/Container/Scores/Left.text = "%d" % left_score
|
||||||
|
$Results/Container/Scores/Right.text = "%d" % right_score
|
||||||
|
|
||||||
|
$Results/Container/Rounds/Left.text = "%d" % left_rounds
|
||||||
|
$Results/Container/Rounds/Right.text = "%d" % right_rounds
|
||||||
|
|
||||||
|
|
||||||
|
func _on_SideFade_animation_finished(anim_name: String):
|
||||||
|
if anim_name == "FadeIn":
|
||||||
|
$Results.visible = true
|
||||||
|
$Results/Timer.start()
|
||||||
|
elif anim_name == "FadeOut":
|
||||||
|
start_round()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_ResultsTimer_timeout():
|
||||||
|
$Results.visible = false
|
||||||
|
|
||||||
|
init_round()
|
||||||
|
|
||||||
|
if which_transition == "Left":
|
||||||
|
$Transitions/LeftTransition/Fade.play("FadeOut")
|
||||||
|
if which_transition == "Right":
|
||||||
|
$Transitions/RightTransition/Fade.play("FadeOut")
|
||||||
|
if which_transition == "Tie":
|
||||||
|
$Transitions/TieTransition/Fade.play("FadeOut")
|
||||||
|
|
||||||
|
|
||||||
|
var rng = RandomNumberGenerator.new()
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
# Now this is a good hack
|
||||||
|
rng.seed = OS.get_datetime()["minute"]
|
||||||
|
|
||||||
|
|
||||||
|
func _process(_delta):
|
||||||
|
if Input.is_action_just_pressed("mute_music"):
|
||||||
|
var bus = AudioServer.get_bus_index("Music")
|
||||||
|
if AudioServer.get_bus_volume_db(bus) == 0:
|
||||||
|
AudioServer.set_bus_volume_db(bus, -80)
|
||||||
|
else:
|
||||||
|
AudioServer.set_bus_volume_db(bus, 0)
|
||||||
|
|
||||||
|
if Input.is_action_just_pressed("mute_sound"):
|
||||||
|
var bus = AudioServer.get_bus_index("Sound")
|
||||||
|
if AudioServer.get_bus_volume_db(bus) == 0:
|
||||||
|
AudioServer.set_bus_volume_db(bus, -80)
|
||||||
|
else:
|
||||||
|
AudioServer.set_bus_volume_db(bus, 0)
|
||||||
|
|
344
src/Main.tscn
344
src/Main.tscn
|
@ -1,9 +1,198 @@
|
||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=18 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/scenes/Menu.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://src/scenes/Menu.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://src/scenes/Gameplay.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://src/scenes/Gameplay.tscn" type="PackedScene" id=2]
|
||||||
[ext_resource path="res://src/scenes/Background.tscn" type="PackedScene" id=3]
|
[ext_resource path="res://src/scenes/Background.tscn" type="PackedScene" id=3]
|
||||||
[ext_resource path="res://src/Main.gd" type="Script" id=5]
|
[ext_resource path="res://src/Main.gd" type="Script" id=5]
|
||||||
|
[ext_resource path="res://src/scenes/Results.tscn" type="PackedScene" id=6]
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=2]
|
||||||
|
resource_name = "FadeIn"
|
||||||
|
step = 0.0166667
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 1 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=1]
|
||||||
|
resource_name = "FadeOut"
|
||||||
|
step = 0.0166667
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 1 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=3]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 0 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=5]
|
||||||
|
resource_name = "FadeIn"
|
||||||
|
step = 0.0166667
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 1 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=4]
|
||||||
|
resource_name = "FadeOut"
|
||||||
|
step = 0.0166667
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 1 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=6]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 0 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=8]
|
||||||
|
resource_name = "FadeIn"
|
||||||
|
step = 0.0166667
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 1 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=7]
|
||||||
|
resource_name = "FadeOut"
|
||||||
|
step = 0.0166667
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 1 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=9]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 0 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=10]
|
||||||
|
resource_name = "FadeIn"
|
||||||
|
step = 0.0166667
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 1 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 0 ), Color( 1, 1, 1, 1 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=11]
|
||||||
|
resource_name = "FadeOut"
|
||||||
|
step = 0.0166667
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0, 1 ),
|
||||||
|
"transitions": PoolRealArray( 1, 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 1 ), Color( 1, 1, 1, 0 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[sub_resource type="Animation" id=12]
|
||||||
|
length = 0.001
|
||||||
|
tracks/0/type = "value"
|
||||||
|
tracks/0/path = NodePath(".:modulate")
|
||||||
|
tracks/0/interp = 1
|
||||||
|
tracks/0/loop_wrap = true
|
||||||
|
tracks/0/imported = false
|
||||||
|
tracks/0/enabled = true
|
||||||
|
tracks/0/keys = {
|
||||||
|
"times": PoolRealArray( 0 ),
|
||||||
|
"transitions": PoolRealArray( 1 ),
|
||||||
|
"update": 0,
|
||||||
|
"values": [ Color( 1, 1, 1, 0 ) ]
|
||||||
|
}
|
||||||
|
|
||||||
[node name="Main" type="Node2D"]
|
[node name="Main" type="Node2D"]
|
||||||
script = ExtResource( 5 )
|
script = ExtResource( 5 )
|
||||||
|
@ -13,27 +202,160 @@ position = Vector2( 800, 450 )
|
||||||
|
|
||||||
[node name="Menu" parent="." instance=ExtResource( 1 )]
|
[node name="Menu" parent="." instance=ExtResource( 1 )]
|
||||||
|
|
||||||
[node name="ColorPicker" parent="Menu/VBoxContainer/Colors/Left Player" index="1"]
|
[node name="Title" parent="Menu/VBoxContainer" index="0"]
|
||||||
margin_left = 0.0
|
margin_top = 78.0
|
||||||
margin_top = 34.0
|
margin_right = 1600.0
|
||||||
margin_right = 420.0
|
margin_bottom = 136.0
|
||||||
margin_bottom = 508.0
|
|
||||||
|
|
||||||
[node name="ColorPicker" parent="Menu/VBoxContainer/Colors/Right Player" index="1"]
|
[node name="Title2" parent="Menu/VBoxContainer" index="1"]
|
||||||
margin_left = 0.0
|
margin_top = 140.0
|
||||||
margin_top = 34.0
|
margin_right = 1600.0
|
||||||
margin_right = 420.0
|
margin_bottom = 170.0
|
||||||
margin_bottom = 508.0
|
|
||||||
|
[node name="Padding" parent="Menu/VBoxContainer" index="2"]
|
||||||
|
margin_top = 174.0
|
||||||
|
margin_right = 1600.0
|
||||||
|
margin_bottom = 214.0
|
||||||
|
|
||||||
|
[node name="Colors" parent="Menu/VBoxContainer" index="3"]
|
||||||
|
margin_top = 218.0
|
||||||
|
margin_right = 1600.0
|
||||||
|
margin_bottom = 726.0
|
||||||
|
|
||||||
|
[node name="Left Player" parent="Menu/VBoxContainer/Colors" index="0"]
|
||||||
|
margin_left = 304.0
|
||||||
|
margin_right = 724.0
|
||||||
|
|
||||||
|
[node name="Vs" parent="Menu/VBoxContainer/Colors" index="1"]
|
||||||
|
margin_left = 728.0
|
||||||
|
margin_right = 872.0
|
||||||
|
|
||||||
|
[node name="Right Player" parent="Menu/VBoxContainer/Colors" index="2"]
|
||||||
|
margin_left = 876.0
|
||||||
|
margin_right = 1296.0
|
||||||
|
|
||||||
|
[node name="Padding2" parent="Menu/VBoxContainer" index="4"]
|
||||||
|
margin_top = 730.0
|
||||||
|
margin_right = 1600.0
|
||||||
|
margin_bottom = 770.0
|
||||||
|
|
||||||
|
[node name="Button" parent="Menu/VBoxContainer" index="5"]
|
||||||
|
margin_left = 720.0
|
||||||
|
margin_top = 774.0
|
||||||
|
margin_right = 880.0
|
||||||
|
margin_bottom = 822.0
|
||||||
|
|
||||||
[node name="Gameplay" parent="." instance=ExtResource( 2 )]
|
[node name="Gameplay" parent="." instance=ExtResource( 2 )]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
||||||
|
[node name="SoundMove" parent="Gameplay/LeftPlayArea/Tiles/Cursor" index="0"]
|
||||||
|
bus = "Left"
|
||||||
|
|
||||||
|
[node name="SoundOk" parent="Gameplay/LeftPlayArea/Tiles/Cursor" index="1"]
|
||||||
|
bus = "Left"
|
||||||
|
|
||||||
|
[node name="SoundMove" parent="Gameplay/RightPlayArea/Tiles/Cursor" index="0"]
|
||||||
|
bus = "Right"
|
||||||
|
|
||||||
|
[node name="SoundOk" parent="Gameplay/RightPlayArea/Tiles/Cursor" index="1"]
|
||||||
|
bus = "Right"
|
||||||
|
|
||||||
|
[node name="Transitions" type="Control" parent="."]
|
||||||
|
margin_right = 1600.0
|
||||||
|
margin_bottom = 900.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
|
[node name="MenuTransition" type="ColorRect" parent="Transitions"]
|
||||||
|
modulate = Color( 1, 1, 1, 0 )
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
|
[node name="Fade" type="AnimationPlayer" parent="Transitions/MenuTransition"]
|
||||||
|
anims/FadeIn = SubResource( 2 )
|
||||||
|
anims/FadeOut = SubResource( 1 )
|
||||||
|
anims/RESET = SubResource( 3 )
|
||||||
|
|
||||||
|
[node name="LeftTransition" type="ColorRect" parent="Transitions"]
|
||||||
|
modulate = Color( 1, 1, 1, 0 )
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
mouse_filter = 2
|
||||||
|
color = Color( 1, 0.7, 0.7, 1 )
|
||||||
|
|
||||||
|
[node name="Fade" type="AnimationPlayer" parent="Transitions/LeftTransition"]
|
||||||
|
anims/FadeIn = SubResource( 5 )
|
||||||
|
anims/FadeOut = SubResource( 4 )
|
||||||
|
anims/RESET = SubResource( 6 )
|
||||||
|
|
||||||
|
[node name="RightTransition" type="ColorRect" parent="Transitions"]
|
||||||
|
modulate = Color( 1, 1, 1, 0 )
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
mouse_filter = 2
|
||||||
|
color = Color( 0.7, 0.7, 1, 1 )
|
||||||
|
|
||||||
|
[node name="Fade" type="AnimationPlayer" parent="Transitions/RightTransition"]
|
||||||
|
anims/FadeIn = SubResource( 8 )
|
||||||
|
anims/FadeOut = SubResource( 7 )
|
||||||
|
anims/RESET = SubResource( 9 )
|
||||||
|
|
||||||
|
[node name="TieTransition" type="ColorRect" parent="Transitions"]
|
||||||
|
modulate = Color( 1, 1, 1, 0 )
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
mouse_filter = 2
|
||||||
|
|
||||||
|
[node name="Fade" type="AnimationPlayer" parent="Transitions/TieTransition"]
|
||||||
|
anims/FadeIn = SubResource( 10 )
|
||||||
|
anims/FadeOut = SubResource( 11 )
|
||||||
|
anims/RESET = SubResource( 12 )
|
||||||
|
|
||||||
|
[node name="Results" parent="." instance=ExtResource( 6 )]
|
||||||
|
visible = false
|
||||||
|
|
||||||
|
[node name="Winner" parent="Results/Container" index="0"]
|
||||||
|
margin_top = 331.0
|
||||||
|
margin_bottom = 389.0
|
||||||
|
|
||||||
|
[node name="Padding1" parent="Results/Container" index="1"]
|
||||||
|
margin_top = 393.0
|
||||||
|
margin_bottom = 425.0
|
||||||
|
|
||||||
|
[node name="ScoreLabel" parent="Results/Container" index="2"]
|
||||||
|
margin_top = 429.0
|
||||||
|
margin_bottom = 430.0
|
||||||
|
|
||||||
|
[node name="Scores" parent="Results/Container" index="3"]
|
||||||
|
margin_top = 434.0
|
||||||
|
margin_bottom = 464.0
|
||||||
|
|
||||||
|
[node name="Padding2" parent="Results/Container" index="4"]
|
||||||
|
margin_top = 468.0
|
||||||
|
margin_bottom = 500.0
|
||||||
|
|
||||||
|
[node name="RoundsLabel" parent="Results/Container" index="5"]
|
||||||
|
margin_top = 504.0
|
||||||
|
margin_bottom = 534.0
|
||||||
|
custom_colors/font_outline_modulate = Color( 0, 0, 0, 1 )
|
||||||
|
|
||||||
|
[node name="Rounds" parent="Results/Container" index="6"]
|
||||||
|
margin_top = 538.0
|
||||||
|
margin_bottom = 568.0
|
||||||
|
|
||||||
[connection signal="color_changed" from="Menu/VBoxContainer/Colors/Left Player/ColorPicker" to="." method="_on_LeftColorPicker_color_changed"]
|
[connection signal="color_changed" from="Menu/VBoxContainer/Colors/Left Player/ColorPicker" to="." method="_on_LeftColorPicker_color_changed"]
|
||||||
[connection signal="color_changed" from="Menu/VBoxContainer/Colors/Right Player/ColorPicker" to="." method="_on_RightColorPicker_color_changed"]
|
[connection signal="color_changed" from="Menu/VBoxContainer/Colors/Right Player/ColorPicker" to="." method="_on_RightColorPicker_color_changed"]
|
||||||
[connection signal="button_up" from="Menu/VBoxContainer/Button" to="." method="_on_Button_button_up"]
|
[connection signal="button_up" from="Menu/VBoxContainer/Button" to="." method="_on_Button_button_up"]
|
||||||
|
[connection signal="timeout" from="Gameplay/Timer" to="." method="_on_PlayTimer_timeout"]
|
||||||
|
[connection signal="animation_finished" from="Transitions/MenuTransition/Fade" to="." method="_on_MenuFade_animation_finished"]
|
||||||
|
[connection signal="animation_finished" from="Transitions/LeftTransition/Fade" to="." method="_on_SideFade_animation_finished"]
|
||||||
|
[connection signal="animation_finished" from="Transitions/RightTransition/Fade" to="." method="_on_SideFade_animation_finished"]
|
||||||
|
[connection signal="animation_finished" from="Transitions/TieTransition/Fade" to="." method="_on_SideFade_animation_finished"]
|
||||||
|
[connection signal="timeout" from="Results/Timer" to="." method="_on_ResultsTimer_timeout"]
|
||||||
|
|
||||||
[editable path="Background"]
|
[editable path="Background"]
|
||||||
[editable path="Menu"]
|
[editable path="Menu"]
|
||||||
[editable path="Gameplay"]
|
[editable path="Gameplay"]
|
||||||
[editable path="Gameplay/LeftPlayArea"]
|
[editable path="Gameplay/LeftPlayArea"]
|
||||||
[editable path="Gameplay/RightPlayArea"]
|
[editable path="Gameplay/RightPlayArea"]
|
||||||
|
[editable path="Results"]
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
[ext_resource path="res://src/sprites/background.png" type="Texture" id=1]
|
[ext_resource path="res://src/sprites/background.png" type="Texture" id=1]
|
||||||
|
|
||||||
[node name="Background" type="Node2D"]
|
[node name="Background" type="Node2D"]
|
||||||
modulate = Color( 0.117647, 0.117647, 0.117647, 1 )
|
modulate = Color( 0.25, 0.25, 0.25, 1 )
|
||||||
|
|
||||||
[node name="Left" type="Sprite" parent="."]
|
[node name="Left" type="Sprite" parent="."]
|
||||||
modulate = Color( 1, 0.701961, 0.701961, 1 )
|
modulate = Color( 1, 0.701961, 0.701961, 1 )
|
||||||
|
|
|
@ -5,8 +5,3 @@ func _process(_delta):
|
||||||
var timer = $Timer
|
var timer = $Timer
|
||||||
$Minimap/Left.position.x = (1 - timer.time_left / timer.wait_time) * (get_viewport().size.x / 2)
|
$Minimap/Left.position.x = (1 - timer.time_left / timer.wait_time) * (get_viewport().size.x / 2)
|
||||||
$Minimap/Right.position.x = get_viewport().size.x - (1 - timer.time_left / timer.wait_time) * (get_viewport().size.x / 2)
|
$Minimap/Right.position.x = get_viewport().size.x - (1 - timer.time_left / timer.wait_time) * (get_viewport().size.x / 2)
|
||||||
|
|
||||||
|
|
||||||
func _on_Timer_timeout():
|
|
||||||
$LeftPlayArea.can_act = false
|
|
||||||
$RightPlayArea.can_act = false
|
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene load_steps=9 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/scenes/Gameplay.gd" type="Script" id=1]
|
[ext_resource path="res://src/scenes/Gameplay.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://src/sprites/atom.png" type="Texture" id=2]
|
[ext_resource path="res://src/sprites/atom.png" type="Texture" id=2]
|
||||||
|
[ext_resource path="res://src/music/2-atoms-sine.ogg" type="AudioStream" id=3]
|
||||||
|
[ext_resource path="res://src/music/2-atoms-square.ogg" type="AudioStream" id=4]
|
||||||
|
[ext_resource path="res://src/music/2-atoms-base.ogg" type="AudioStream" id=5]
|
||||||
[ext_resource path="res://src/scenes/Play Area.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://src/scenes/Play Area.tscn" type="PackedScene" id=6]
|
||||||
[ext_resource path="res://src/scenes/Timer.tscn" type="PackedScene" id=7]
|
[ext_resource path="res://src/scenes/Timer.tscn" type="PackedScene" id=7]
|
||||||
|
[ext_resource path="res://src/music/2-atoms-saw.ogg" type="AudioStream" id=8]
|
||||||
|
|
||||||
[node name="Gameplay" type="Node2D"]
|
[node name="Gameplay" type="Node2D"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
@ -29,6 +33,24 @@ self_modulate = Color( 0.701961, 0.701961, 1, 1 )
|
||||||
[node name="Timer" parent="." instance=ExtResource( 7 )]
|
[node name="Timer" parent="." instance=ExtResource( 7 )]
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
|
[node name="Music" type="Node" parent="."]
|
||||||
|
|
||||||
|
[node name="MusicBase" type="AudioStreamPlayer" parent="Music"]
|
||||||
|
stream = ExtResource( 5 )
|
||||||
|
bus = "Music"
|
||||||
|
|
||||||
|
[node name="MusicSine" type="AudioStreamPlayer" parent="Music"]
|
||||||
|
stream = ExtResource( 3 )
|
||||||
|
bus = "Music"
|
||||||
|
|
||||||
|
[node name="MusicSquare" type="AudioStreamPlayer" parent="Music"]
|
||||||
|
stream = ExtResource( 4 )
|
||||||
|
bus = "Music"
|
||||||
|
|
||||||
|
[node name="MusicSaw" type="AudioStreamPlayer" parent="Music"]
|
||||||
|
stream = ExtResource( 8 )
|
||||||
|
bus = "Music"
|
||||||
|
|
||||||
[node name="Minimap" type="Node2D" parent="."]
|
[node name="Minimap" type="Node2D" parent="."]
|
||||||
position = Vector2( 0, 16 )
|
position = Vector2( 0, 16 )
|
||||||
|
|
||||||
|
@ -43,7 +65,5 @@ position = Vector2( 1600, 0 )
|
||||||
scale = Vector2( 0.5, 0.5 )
|
scale = Vector2( 0.5, 0.5 )
|
||||||
texture = ExtResource( 2 )
|
texture = ExtResource( 2 )
|
||||||
|
|
||||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
|
||||||
|
|
||||||
[editable path="LeftPlayArea"]
|
[editable path="LeftPlayArea"]
|
||||||
[editable path="RightPlayArea"]
|
[editable path="RightPlayArea"]
|
||||||
|
|
|
@ -31,7 +31,7 @@ margin_top = 528.0
|
||||||
margin_right = 3200.0
|
margin_right = 3200.0
|
||||||
margin_bottom = 586.0
|
margin_bottom = 586.0
|
||||||
custom_fonts/font = SubResource( 3 )
|
custom_fonts/font = SubResource( 3 )
|
||||||
text = "Atomic Clash"
|
text = "Particle Clash"
|
||||||
align = 1
|
align = 1
|
||||||
|
|
||||||
[node name="Title2" type="Label" parent="VBoxContainer"]
|
[node name="Title2" type="Label" parent="VBoxContainer"]
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
extends Sprite
|
extends Sprite
|
||||||
|
|
||||||
|
|
||||||
var can_act = true
|
var can_act = false
|
||||||
|
|
||||||
|
|
||||||
func tiles_init(shape):
|
func tiles_init(shape, sd):
|
||||||
$Tiles.set_shape(shape)
|
$Tiles.set_shape(shape, sd)
|
||||||
check_matches()
|
check_matches()
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,9 +87,16 @@ func cursor_rotate():
|
||||||
$Tiles.atoms[cursor_pos.y+1][cursor_pos.x] = bottom_right
|
$Tiles.atoms[cursor_pos.y+1][cursor_pos.x] = bottom_right
|
||||||
|
|
||||||
# Optimizable
|
# Optimizable
|
||||||
check_matches()
|
var old_score = score
|
||||||
|
var new_score = check_matches()
|
||||||
|
if new_score > old_score:
|
||||||
|
$Tiles/Cursor/SoundOk.play()
|
||||||
|
else:
|
||||||
|
$Tiles/Cursor/SoundMove.play()
|
||||||
|
|
||||||
|
|
||||||
|
var score
|
||||||
|
|
||||||
func check_matches():
|
func check_matches():
|
||||||
# Horizontally
|
# Horizontally
|
||||||
var size = $Tiles.size
|
var size = $Tiles.size
|
||||||
|
@ -134,8 +141,7 @@ func check_matches():
|
||||||
a4.linked = true
|
a4.linked = true
|
||||||
y += 1
|
y += 1
|
||||||
|
|
||||||
var score = 0
|
score = 0
|
||||||
|
|
||||||
for row in $Tiles.atoms:
|
for row in $Tiles.atoms:
|
||||||
for col in row:
|
for col in row:
|
||||||
if col == null:
|
if col == null:
|
||||||
|
@ -145,6 +151,7 @@ func check_matches():
|
||||||
|
|
||||||
$Label.text = "%d" % score
|
$Label.text = "%d" % score
|
||||||
|
|
||||||
|
return score
|
||||||
|
|
||||||
|
|
||||||
export(String) var player
|
export(String) var player
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
[gd_scene load_steps=8 format=2]
|
[gd_scene load_steps=10 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/sprites/huge-atom.png" type="Texture" id=1]
|
[ext_resource path="res://src/sprites/huge-atom.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://src/scenes/Play Area.gd" type="Script" id=2]
|
[ext_resource path="res://src/scenes/Play Area.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://src/sounds/2-atoms-ok.ogg" type="AudioStream" id=3]
|
||||||
[ext_resource path="res://src/sprites/spinner.png" type="Texture" id=4]
|
[ext_resource path="res://src/sprites/spinner.png" type="Texture" id=4]
|
||||||
[ext_resource path="res://src/fonts/Xolonium-Bold.ttf" type="DynamicFontData" id=5]
|
[ext_resource path="res://src/fonts/Xolonium-Bold.ttf" type="DynamicFontData" id=5]
|
||||||
[ext_resource path="res://src/scenes/tiles/Tiles.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://src/scenes/tiles/Tiles.tscn" type="PackedScene" id=6]
|
||||||
|
[ext_resource path="res://src/sounds/2-atoms-move.ogg" type="AudioStream" id=7]
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=2]
|
[sub_resource type="DynamicFont" id=2]
|
||||||
size = 48
|
size = 48
|
||||||
|
@ -36,3 +38,9 @@ valign = 2
|
||||||
[node name="Cursor" type="Sprite" parent="Tiles"]
|
[node name="Cursor" type="Sprite" parent="Tiles"]
|
||||||
position = Vector2( -43, -43 )
|
position = Vector2( -43, -43 )
|
||||||
texture = ExtResource( 4 )
|
texture = ExtResource( 4 )
|
||||||
|
|
||||||
|
[node name="SoundMove" type="AudioStreamPlayer" parent="Tiles/Cursor"]
|
||||||
|
stream = ExtResource( 7 )
|
||||||
|
|
||||||
|
[node name="SoundOk" type="AudioStreamPlayer" parent="Tiles/Cursor"]
|
||||||
|
stream = ExtResource( 3 )
|
||||||
|
|
118
src/scenes/Results.tscn
Normal file
118
src/scenes/Results.tscn
Normal file
|
@ -0,0 +1,118 @@
|
||||||
|
[gd_scene load_steps=4 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/fonts/Xolonium-Bold.ttf" type="DynamicFontData" id=1]
|
||||||
|
[ext_resource path="res://src/themes/results_theme.tres" type="Theme" id=2]
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFont" id=1]
|
||||||
|
size = 48
|
||||||
|
outline_size = 2
|
||||||
|
outline_color = Color( 0, 0, 0, 1 )
|
||||||
|
font_data = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="Results" type="Control"]
|
||||||
|
margin_right = 1600.0
|
||||||
|
margin_bottom = 900.0
|
||||||
|
theme = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Container" type="VBoxContainer" parent="."]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Winner" type="Label" parent="Container"]
|
||||||
|
margin_top = 317.0
|
||||||
|
margin_right = 1600.0
|
||||||
|
margin_bottom = 375.0
|
||||||
|
custom_fonts/font = SubResource( 1 )
|
||||||
|
text = "%s wins the round!"
|
||||||
|
align = 1
|
||||||
|
|
||||||
|
[node name="Padding1" type="HBoxContainer" parent="Container"]
|
||||||
|
margin_top = 379.0
|
||||||
|
margin_right = 1600.0
|
||||||
|
margin_bottom = 411.0
|
||||||
|
rect_min_size = Vector2( 0, 32 )
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="ScoreLabel" type="Label" parent="Container"]
|
||||||
|
margin_top = 415.0
|
||||||
|
margin_right = 1600.0
|
||||||
|
margin_bottom = 445.0
|
||||||
|
text = "Round score:"
|
||||||
|
align = 1
|
||||||
|
|
||||||
|
[node name="Scores" type="HBoxContainer" parent="Container"]
|
||||||
|
margin_top = 449.0
|
||||||
|
margin_right = 1600.0
|
||||||
|
margin_bottom = 479.0
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Left" type="Label" parent="Container/Scores"]
|
||||||
|
self_modulate = Color( 1, 0.701961, 0.701961, 1 )
|
||||||
|
margin_left = 748.0
|
||||||
|
margin_right = 790.0
|
||||||
|
margin_bottom = 30.0
|
||||||
|
text = "%d"
|
||||||
|
align = 1
|
||||||
|
|
||||||
|
[node name="Dash" type="Label" parent="Container/Scores"]
|
||||||
|
margin_left = 794.0
|
||||||
|
margin_right = 805.0
|
||||||
|
margin_bottom = 30.0
|
||||||
|
text = "-"
|
||||||
|
align = 1
|
||||||
|
|
||||||
|
[node name="Right" type="Label" parent="Container/Scores"]
|
||||||
|
self_modulate = Color( 0.7, 0.7, 1, 1 )
|
||||||
|
margin_left = 809.0
|
||||||
|
margin_right = 851.0
|
||||||
|
margin_bottom = 30.0
|
||||||
|
text = "%d"
|
||||||
|
align = 1
|
||||||
|
|
||||||
|
[node name="Padding2" type="HBoxContainer" parent="Container"]
|
||||||
|
margin_top = 483.0
|
||||||
|
margin_right = 1600.0
|
||||||
|
margin_bottom = 515.0
|
||||||
|
rect_min_size = Vector2( 0, 32 )
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="RoundsLabel" type="Label" parent="Container"]
|
||||||
|
margin_top = 519.0
|
||||||
|
margin_right = 1600.0
|
||||||
|
margin_bottom = 549.0
|
||||||
|
text = "Rounds won:"
|
||||||
|
align = 1
|
||||||
|
|
||||||
|
[node name="Rounds" type="HBoxContainer" parent="Container"]
|
||||||
|
margin_top = 553.0
|
||||||
|
margin_right = 1600.0
|
||||||
|
margin_bottom = 583.0
|
||||||
|
alignment = 1
|
||||||
|
|
||||||
|
[node name="Left" type="Label" parent="Container/Rounds"]
|
||||||
|
self_modulate = Color( 1, 0.701961, 0.701961, 1 )
|
||||||
|
margin_left = 748.0
|
||||||
|
margin_right = 790.0
|
||||||
|
margin_bottom = 30.0
|
||||||
|
text = "%d"
|
||||||
|
align = 1
|
||||||
|
|
||||||
|
[node name="Dash" type="Label" parent="Container/Rounds"]
|
||||||
|
margin_left = 794.0
|
||||||
|
margin_right = 805.0
|
||||||
|
margin_bottom = 30.0
|
||||||
|
text = "-"
|
||||||
|
align = 1
|
||||||
|
|
||||||
|
[node name="Right" type="Label" parent="Container/Rounds"]
|
||||||
|
self_modulate = Color( 0.7, 0.7, 1, 1 )
|
||||||
|
margin_left = 809.0
|
||||||
|
margin_right = 851.0
|
||||||
|
margin_bottom = 30.0
|
||||||
|
text = "%d"
|
||||||
|
align = 1
|
||||||
|
|
||||||
|
[node name="Timer" type="Timer" parent="."]
|
||||||
|
wait_time = 3.0
|
||||||
|
one_shot = true
|
|
@ -1,21 +1,4 @@
|
||||||
[gd_scene load_steps=5 format=2]
|
[gd_scene format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/music/2-atoms-sine.ogg" type="AudioStream" id=1]
|
|
||||||
[ext_resource path="res://src/music/2-atoms-square.ogg" type="AudioStream" id=2]
|
|
||||||
[ext_resource path="res://src/music/2-atoms-saw.ogg" type="AudioStream" id=3]
|
|
||||||
[ext_resource path="res://src/music/2-atoms-base.ogg" type="AudioStream" id=4]
|
|
||||||
|
|
||||||
[node name="Timer" type="Timer"]
|
[node name="Timer" type="Timer"]
|
||||||
wait_time = 10.0
|
wait_time = 10.0
|
||||||
|
|
||||||
[node name="AudioBase" type="AudioStreamPlayer" parent="."]
|
|
||||||
stream = ExtResource( 4 )
|
|
||||||
|
|
||||||
[node name="AudioSine" type="AudioStreamPlayer" parent="."]
|
|
||||||
stream = ExtResource( 1 )
|
|
||||||
|
|
||||||
[node name="AudioSquare" type="AudioStreamPlayer" parent="."]
|
|
||||||
stream = ExtResource( 2 )
|
|
||||||
|
|
||||||
[node name="AudioSaw" type="AudioStreamPlayer" parent="."]
|
|
||||||
stream = ExtResource( 3 )
|
|
||||||
|
|
|
@ -5,38 +5,53 @@ const COLORS = {
|
||||||
"R": Color.red,
|
"R": Color.red,
|
||||||
"G": Color.green,
|
"G": Color.green,
|
||||||
"B": Color.blue,
|
"B": Color.blue,
|
||||||
|
"Y": Color.yellow,
|
||||||
"C": Color.cyan,
|
"C": Color.cyan,
|
||||||
"M": Color.magenta,
|
"M": Color.magenta,
|
||||||
"Y": Color.yellow,
|
|
||||||
"W": Color.white,
|
"W": Color.white,
|
||||||
"K": Color.black,
|
|
||||||
}
|
}
|
||||||
const ATOM = preload("res://src/scenes/Atom.tscn")
|
const ATOM = preload("res://src/scenes/Atom.tscn")
|
||||||
const TILE_SIZE = 86
|
const TILE_SIZE = 86
|
||||||
|
const TILE_OFFSET = TILE_SIZE / 2
|
||||||
|
|
||||||
|
|
||||||
var shape setget set_shape
|
var shape
|
||||||
var size
|
var size
|
||||||
var atoms = []
|
var atoms = []
|
||||||
|
|
||||||
|
|
||||||
func set_shape(val):
|
var rng
|
||||||
|
|
||||||
|
|
||||||
|
func set_shape(val, sd):
|
||||||
var new_size = len(val)
|
var new_size = len(val)
|
||||||
var rescale_to = clamp(6 / float(new_size), 0, 1)
|
var rescale_to = clamp(6 / float(new_size), 0, 1)
|
||||||
|
|
||||||
clear()
|
clear()
|
||||||
|
for atom in $Atoms.get_children():
|
||||||
|
atom.queue_free()
|
||||||
|
|
||||||
|
rng = RandomNumberGenerator.new()
|
||||||
|
rng.set_seed(sd)
|
||||||
|
|
||||||
atoms = []
|
atoms = []
|
||||||
var y = - (new_size / 2)
|
var offset = new_size / 2
|
||||||
|
var y = - offset
|
||||||
for row in val:
|
for row in val:
|
||||||
var atoms_row = []
|
var atoms_row = []
|
||||||
var x = - (new_size / 2)
|
var x = - offset
|
||||||
for col in row:
|
for col in row:
|
||||||
if col != " ":
|
if col != " ":
|
||||||
set_cell(x, y, 0)
|
set_cell(x, y, 0)
|
||||||
var atom = ATOM.instance()
|
var atom = ATOM.instance()
|
||||||
|
var random_amount = int(col)
|
||||||
|
if random_amount > 0:
|
||||||
|
var keys = COLORS.keys()
|
||||||
|
col = keys[rng.randi() % min(len(keys), random_amount)]
|
||||||
|
val[y+offset][x+offset] = col
|
||||||
atom.self_modulate = COLORS[col]
|
atom.self_modulate = COLORS[col]
|
||||||
atom.position = Vector2(x * TILE_SIZE + TILE_SIZE / 2, y * TILE_SIZE + TILE_SIZE / 2)
|
atom.position = Vector2(x * TILE_SIZE + TILE_OFFSET, y * TILE_SIZE + TILE_OFFSET)
|
||||||
add_child(atom)
|
$Atoms.add_child(atom)
|
||||||
atoms_row.append(atom)
|
atoms_row.append(atom)
|
||||||
else:
|
else:
|
||||||
atoms_row.append(null)
|
atoms_row.append(null)
|
||||||
|
|
|
@ -26,3 +26,5 @@ cell_size = Vector2( 86, 86 )
|
||||||
cell_tile_origin = 1
|
cell_tile_origin = 1
|
||||||
format = 1
|
format = 1
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Atoms" type="Node2D" parent="."]
|
||||||
|
|
BIN
src/sounds/2-atoms-move.ogg
(Stored with Git LFS)
Normal file
BIN
src/sounds/2-atoms-move.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
15
src/sounds/2-atoms-move.ogg.import
Normal file
15
src/sounds/2-atoms-move.ogg.import
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="ogg_vorbis"
|
||||||
|
type="AudioStreamOGGVorbis"
|
||||||
|
path="res://.import/2-atoms-move.ogg-9aff9ecc31b438bca63464d86950467a.oggstr"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://src/sounds/2-atoms-move.ogg"
|
||||||
|
dest_files=[ "res://.import/2-atoms-move.ogg-9aff9ecc31b438bca63464d86950467a.oggstr" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
BIN
src/sounds/2-atoms-ok.ogg
(Stored with Git LFS)
Normal file
BIN
src/sounds/2-atoms-ok.ogg
(Stored with Git LFS)
Normal file
Binary file not shown.
15
src/sounds/2-atoms-ok.ogg.import
Normal file
15
src/sounds/2-atoms-ok.ogg.import
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="ogg_vorbis"
|
||||||
|
type="AudioStreamOGGVorbis"
|
||||||
|
path="res://.import/2-atoms-ok.ogg-a135787d3dc656cf002152792228d563.oggstr"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://src/sounds/2-atoms-ok.ogg"
|
||||||
|
dest_files=[ "res://.import/2-atoms-ok.ogg-a135787d3dc656cf002152792228d563.oggstr" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
10
src/themes/main_theme.tres
Normal file
10
src/themes/main_theme.tres
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[gd_resource type="Theme" load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=1]
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFont" id=1]
|
||||||
|
size = 24
|
||||||
|
font_data = ExtResource( 1 )
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
default_font = SubResource( 1 )
|
12
src/themes/results_theme.tres
Normal file
12
src/themes/results_theme.tres
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
[gd_resource type="Theme" load_steps=3 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://src/fonts/Xolonium-Regular.ttf" type="DynamicFontData" id=1]
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFont" id=1]
|
||||||
|
size = 24
|
||||||
|
outline_size = 1
|
||||||
|
outline_color = Color( 0, 0, 0, 1 )
|
||||||
|
font_data = ExtResource( 1 )
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
default_font = SubResource( 1 )
|
Loading…
Reference in a new issue