From 1489d93ae673fd8919680ea74073186c5c6305f7 Mon Sep 17 00:00:00 2001 From: Matt Jenkins Date: Fri, 10 May 2024 20:47:29 +0100 Subject: [PATCH] Added upgrade system --- Alien.gd | 8 +-- ArkaLabel.gd | 1 - Ball/Ball.gd | 29 ++++---- Brick/Brick.gd | 4 +- Bullet.gd | 12 ++-- Dunkanoid.gd | 48 +++++++++---- Dunkanoid.tscn | 48 +++++++++++-- EventBus.gd | 1 + GameOver.tscn | 8 +-- Global.gd | 94 ++++++++++++++++++++++++- Intro.gd | 7 ++ Intro.tscn | 70 +++++++++++++++++-- LevelEditor.tscn | 1 + Levels/BALLOON.json | 27 ++++++++ Levels/CRAWLY.json | 27 ++++++++ Levels/FOCAL POINT.json | 27 ++++++++ Levels/GOOBER.json | 4 +- Levels/GRILLE.json | 27 ++++++++ Levels/KNOT.json | 4 +- Levels/PLATFORM.json | 27 ++++++++ Levels/SANDS OF TIME.json | 27 ++++++++ Levels/SPIDER.json | 27 ++++++++ Levels/SWEET.json | 27 ++++++++ Levels/TENNIS.json | 27 ++++++++ Levels/THOPTER.json | 27 ++++++++ Levels/TIC TAC.json | 27 ++++++++ Levels/TINSEL.json | 27 ++++++++ Levels/WINGS.json | 27 ++++++++ Levels/X-BOX.json | 27 ++++++++ MainTheme.tres | 6 ++ Paddle/Paddle.gd | 10 +-- PermUpgrade/PermUpgrade.gd | 74 ++++++++++++++++++++ PermUpgrade/PermUpgrade.tscn | 83 ++++++++++++++++++++++ Settings.gd | 5 ++ Settings.tscn | 31 ++++++--- Upgrades.gd | 13 ++++ Upgrades.tscn | 130 +++++++++++++++++++++++++++++++++++ project.godot | 2 +- 38 files changed, 993 insertions(+), 78 deletions(-) create mode 100644 Levels/BALLOON.json create mode 100644 Levels/CRAWLY.json create mode 100644 Levels/FOCAL POINT.json create mode 100644 Levels/GRILLE.json create mode 100644 Levels/PLATFORM.json create mode 100644 Levels/SANDS OF TIME.json create mode 100644 Levels/SPIDER.json create mode 100644 Levels/SWEET.json create mode 100644 Levels/TENNIS.json create mode 100644 Levels/THOPTER.json create mode 100644 Levels/TIC TAC.json create mode 100644 Levels/TINSEL.json create mode 100644 Levels/WINGS.json create mode 100644 Levels/X-BOX.json create mode 100644 PermUpgrade/PermUpgrade.gd create mode 100644 PermUpgrade/PermUpgrade.tscn create mode 100644 Upgrades.gd create mode 100644 Upgrades.tscn diff --git a/Alien.gd b/Alien.gd index 18ea701..a57595d 100644 --- a/Alien.gd +++ b/Alien.gd @@ -2,7 +2,7 @@ extends CharacterBody2D class_name Alien -signal alien_died(value : int) +signal alien_died(alien : Node2D, value : int) @export var hits : int = 5 @export var points : int = 500 @@ -21,10 +21,10 @@ func _physics_process(delta: float) -> void: else: move_and_slide() -func hit() -> void: - hits -= 1 +func hit(power : int) -> void: + hits -= power if hits <= 0: - alien_died.emit(points) + alien_died.emit(self, points) get_parent().call_deferred("remove_child", self) call_deferred("queue_free") else: diff --git a/ArkaLabel.gd b/ArkaLabel.gd index 73bd6a5..3031050 100644 --- a/ArkaLabel.gd +++ b/ArkaLabel.gd @@ -14,7 +14,6 @@ func _ready() -> void: func _notification(what: int) -> void: if what == NOTIFICATION_TRANSFORM_CHANGED: var pos = global_position / get_viewport_rect().size - print(pos) material.set_shader_parameter("rect_global_position", pos) material.set_shader_parameter("rect_size", get_rect().size) diff --git a/Ball/Ball.gd b/Ball/Ball.gd index 99180a3..9383853 100644 --- a/Ball/Ball.gd +++ b/Ball/Ball.gd @@ -4,11 +4,11 @@ class_name Ball const MIN_SPEED = 50.0 const MAX_SPEED = 500.0 -signal hit_brick(ball : Node, brick : Node) -signal hit_paddle(ball : Node) -signal hit_floor(ball : Node) -signal hit_wall(ball : Node) -signal hit_alien(ball : Node, alien : Node) +signal hit_brick(ball : Node, brick : Node, power : int) +signal hit_paddle(ball : Node, power : int) +signal hit_floor(ball : Node, power : int) +signal hit_wall(ball : Node, power : int) +signal hit_alien(ball : Node, alien : Node, power : int) var captured : bool = false var capture_object : Node2D @@ -31,7 +31,8 @@ func _physics_process(_delta: float) -> void: else: if linear_velocity.length() != speed: linear_velocity = linear_velocity.normalized() * speed - + if linear_velocity == Vector2.ZERO: + linear_velocity = Vector2(randf() - 0.5, randf() - 0.5).normalized() * speed @@ -52,23 +53,23 @@ func release() -> void: func _on_body_exited(body: Node) -> void: if body is Alien: - body.hit() - hit_alien.emit(self, body) + body.hit(1) + hit_alien.emit(self, body, 1) return if body is Brick: if not body.visible: return $BrickSound.play() - body.hit() - hit_brick.emit(self, body) + body.hit(1) + hit_brick.emit(self, body, 1) speed += 1 return if body is Paddle: var diff = (position.x - body.position.x) / (body.width/2) linear_velocity = (Vector2(diff, -1).normalized()) * speed $PaddleSound.play() - body.hit() - hit_paddle.emit(self) + body.hit(1) + hit_paddle.emit(self, 1) return if body is Wall: if abs(linear_velocity.y) < 0.01: @@ -76,10 +77,10 @@ func _on_body_exited(body: Node) -> void: elif abs(linear_velocity.y) < 1: linear_velocity.y *= 10.0 $WallSound.play() - hit_wall.emit(self) + hit_wall.emit(self, 1) return if body is Floor: - hit_floor.emit(self) + hit_floor.emit(self, 1) return func slowdown() -> void: diff --git a/Brick/Brick.gd b/Brick/Brick.gd index 7865a1a..911ca7b 100644 --- a/Brick/Brick.gd +++ b/Brick/Brick.gd @@ -22,10 +22,10 @@ func _ready() -> void: func _process(_delta) -> void: pass -func hit() -> void: +func hit(power : int) -> void: if hits <= 0: return - hits -= 1 + hits -= power if hits <= 0: collision_layer = 0 if my_type == INVULNERABLE: diff --git a/Bullet.gd b/Bullet.gd index 8a6358f..2ed0c82 100644 --- a/Bullet.gd +++ b/Bullet.gd @@ -1,20 +1,20 @@ extends RigidBody2D -signal hit_brick(brick : Node2D) -signal hit_alien(alien : Node2D) -signal hit_wall(wall : Node2D) +signal hit_brick(brick : Node2D, power : int) +signal hit_alien(alien : Node2D, power : int) +signal hit_wall(wall : Node2D, power : int) func _on_body_entered(body: Node) -> void: if body is Brick: if body.visible: - hit_brick.emit(body) + hit_brick.emit(body, Global.get_laser_power()) get_parent().call_deferred("remove_child", self) call_deferred("queue_free") if body is Alien: - hit_alien.emit(body) + hit_alien.emit(body, Global.get_laser_power()) get_parent().call_deferred("remove_child", self) call_deferred("queue_free") if body is Wall: - hit_wall.emit(body) + hit_wall.emit(body, Global.get_laser_power()) get_parent().call_deferred("remove_child", self) call_deferred("queue_free") diff --git a/Dunkanoid.gd b/Dunkanoid.gd index c8580d9..1ecc3b1 100644 --- a/Dunkanoid.gd +++ b/Dunkanoid.gd @@ -5,6 +5,7 @@ var _Ball = preload("res://Ball/Ball.tscn") var _Upgrade = preload("res://Upgrade/Upgrade.tscn") var _Alien = preload("res://Alien.tscn") var _Bullet = preload("res://Bullet.tscn") +var _Coin = preload("res://Coin/Coin.tscn") @onready var ScoreNode = $ScoreCard/Score/ScoreBox @onready var LivesNode = $ScoreCard/Lives/LivesBox @@ -25,6 +26,8 @@ var _Bullet = preload("res://Bullet.tscn") @onready var FloorSoundNode = $Sounds/FloorSound @onready var UpgradeSoundNode = $Sounds/UpgradeCollected @onready var AlienDieSoundNode = $Sounds/AlienDie +@onready var CoinCollectedSoundNode = $Sounds/CoinCollected +@onready var TokenLabelNode = $Tokens/TokenLabel var bricks : Array = [] var balls : Array[Node] = [] @@ -56,6 +59,9 @@ var time_run : bool = false func _ready() -> void: level = Global.start_level + lives = Global.get_lives() + TokenLabelNode.text = "%d" % Global.upgrade_tokens + EventBus.upgrade_tokens_updated.connect(_on_upgrade_tokens_updated) if Global.relative_mouse: Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) @@ -165,7 +171,7 @@ func new_level() -> void: func _brick_destroyed(brick) -> void: Global.score += brick.value - if randf() > 0.9: + if randf() >= Global.get_powerup_percent(): var upgrade = _Upgrade.instantiate() upgrade.position = brick.position upgrade.upgrade_collected.connect(_on_upgrade_collected) @@ -173,7 +179,7 @@ func _brick_destroyed(brick) -> void: 0: upgrade.set_upgrade("C", Color.BLUE) 1: - upgrade.set_upgrade("T", Color.GREEN) + upgrade.set_upgrade("D", Color.GREEN) 2: upgrade.set_upgrade("S", Color.CYAN) 3: @@ -254,12 +260,12 @@ func _input(event: InputEvent) -> void: if (ball.captured): ball.release() -func _on_hit_paddle(ball) -> void: +func _on_hit_paddle(ball, _power) -> void: if PaddleNode.is_capture(): var diff = PaddleNode.global_position.x - ball.global_position.x ball.capture(PaddleNode, Vector2(diff, 8)) -func _on_hit_floor(ball) -> void: +func _on_hit_floor(ball, _power) -> void: FloorSoundNode.play() balls.erase(ball) call_deferred("remove_child", ball) @@ -274,7 +280,7 @@ func _on_hit_floor(ball) -> void: ball.capture(PaddleNode, Vector2((randf() * 32) - 16, 8)) ball.hit_paddle.connect(_on_hit_paddle) ball.hit_floor.connect(_on_hit_floor) - add_child(ball) + call_deferred("add_child", ball) balls.push_back(ball) Music.jingle_finished.connect(_on_start_round_finished) Music.jingle(Music.JINGLE_LEVEL_START) @@ -298,9 +304,9 @@ func _on_upgrade_collected(code : String) -> void: match code: "C": PaddleNode.capture() - "T": - add_ball() - add_ball() + "D": + for i in Global.get_num_balls() - 1: + add_ball() "S": for ball in balls: ball.slowdown() @@ -396,7 +402,7 @@ func start_powerball() -> void: ball.enable_sparkles() for brick in BricksNode.get_children(): brick.enable_pass() - PowerballTimerNode.start(10) + PowerballTimerNode.start(Global.get_effect_time()) func stop_powerball() -> void: for ball in balls: @@ -441,10 +447,15 @@ func _close_top_right() -> void: func _on_alien_timer_timeout() -> void: spawn_alien() -func _alien_died(points : int) -> void: +func _alien_died(alien : Node2D, points : int) -> void: + var pos : Vector2 = alien.global_position Global.score += points AlienDieSoundNode.play() - + var coin = _Coin.instantiate() + coin.global_position = pos + coin.coin_collected.connect(_on_coin_collected) + call_deferred("add_child", coin) + func fire_bullet() -> void: var bullet = _Bullet.instantiate() bullet.global_position = PaddleNode.global_position - Vector2(0, 8) @@ -453,8 +464,15 @@ func fire_bullet() -> void: add_child(bullet) bullet.linear_velocity = Vector2(0, -500) -func _on_bullet_hit_brick(node) -> void: - node.hit() +func _on_bullet_hit_brick(node, power) -> void: + node.hit(power) -func _on_bullet_hit_alien(node) -> void: - node.hit() +func _on_bullet_hit_alien(node, power) -> void: + node.hit(power) + +func _on_coin_collected() -> void: + CoinCollectedSoundNode.play() + Global.upgrade_tokens += 1 + +func _on_upgrade_tokens_updated(qty : int) -> void: + TokenLabelNode.text = "%d" % qty diff --git a/Dunkanoid.tscn b/Dunkanoid.tscn index 8c5b26f..819d288 100644 --- a/Dunkanoid.tscn +++ b/Dunkanoid.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=31 format=3 uid="uid://4q0epdnb0x4s"] +[gd_scene load_steps=33 format=3 uid="uid://4q0epdnb0x4s"] [ext_resource type="Script" path="res://Dunkanoid.gd" id="1_kv4if"] [ext_resource type="PackedScene" uid="uid://dndemjw7up2r6" path="res://Paddle/Paddle.tscn" id="2_26c5i"] @@ -9,6 +9,7 @@ [ext_resource type="PhysicsMaterial" uid="uid://cql6t5hd40fgn" path="res://CorePhysics.tres" id="7_300m5"] [ext_resource type="AudioStream" uid="uid://bojc0es7165ed" path="res://Sounds/Collected.wav" id="8_fpbsr"] [ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="8_wcf7g"] +[ext_resource type="AudioStream" uid="uid://b6vosap1la1ts" path="res://Sounds/BrickHit.wav" id="9_3ju8x"] [ext_resource type="AudioStream" uid="uid://cpf0y72o6wrv2" path="res://Sounds/AlienDie.wav" id="9_lt28f"] [ext_resource type="Script" path="res://Paused.gd" id="12_8qv0d"] [ext_resource type="Shader" path="res://Arkanoid.gdshader" id="12_ljnes"] @@ -24,6 +25,7 @@ [ext_resource type="Texture2D" uid="uid://1ar54kb0l0sm" path="res://Pipes/vPipeEndHigh.png" id="19_6cngp"] [ext_resource type="Texture2D" uid="uid://bj28rs6816gn8" path="res://Pipes/hPipeEndLeft.png" id="20_fr68l"] [ext_resource type="Texture2D" uid="uid://dnm2slmsm5wnw" path="res://Pipes/hPipeEndRight.png" id="21_hha8q"] +[ext_resource type="SpriteFrames" uid="uid://c6wwkgmwfpdu7" path="res://Coin/Coin.tres" id="26_ahhyt"] [sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_jsudl"] normal = Vector2(0, 1) @@ -40,13 +42,13 @@ distance = -432.0 [sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_48dqy"] distance = -360.0 -[sub_resource type="ShaderMaterial" id="ShaderMaterial_xvkhj"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_acp7s"] shader = ExtResource("12_ljnes") -shader_parameter/rect_global_position = Vector2(0, 0.30621) -shader_parameter/rect_size = Vector2(448, 25) +shader_parameter/rect_global_position = Vector2(0, 0) +shader_parameter/rect_size = Vector2(150, 25) shader_parameter/ColourTexture = ExtResource("13_u52d1") -[sub_resource type="ShaderMaterial" id="ShaderMaterial_j13aj"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_cxvt8"] shader = ExtResource("12_ljnes") shader_parameter/rect_global_position = Vector2(0, 0) shader_parameter/rect_size = Vector2(89, 25) @@ -103,6 +105,10 @@ bus = &"Effects" stream = ExtResource("8_fpbsr") bus = &"Effects" +[node name="CoinCollected" type="AudioStreamPlayer" parent="Sounds"] +stream = ExtResource("9_3ju8x") +bus = &"Effects" + [node name="AlienDie" type="AudioStreamPlayer" parent="Sounds"] stream = ExtResource("9_lt28f") bus = &"Effects" @@ -316,7 +322,7 @@ theme_type_variation = &"RoundStart" layout_mode = 2 [node name="Title" type="Label" parent="Start/VBoxContainer/PanelContainer/VBoxContainer"] -material = SubResource("ShaderMaterial_xvkhj") +material = SubResource("ShaderMaterial_acp7s") layout_mode = 2 theme = ExtResource("8_wcf7g") theme_type_variation = &"Arkanoid" @@ -364,7 +370,7 @@ size_flags_vertical = 3 theme = ExtResource("8_wcf7g") [node name="Label" type="Label" parent="Paused/VBoxContainer"] -material = SubResource("ShaderMaterial_j13aj") +material = SubResource("ShaderMaterial_cxvt8") layout_mode = 2 theme = ExtResource("8_wcf7g") theme_type_variation = &"Arkanoid" @@ -572,6 +578,34 @@ texture = ExtResource("21_hha8q") wait_time = 30.0 autostart = true +[node name="Tokens" type="HBoxContainer" parent="."] +offset_left = 18.0 +offset_top = 18.0 +offset_right = 624.0 +offset_bottom = 38.0 +size_flags_horizontal = 3 + +[node name="HSeparator" type="HSeparator" parent="Tokens"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("8_wcf7g") + +[node name="TokenLabel" type="Label" parent="Tokens"] +layout_mode = 2 +theme = ExtResource("8_wcf7g") +text = "23" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="MarginContainer" type="MarginContainer" parent="Tokens"] +custom_minimum_size = Vector2(16, 0) +layout_mode = 2 + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="Tokens/MarginContainer"] +sprite_frames = ExtResource("26_ahhyt") +autoplay = "default" +centered = false + [connection signal="update_lives" from="." to="." method="_on_update_lives"] [connection signal="effect_finished" from="Paddle" to="." method="_on_paddle_effect_finished"] [connection signal="pressed" from="Paused/VBoxContainer/HBoxContainer/Quit" to="Paused" method="_on_quit_pressed"] diff --git a/EventBus.gd b/EventBus.gd index e53ef8a..089e5b3 100644 --- a/EventBus.gd +++ b/EventBus.gd @@ -4,3 +4,4 @@ signal update_score(score : int) signal update_highscore(score : int) signal paused signal unpaused +signal upgrade_tokens_updated(tokens : int) diff --git a/GameOver.tscn b/GameOver.tscn index 6bad041..8ca39d2 100644 --- a/GameOver.tscn +++ b/GameOver.tscn @@ -6,10 +6,10 @@ [ext_resource type="Texture2D" uid="uid://b56kjbt4ub52n" path="res://NoidTex.png" id="4_lxs2b"] [ext_resource type="Script" path="res://ArkaLabel.gd" id="5_g14o8"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_qq8am"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ne3hd"] shader = ExtResource("3_u76hk") -shader_parameter/rect_global_position = Vector2(0, 0.205567) -shader_parameter/rect_size = Vector2(640, 25) +shader_parameter/rect_global_position = Vector2(0, 0) +shader_parameter/rect_size = Vector2(160, 25) shader_parameter/ColourTexture = ExtResource("4_lxs2b") [node name="GameOver" type="Node2D"] @@ -31,7 +31,7 @@ size_flags_vertical = 3 theme = ExtResource("3_km2fx") [node name="GameOver" type="Label" parent="VBoxContainer"] -material = SubResource("ShaderMaterial_qq8am") +material = SubResource("ShaderMaterial_ne3hd") layout_mode = 2 theme = ExtResource("3_km2fx") theme_type_variation = &"Arkanoid" diff --git a/Global.gd b/Global.gd index 3f69dc3..712b64d 100644 --- a/Global.gd +++ b/Global.gd @@ -34,8 +34,41 @@ var effects_volume : int : var best_times : Dictionary -var start_level : String = "DUNKANOID" +var upgrade_tokens : int = 0 : + set(x): + upgrade_tokens = x + EventBus.upgrade_tokens_updated.emit(upgrade_tokens) + _save() +var effect_time : int = 0 : + set(x): + effect_time = x + _save() + +var laser_power : int = 0 : + set(x): + laser_power = x + _save() + +var extra_lives : int = 0 : + set(x): + extra_lives = x + _save() + +var powerup_percent : int = 0 : + set(x): + powerup_percent = x + _save() + +var ball_split : int = 0 : + set(x): + ball_split = x + _save() + + + + +var start_level : String = "DUNKANOID" var _loading : bool = false func _ready() -> void: @@ -47,12 +80,25 @@ func _ready() -> void: music_volume = data.get("music_volume", AudioServer.get_bus_volume_db(1)) effects_volume = data.get("effects_volume", AudioServer.get_bus_volume_db(2)) best_times = data.get("best_times", {}) + upgrade_tokens = data.get("upgrade_tokens", 0) + effect_time = data.get("effect_time", 0) + laser_power = data.get("laser_power", 0) + extra_lives = data.get("extra_lives", 0) + powerup_percent = data.get("powerup_percent", 0) + ball_split = data.get("ball_split", 0) else: highscore = 0 relative_mouse = true music_volume = int(AudioServer.get_bus_volume_db(1)) effects_volume = int(AudioServer.get_bus_volume_db(2)) best_times = {} + upgrade_tokens = 0 + effect_time = 0 + laser_power = 0 + extra_lives = 0 + powerup_percent = 0 + ball_split = 0 + _loading = false func _save() -> void: @@ -63,7 +109,13 @@ func _save() -> void: "relative_mouse": relative_mouse, "music_volume": music_volume, "effects_volume": effects_volume, - "best_times": best_times + "best_times": best_times, + "upgrade_tokens": upgrade_tokens, + "effect_time": effect_time, + "laser_power": laser_power, + "extra_lives": extra_lives, + "powerup_percent": powerup_percent, + "ball_split": ball_split } var f = FileAccess.open("user://data.json", FileAccess.WRITE) f.store_string(JSON.stringify(data)) @@ -75,3 +127,41 @@ func get_best_time(level : String) -> int: func set_best_time(level : String, time : int) -> void: best_times[level] = time _save() + +func reset_best_times() -> void: + best_times.clear() + _save() + + +func get_effect_time() -> int: + return 5 + (effect_time * 5) + +func get_laser_power() -> int: + return laser_power + 1 + +func get_lives() -> int: + return extra_lives + 3 + +func get_powerup_percent() -> float: + return 0.98 - (powerup_percent * 0.02) + +func get_num_balls() -> int: + return ball_split + 2 + +func format_effect_time() -> String: + return "%d s" % get_effect_time() + +func format_laser_power() -> String: + var p = get_laser_power() + if p == 1: + return "1 hit" + return "%d hits" % p + +func format_extra_lives() -> String: + return "%d lives" % get_lives() + +func format_powerup_percent() -> String: + return "%d%%" % int((1 - get_powerup_percent()) * 100) + +func format_ball_split() -> String: + return "%d balls" % get_num_balls() diff --git a/Intro.gd b/Intro.gd index de77954..c0a107d 100644 --- a/Intro.gd +++ b/Intro.gd @@ -1,5 +1,7 @@ extends Node2D +@onready var UpgradeTokensNode = $HBoxContainer2/Label + const credits = [ ["Design", "Majenko"], ["Programming", "Majenko"], @@ -12,6 +14,7 @@ var credit : int = 0 func _ready() -> void: # dump_all("res://") + UpgradeTokensNode.text = "%d" % Global.upgrade_tokens Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) EventBus.update_score.connect(_on_update_score) EventBus.update_highscore.connect(_on_update_highscore) @@ -84,3 +87,7 @@ func _on_play_level_pressed() -> void: func _on_load_panel_load_level(level_name: String) -> void: Global.start_level = level_name get_tree().change_scene_to_file("res://Dunkanoid.tscn") + + +func _on_upgrades_pressed() -> void: + get_tree().change_scene_to_file("res://Upgrades.tscn") diff --git a/Intro.tscn b/Intro.tscn index ace58b6..7d6e49a 100644 --- a/Intro.tscn +++ b/Intro.tscn @@ -1,11 +1,13 @@ -[gd_scene load_steps=9 format=3 uid="uid://c2oboya05agti"] +[gd_scene load_steps=13 format=3 uid="uid://c2oboya05agti"] [ext_resource type="Script" path="res://Intro.gd" id="1_1hnh1"] -[ext_resource type="Material" uid="uid://bv4vhjg83fqpn" path="res://ArkanoidMaterial.tres" id="2_a44d8"] [ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="3_8d2ix"] [ext_resource type="Script" path="res://ArkaLabel.gd" id="3_dqq2b"] +[ext_resource type="Shader" path="res://Arkanoid.gdshader" id="3_eo4f3"] [ext_resource type="Script" path="res://ExitButton.gd" id="4_ty0na"] +[ext_resource type="Texture2D" uid="uid://b56kjbt4ub52n" path="res://NoidTex.png" id="4_v8i0c"] [ext_resource type="PackedScene" uid="uid://deyotp28r4uwj" path="res://LoadPanel.tscn" id="5_esv62"] +[ext_resource type="SpriteFrames" uid="uid://c6wwkgmwfpdu7" path="res://Coin/Coin.tres" id="7_2tpc7"] [sub_resource type="Curve" id="Curve_jhhjd"] min_value = -200.0 @@ -16,6 +18,18 @@ point_count = 2 [sub_resource type="Gradient" id="Gradient_431mb"] colors = PackedColorArray(0, 0, 0, 0, 1, 1, 1, 1) +[sub_resource type="ShaderMaterial" id="ShaderMaterial_4ciis"] +shader = ExtResource("3_eo4f3") +shader_parameter/rect_global_position = Vector2(0, 0) +shader_parameter/rect_size = Vector2(150, 25) +shader_parameter/ColourTexture = ExtResource("4_v8i0c") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_5ug7r"] +shader = ExtResource("3_eo4f3") +shader_parameter/rect_global_position = Vector2(0, 0) +shader_parameter/rect_size = Vector2(242, 25) +shader_parameter/ColourTexture = ExtResource("4_v8i0c") + [node name="Intro" type="Node2D"] script = ExtResource("1_1hnh1") @@ -54,7 +68,7 @@ size_flags_horizontal = 3 theme = ExtResource("3_8d2ix") [node name="ArkaLabel" type="Label" parent="VBoxContainer/HBoxContainer"] -material = ExtResource("2_a44d8") +material = SubResource("ShaderMaterial_4ciis") layout_mode = 2 theme = ExtResource("3_8d2ix") theme_type_variation = &"Arkanoid" @@ -75,7 +89,7 @@ size_flags_horizontal = 3 theme = ExtResource("3_8d2ix") [node name="Revenge" type="Label" parent="VBoxContainer/HBoxContainer2"] -material = ExtResource("2_a44d8") +material = SubResource("ShaderMaterial_5ug7r") layout_mode = 2 theme = ExtResource("3_8d2ix") theme_type_variation = &"Arkanoid" @@ -130,6 +144,25 @@ layout_mode = 2 size_flags_horizontal = 3 theme = ExtResource("3_8d2ix") +[node name="Upgrades" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/Upgrades"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("3_8d2ix") + +[node name="Upgrades" type="Button" parent="VBoxContainer/Upgrades"] +layout_mode = 2 +theme = ExtResource("3_8d2ix") +text = "UPGRADES" +icon_alignment = 1 + +[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/Upgrades"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("3_8d2ix") + [node name="LevelEditor" type="HBoxContainer" parent="VBoxContainer"] layout_mode = 2 @@ -248,6 +281,34 @@ text = "00000000" horizontal_alignment = 2 vertical_alignment = 1 +[node name="HBoxContainer2" type="HBoxContainer" parent="."] +offset_left = 18.0 +offset_top = 18.0 +offset_right = 624.0 +offset_bottom = 38.0 +size_flags_horizontal = 3 + +[node name="HSeparator" type="HSeparator" parent="HBoxContainer2"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("3_8d2ix") + +[node name="Label" type="Label" parent="HBoxContainer2"] +layout_mode = 2 +theme = ExtResource("3_8d2ix") +text = "23" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="MarginContainer" type="MarginContainer" parent="HBoxContainer2"] +custom_minimum_size = Vector2(16, 0) +layout_mode = 2 + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="HBoxContainer2/MarginContainer"] +sprite_frames = ExtResource("7_2tpc7") +autoplay = "default" +centered = false + [node name="LoadPanel" parent="." instance=ExtResource("5_esv62")] offset_left = 239.0 offset_top = 116.0 @@ -256,6 +317,7 @@ offset_bottom = 297.0 [connection signal="pressed" from="VBoxContainer/Play/Play" to="." method="_on_button_pressed"] [connection signal="pressed" from="VBoxContainer/PlayLevel/PlayLevel" to="." method="_on_play_level_pressed"] +[connection signal="pressed" from="VBoxContainer/Upgrades/Upgrades" to="." method="_on_upgrades_pressed"] [connection signal="pressed" from="VBoxContainer/LevelEditor/Editor" to="." method="_on_editor_pressed"] [connection signal="pressed" from="VBoxContainer/Settings/Settings" to="." method="_on_settings_pressed"] [connection signal="pressed" from="VBoxContainer/ExitButton/Exit" to="." method="_on_exit_pressed"] diff --git a/LevelEditor.tscn b/LevelEditor.tscn index 74b5819..6d9eb01 100644 --- a/LevelEditor.tscn +++ b/LevelEditor.tscn @@ -2146,6 +2146,7 @@ text = "CANCEL" [connection signal="pressed" from="VBoxContainer/HBoxContainer3/Export" to="." method="_on_export_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer2/New" to="." method="_on_new_pressed"] [connection signal="pressed" from="VBoxContainer/HBoxContainer2/Exit" to="." method="_on_exit_pressed"] +[connection signal="load_file" from="LoadPanel" to="." method="_on_load_panel_load_file"] [connection signal="pressed" from="ExportPanel/VBoxContainer/Close" to="ExportPanel" method="_on_close_pressed"] [connection signal="object_imported" from="ImportPanel" to="." method="_on_import_panel_object_imported"] [connection signal="pressed" from="ImportPanel/VBoxContainer/HBoxContainer/Import" to="ImportPanel" method="_on_import_pressed"] diff --git a/Levels/BALLOON.json b/Levels/BALLOON.json new file mode 100644 index 0000000..58290bc --- /dev/null +++ b/Levels/BALLOON.json @@ -0,0 +1,27 @@ +{ + "background": "BlueBlobs", + "data": [ + " ", + " BWR ", + " BBWRR ", + " GBWWWRY ", + " GBWWWRY ", + " GBBWWWRRY ", + " GBBWWWRRY ", + " GBBWWWRRY ", + " GBBWWWRRY ", + " GBWWWRY ", + " GBWWWRY ", + " sBBWRRs ", + " s BWR s ", + " s s s ", + " s s s ", + " ggg ", + " ggg ", + " ggg " + ], + "left": "TIC TAC", + "name": "BALLOON", + "right": "X-BOX", + "tint": "FFFFFF" +} \ No newline at end of file diff --git a/Levels/CRAWLY.json b/Levels/CRAWLY.json new file mode 100644 index 0000000..f0e1aaa --- /dev/null +++ b/Levels/CRAWLY.json @@ -0,0 +1,27 @@ +{ + "background": "BlueBlobs", + "data": [ + " ", + " ", + " gg gg ", + " g g ", + " CCC ", + " CCCCC ", + " CCGCC ", + " ggggYYYgggg ", + "g GGGGG g", + " YYY ", + " gggGGGggg ", + " g YYYYY g ", + " GGG ", + " ggYYYgg ", + " g GGG g ", + " G ", + " gg gg ", + " g g " + ], + "left": "GRILLE", + "name": "CRAWLY", + "right": "THOPTER", + "tint": "FFFFFF" +} \ No newline at end of file diff --git a/Levels/FOCAL POINT.json b/Levels/FOCAL POINT.json new file mode 100644 index 0000000..ab76449 --- /dev/null +++ b/Levels/FOCAL POINT.json @@ -0,0 +1,27 @@ +{ + "background": "Pipes", + "data": [ + " ", + " ", + " OORRRRRRROO ", + " OORRRRROO ", + " OORRROO ", + "C OOROO C", + "CC OOO CC", + "BCC O CCB", + "BBCC CCBB", + "BBBCC i CCBBB", + "BBCC CCBB", + "BCC O CCB", + "CC OOO CC", + "C OOROO C", + " OORRROO ", + " OORRRRROO ", + " OORRRRRRROO ", + "isssssgsssssi" + ], + "left": "TENNIS", + "name": "FOCAL POINT", + "right": "BALLOON", + "tint": "0000FF" +} \ No newline at end of file diff --git a/Levels/GOOBER.json b/Levels/GOOBER.json index e52f1cf..7d16d20 100644 --- a/Levels/GOOBER.json +++ b/Levels/GOOBER.json @@ -20,8 +20,8 @@ " RYR ", " " ], - "left": "DUNKANOID", + "left": "CRAWLY", "name": "GOOBER", - "right": "DUNKANOID", + "right": "TINSEL", "tint": "4444CC" } \ No newline at end of file diff --git a/Levels/GRILLE.json b/Levels/GRILLE.json new file mode 100644 index 0000000..1cec273 --- /dev/null +++ b/Levels/GRILLE.json @@ -0,0 +1,27 @@ +{ + "background": "RedBoxes", + "data": [ + " ", + " ", + " ", + " ", + " ", + " OOsssssssOO ", + "BYYCCCCCCCYYB", + "WWWWWWWWWWWWW", + "BYYWWWWWWWYYB", + "COOCCCCCCCOOC", + "CRRsssssssRRC", + "CRRsssssssRRC", + " RRsssssssRR ", + " ", + " ", + " ", + " ", + " " + ], + "left": "SWEET", + "name": "GRILLE", + "right": "PLATFORM", + "tint": "00FF00" +} \ No newline at end of file diff --git a/Levels/KNOT.json b/Levels/KNOT.json index 65133df..936da61 100644 --- a/Levels/KNOT.json +++ b/Levels/KNOT.json @@ -20,8 +20,8 @@ " ", " " ], - "left": "DUNKANOID", + "left": "CRAWLY", "name": "KNOT", - "right": "DUNKANOID", + "right": "TINSEL", "tint": "4444CC" } \ No newline at end of file diff --git a/Levels/PLATFORM.json b/Levels/PLATFORM.json new file mode 100644 index 0000000..de2ea6f --- /dev/null +++ b/Levels/PLATFORM.json @@ -0,0 +1,27 @@ +{ + "background": "RedBoxes", + "data": [ + " ", + " ", + " ", + " ", + "ggggggggggggg", + " Y g M g Y ", + " gW g g Wg ", + " g g g g ", + " g gR Bg g ", + " g g g g ", + " g Og gO g ", + " g g g g ", + " g g g g ", + " g g G g g ", + " g g g g ", + " gC Cg ", + " g Y g ", + " ggggggggggg " + ], + "left": "FOCAL POINT", + "name": "PLATFORM", + "right": "SANDS OF TIME", + "tint": "FFFFFF" +} \ No newline at end of file diff --git a/Levels/SANDS OF TIME.json b/Levels/SANDS OF TIME.json new file mode 100644 index 0000000..6dbeece --- /dev/null +++ b/Levels/SANDS OF TIME.json @@ -0,0 +1,27 @@ +{ + "background": "Pipes", + "data": [ + " ", + " ", + "W W", + "CW WC", + "MCW WCM", + "RRCW WCRR", + "OOOCW WCOOO", + "YYYYCW WCYYYY", + "ggggggWgggggg", + " W ", + " W ", + " W ", + " g W g ", + " ggCCCgg ", + " gCCCCCg ", + " gBBBBBg ", + " ggggggg ", + " " + ], + "left": "TENNIS", + "name": "SANDS OF TIME", + "right": "BALLOON", + "tint": "0000FF" +} \ No newline at end of file diff --git a/Levels/SPIDER.json b/Levels/SPIDER.json new file mode 100644 index 0000000..cf61d41 --- /dev/null +++ b/Levels/SPIDER.json @@ -0,0 +1,27 @@ +{ + "background": "RedBoxes", + "data": [ + " ", + " ", + " ", + " ", + " gsssg ", + " gYYYYYg ", + "O gYYYYYYYg O", + "O gYYYYYYYg O", + "O gYYYYYYYg O", + "O gYYYYYYYg O", + "O gsgYYYgsg O", + "O g CgggC g O", + "O g C B C g O", + "O g C B C g O", + "O g C B C g O", + "OgggC B CgggO", + " ", + " " + ], + "left": "DUNKANOID", + "name": "SPIDER", + "right": "DUNKANOID", + "tint": "FFFFFF" +} \ No newline at end of file diff --git a/Levels/SWEET.json b/Levels/SWEET.json new file mode 100644 index 0000000..95a3e5d --- /dev/null +++ b/Levels/SWEET.json @@ -0,0 +1,27 @@ +{ + "background": "RedBoxes", + "data": [ + " ", + " C C ", + " R g g R ", + " g g ", + " RR ", + " RWRR ", + " G RRRR G ", + " g RRRRCC g ", + " RRRRCCC ", + " RRCCCC ", + " GGGCCCC ", + " G GGGCCCC G ", + " g GGGGCC g ", + " GGGG ", + " GG ", + " R R ", + " g C C g ", + " g g " + ], + "left": "FOCAL POINT", + "name": "SWEET", + "right": "SANDS OF TIME", + "tint": "FFFFFF" +} \ No newline at end of file diff --git a/Levels/TENNIS.json b/Levels/TENNIS.json new file mode 100644 index 0000000..1f47678 --- /dev/null +++ b/Levels/TENNIS.json @@ -0,0 +1,27 @@ +{ + "background": "BlueBlobs", + "data": [ + " ", + " ", + " sss ", + " sB Bs ", + " sCCCCCs ", + " s B B s ", + " sCCCCCs ", + " s B B s ", + " sCCCCCs ", + " sB Bs ", + " sss ", + " s ", + " s gg ", + " s gggg ", + " g gggg ", + " g gggg ", + " g gggg ", + " g gg " + ], + "left": "TIC TAC", + "name": "TENNIS", + "right": "X-BOX", + "tint": "FFFFFF" +} \ No newline at end of file diff --git a/Levels/THOPTER.json b/Levels/THOPTER.json new file mode 100644 index 0000000..bf96e67 --- /dev/null +++ b/Levels/THOPTER.json @@ -0,0 +1,27 @@ +{ + "background": "RedBoxes", + "data": [ + " R ", + " s ", + " R ", + " s ", + " R ", + " R ", + " R ", + " R ", + " R ", + " RRRRgRgRRRR ", + "sssssRRRsssss", + " gRg ", + "RRRRRRRRRRRRR", + "sssssgRgsssss", + " R ", + " gg gg ", + " gg gg ", + " gg gg " + ], + "left": "SWEET", + "name": "THOPTER", + "right": "PLATFORM", + "tint": "00FF00" +} \ No newline at end of file diff --git a/Levels/TIC TAC.json b/Levels/TIC TAC.json new file mode 100644 index 0000000..87964af --- /dev/null +++ b/Levels/TIC TAC.json @@ -0,0 +1,27 @@ +{ + "background": "RedBoxes", + "data": [ + " ", + " ", + " sss sss sss ", + " sMs sYs sBs ", + " sMs sYs sBs ", + " sss sss sss ", + " g g ", + " sss ggg sss ", + " sCs sRs sGs ", + " sCs sRs sGs ", + " sss ggg sss ", + "g g", + " gsg sss gsg ", + " gOg sWs gOg ", + " gOg sWs gOg ", + " gsg sss gsg ", + " ", + " " + ], + "left": "WINGS", + "name": "TIC TAC", + "right": "SPIDER", + "tint": "00FF00" +} \ No newline at end of file diff --git a/Levels/TINSEL.json b/Levels/TINSEL.json new file mode 100644 index 0000000..446999e --- /dev/null +++ b/Levels/TINSEL.json @@ -0,0 +1,27 @@ +{ + "background": "BlueBlobs", + "data": [ + " ", + " ", + " g g ", + " gg gg ", + " ggg ggg ", + " gOgg ggBg ", + " gOgggggggBg ", + " g gCgggRg g ", + " g gCgGgRg g ", + " g g gGg g g ", + " g g g g g g ", + " g g g g g g ", + " g g g g g g ", + " g g g g g g ", + " g g g g ", + " g g g g ", + " g g ", + " g g " + ], + "left": "GRILLE", + "name": "TINSEL", + "right": "THOPTER", + "tint": "FFFFFF" +} \ No newline at end of file diff --git a/Levels/WINGS.json b/Levels/WINGS.json new file mode 100644 index 0000000..c7c127f --- /dev/null +++ b/Levels/WINGS.json @@ -0,0 +1,27 @@ +{ + "background": "RedBoxes", + "data": [ + " ", + " ", + " ", + " g g ", + " Rg gR ", + " RGg gGR ", + " RGCg gCGR ", + " RGCOg gOCGR ", + " RGCOWsWOCGR ", + " RGCOW WOCGR ", + " RGCOW WOCGR ", + " gGCOW WOCGg ", + " gCOW WOCg ", + " gOW WOg ", + " gW Wg ", + " gig ", + " ", + " " + ], + "left": "DUNKANOID", + "name": "WINGS", + "right": "DUNKANOID", + "tint": "FFFFFF" +} \ No newline at end of file diff --git a/Levels/X-BOX.json b/Levels/X-BOX.json new file mode 100644 index 0000000..6859463 --- /dev/null +++ b/Levels/X-BOX.json @@ -0,0 +1,27 @@ +{ + "background": "RedBoxes", + "data": [ + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " sssssssssss ", + " ssssg gssss ", + " sG sgsgs Ys ", + " ss sg gs ss ", + " sC sgsgs Ms ", + " ss g ss ", + " sO sgsgs Bs ", + " ss sg gs ss ", + " sW sgsgs Rs ", + " ssssg gssss ", + " sssssssssss " + ], + "left": "WINGS", + "name": "X-BOX", + "right": "SPIDER", + "tint": "00FF00" +} \ No newline at end of file diff --git a/MainTheme.tres b/MainTheme.tres index 4eababa..8bb973e 100644 --- a/MainTheme.tres +++ b/MainTheme.tres @@ -161,12 +161,18 @@ Numbers/styles/normal = SubResource("StyleBoxFlat_8xhb1") PanelContainer/styles/panel = SubResource("StyleBoxFlat_sf0ln") RoundStart/base_type = &"PanelContainer" RoundStart/styles/panel = SubResource("StyleBoxFlat_mruxx") +SmallLabel/base_type = &"Label" +SmallLabel/colors/font_color = Color(1, 1, 1, 1) +SmallLabel/font_sizes/font_size = 16 +SmallLabel/fonts/font = ExtResource("2_7inlg") TextEdit/font_sizes/font_size = 9 TextEdit/fonts/font = ExtResource("4_btndm") Upgrade/base_type = &"Label" Upgrade/colors/font_color = Color(0, 0, 0, 1) Upgrade/font_sizes/font_size = 9 Upgrade/fonts/font = ExtResource("4_btndm") +UpgradePanel/base_type = &"VBoxContainer" +UpgradePanel/constants/separation = 0 UserFile/base_type = &"Button" UserFile/colors/font_color = Color(0.439216, 0.603922, 0.529412, 1) VSeparator/styles/separator = SubResource("StyleBoxEmpty_m7r63") diff --git a/Paddle/Paddle.gd b/Paddle/Paddle.gd index b1f90bb..261dc1a 100644 --- a/Paddle/Paddle.gd +++ b/Paddle/Paddle.gd @@ -19,7 +19,7 @@ var width : int : get: return $CollisionShape2D.shape.height -func hit() -> void: +func hit(_power : int) -> void: pass func _switch_effect(effect : int, time : int = 0) -> void: @@ -51,13 +51,13 @@ func show_paddle(paddle : Node2D) -> void: func big() -> void: show_paddle($Big) $GrowSound.play() - _switch_effect(PADDLE_LARGE, 30) + _switch_effect(PADDLE_LARGE, Global.get_effect_time()) func small() -> void: show_paddle($Small) $CollisionShape2D.shape.height = 24 $ShrinkSound.play() - _switch_effect(PADDLE_SMALL, 30) + _switch_effect(PADDLE_SMALL, Global.get_effect_time()) func normal() -> void: show_paddle($Normal) @@ -67,12 +67,12 @@ func normal() -> void: func laser() -> void: show_paddle($Laser) $CollisionShape2D.shape.height = 32 - _switch_effect(PADDLE_LASER, 15) + _switch_effect(PADDLE_LASER, Global.get_effect_time()) func capture() -> void: show_paddle($Magnet) $CollisionShape2D.shape.height = 32 - _switch_effect(PADDLE_CAPTURE, 15) + _switch_effect(PADDLE_CAPTURE, Global.get_effect_time()) func _on_effect_timer_timeout() -> void: normal() diff --git a/PermUpgrade/PermUpgrade.gd b/PermUpgrade/PermUpgrade.gd new file mode 100644 index 0000000..c2cedfb --- /dev/null +++ b/PermUpgrade/PermUpgrade.gd @@ -0,0 +1,74 @@ +extends PanelContainer + +class_name PermUpgrade + +@export var Name : String = "" +@export var GlobalVariable : String = "" +@export var BaseCost : int = 10 + +@onready var Level1 = $Container/Level1 +@onready var Level2 = $Container/Level2 +@onready var Level3 = $Container/Level3 +@onready var Level4 = $Container/Level4 +@onready var Level5 = $Container/Level5 +@onready var NameNode = $Container/Name +@onready var StatusNode = $Container/Status +@onready var BuyButton = $Container/Cost + +var cost = BaseCost + +func _ready() -> void: + update() + EventBus.upgrade_tokens_updated.connect(_on_upgrade_tokens_updated) + + +func update() -> void: + cost = BaseCost + var qty = Global.get(GlobalVariable) + + var inactive : Color = Color.DARK_SLATE_GRAY + + + if qty < 1: + Level1.modulate = inactive + else: + Level1.modulate = Color.ROYAL_BLUE + cost *= 2 + if qty < 2: + Level2.modulate = inactive + else: + cost *= 2 + Level2.modulate = Color.GREEN + if qty < 3: + Level3.modulate = inactive + else: + cost *= 2 + Level3.modulate = Color.RED + if qty < 4: + Level4.modulate = inactive + else: + cost *= 2 + Level4.modulate = Color.SILVER + if qty < 5: + Level5.modulate = inactive + else: + cost = -1 + Level5.modulate = Color.GOLD + BuyButton.text = "MAX" + + NameNode.text = Name + StatusNode.text = Global.call("format_" + GlobalVariable) + if not cost == -1: + BuyButton.text = "%d" % cost + + BuyButton.disabled = (Global.upgrade_tokens < cost) or (cost == -1) + +func _on_cost_pressed() -> void: + var now = Global.get(GlobalVariable) + if now < 5: + Global.set(GlobalVariable, now + 1) + Global.upgrade_tokens -= cost + pass # Replace with function body. + +func _on_upgrade_tokens_updated(qty : int) -> void: + update() diff --git a/PermUpgrade/PermUpgrade.tscn b/PermUpgrade/PermUpgrade.tscn new file mode 100644 index 0000000..265338f --- /dev/null +++ b/PermUpgrade/PermUpgrade.tscn @@ -0,0 +1,83 @@ +[gd_scene load_steps=5 format=3 uid="uid://bdhok2nkoirl0"] + +[ext_resource type="Script" path="res://PermUpgrade/PermUpgrade.gd" id="1_g7x2d"] +[ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="2_ie5gk"] +[ext_resource type="Texture2D" uid="uid://ct1ksbbjc61lr" path="res://Brick/ShinyBrick.png" id="3_cpl7n"] +[ext_resource type="Texture2D" uid="uid://cipjurqgguse7" path="res://Brick/BaseBrick.png" id="4_wqhv2"] + +[node name="PermUpgrade" type="PanelContainer"] +offset_right = 128.0 +offset_bottom = 26.0 +script = ExtResource("1_g7x2d") + +[node name="Container" type="VBoxContainer" parent="."] +custom_minimum_size = Vector2(128, 0) +layout_mode = 2 +theme = ExtResource("2_ie5gk") +theme_type_variation = &"UpgradePanel" + +[node name="Name" type="Label" parent="Container"] +layout_mode = 2 +theme = ExtResource("2_ie5gk") +text = "Lives" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Status" type="Label" parent="Container"] +layout_mode = 2 +theme = ExtResource("2_ie5gk") +text = "3" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="Level5" type="TextureRect" parent="Container"] +modulate = Color(1, 0.843137, 0, 1) +custom_minimum_size = Vector2(32, 16) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 0 +texture = ExtResource("3_cpl7n") +stretch_mode = 2 + +[node name="Level4" type="TextureRect" parent="Container"] +modulate = Color(0.752941, 0.752941, 0.752941, 1) +custom_minimum_size = Vector2(32, 16) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 0 +texture = ExtResource("3_cpl7n") +stretch_mode = 2 + +[node name="Level3" type="TextureRect" parent="Container"] +modulate = Color(1, 0, 0, 1) +custom_minimum_size = Vector2(32, 16) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 0 +texture = ExtResource("4_wqhv2") +stretch_mode = 2 + +[node name="Level2" type="TextureRect" parent="Container"] +modulate = Color(0.254902, 0.411765, 0.882353, 1) +custom_minimum_size = Vector2(32, 16) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 0 +texture = ExtResource("4_wqhv2") +stretch_mode = 2 + +[node name="Level1" type="TextureRect" parent="Container"] +modulate = Color(0, 0.74902, 0, 1) +custom_minimum_size = Vector2(32, 16) +layout_mode = 2 +size_flags_horizontal = 4 +size_flags_vertical = 0 +texture = ExtResource("4_wqhv2") +stretch_mode = 2 + +[node name="Cost" type="Button" parent="Container"] +layout_mode = 2 +theme = ExtResource("2_ie5gk") +text = "10" + +[connection signal="pressed" from="Container/Cost" to="." method="_on_cost_pressed"] diff --git a/Settings.gd b/Settings.gd index fa0b256..606413f 100644 --- a/Settings.gd +++ b/Settings.gd @@ -21,3 +21,8 @@ func _on_music_volume_drag_ended(value_changed: bool) -> void: func _on_effects_volume_drag_ended(value_changed: bool) -> void: Global.effects_volume = $VBoxContainer/HBoxContainer/RightPanel/Effects.value $Boink.play() + + +func _on_reset_times_pressed() -> void: + Global.reset_best_times() + pass # Replace with function body. diff --git a/Settings.tscn b/Settings.tscn index c065db3..71ed189 100644 --- a/Settings.tscn +++ b/Settings.tscn @@ -9,9 +9,10 @@ script = ExtResource("1_a8wdi") [node name="VBoxContainer" type="VBoxContainer" parent="."] -offset_top = 38.0 -offset_right = 640.0 -offset_bottom = 324.0 +offset_left = 32.0 +offset_top = 32.0 +offset_right = 608.0 +offset_bottom = 328.0 [node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] layout_mode = 2 @@ -85,11 +86,22 @@ layout_mode = 2 size_flags_horizontal = 3 theme = ExtResource("1_lirja") -[node name="Exit" type="Button" parent="."] -offset_left = 590.0 -offset_top = 324.0 -offset_right = 630.0 -offset_bottom = 350.0 +[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="ResetTimes" type="Button" parent="VBoxContainer/HBoxContainer2"] +layout_mode = 2 +theme = ExtResource("1_lirja") +text = "Reset Best Times +" + +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/HBoxContainer2"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("1_lirja") + +[node name="Exit" type="Button" parent="VBoxContainer/HBoxContainer2"] +layout_mode = 2 theme = ExtResource("1_lirja") text = "Exit" @@ -101,4 +113,5 @@ bus = &"Effects" [connection signal="pressed" from="VBoxContainer/HBoxContainer/LeftPanel/Absolute" to="." method="_on_absolute_pressed"] [connection signal="drag_ended" from="VBoxContainer/HBoxContainer/RightPanel/Music" to="." method="_on_music_volume_drag_ended"] [connection signal="drag_ended" from="VBoxContainer/HBoxContainer/RightPanel/Effects" to="." method="_on_effects_volume_drag_ended"] -[connection signal="pressed" from="Exit" to="." method="_on_exit_pressed"] +[connection signal="pressed" from="VBoxContainer/HBoxContainer2/ResetTimes" to="." method="_on_reset_times_pressed"] +[connection signal="pressed" from="VBoxContainer/HBoxContainer2/Exit" to="." method="_on_exit_pressed"] diff --git a/Upgrades.gd b/Upgrades.gd new file mode 100644 index 0000000..6ff151f --- /dev/null +++ b/Upgrades.gd @@ -0,0 +1,13 @@ +extends Node2D + +@onready var Tokens = $VBoxContainer/Tokens/Label + +func _ready() -> void: + EventBus.upgrade_tokens_updated.connect(_on_upgrade_tokens_updated) + Tokens.text = "%d" % Global.upgrade_tokens + +func _on_exit_pressed() -> void: + get_tree().change_scene_to_file("res://Intro.tscn") + +func _on_upgrade_tokens_updated(qty : int) -> void: + Tokens.text = "%d" % qty diff --git a/Upgrades.tscn b/Upgrades.tscn new file mode 100644 index 0000000..6dfc9e7 --- /dev/null +++ b/Upgrades.tscn @@ -0,0 +1,130 @@ +[gd_scene load_steps=5 format=3 uid="uid://bfibb6fr6rox7"] + +[ext_resource type="Script" path="res://Upgrades.gd" id="1_ouypj"] +[ext_resource type="Theme" uid="uid://cfvww0geatnnk" path="res://MainTheme.tres" id="1_rv7oa"] +[ext_resource type="SpriteFrames" uid="uid://c6wwkgmwfpdu7" path="res://Coin/Coin.tres" id="2_woppf"] +[ext_resource type="PackedScene" uid="uid://bdhok2nkoirl0" path="res://PermUpgrade/PermUpgrade.tscn" id="4_rlh0r"] + +[node name="Upgrades" type="Node2D"] +script = ExtResource("1_ouypj") + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +offset_left = 16.0 +offset_top = 16.0 +offset_right = 624.0 +offset_bottom = 344.0 + +[node name="Tokens" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/Tokens"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("1_rv7oa") + +[node name="Label" type="Label" parent="VBoxContainer/Tokens"] +layout_mode = 2 +theme = ExtResource("1_rv7oa") +text = "23" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/Tokens"] +custom_minimum_size = Vector2(16, 0) +layout_mode = 2 + +[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="VBoxContainer/Tokens/MarginContainer"] +sprite_frames = ExtResource("2_woppf") +autoplay = "default" +centered = false + +[node name="VSeparator2" type="VSeparator" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme = ExtResource("1_rv7oa") + +[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer"] +custom_minimum_size = Vector2(0, 160) +layout_mode = 2 +size_flags_vertical = 3 +follow_focus = true +vertical_scroll_mode = 0 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer/ScrollContainer"] +layout_mode = 2 + +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/ScrollContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("1_rv7oa") + +[node name="EffectTime" parent="VBoxContainer/ScrollContainer/HBoxContainer" instance=ExtResource("4_rlh0r")] +layout_mode = 2 +Name = "Effect Time" +GlobalVariable = "effect_time" + +[node name="HSeparator2" type="HSeparator" parent="VBoxContainer/ScrollContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("1_rv7oa") + +[node name="EffectChance" parent="VBoxContainer/ScrollContainer/HBoxContainer" instance=ExtResource("4_rlh0r")] +layout_mode = 2 +Name = "Effect Chance" +GlobalVariable = "powerup_percent" + +[node name="HSeparator3" type="HSeparator" parent="VBoxContainer/ScrollContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("1_rv7oa") + +[node name="LaserPower" parent="VBoxContainer/ScrollContainer/HBoxContainer" instance=ExtResource("4_rlh0r")] +layout_mode = 2 +Name = "Laser Power" +GlobalVariable = "laser_power" + +[node name="HSeparator4" type="HSeparator" parent="VBoxContainer/ScrollContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("1_rv7oa") + +[node name="Lives" parent="VBoxContainer/ScrollContainer/HBoxContainer" instance=ExtResource("4_rlh0r")] +layout_mode = 2 +Name = "Lives" +GlobalVariable = "extra_lives" + +[node name="HSeparator5" type="HSeparator" parent="VBoxContainer/ScrollContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("1_rv7oa") + +[node name="Split" parent="VBoxContainer/ScrollContainer/HBoxContainer" instance=ExtResource("4_rlh0r")] +layout_mode = 2 +Name = "Split" +GlobalVariable = "ball_split" + +[node name="HSeparator6" type="HSeparator" parent="VBoxContainer/ScrollContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("1_rv7oa") + +[node name="VSeparator" type="VSeparator" parent="VBoxContainer"] +layout_mode = 2 +size_flags_vertical = 3 +theme = ExtResource("1_rv7oa") + +[node name="Exit" type="HBoxContainer" parent="VBoxContainer"] +layout_mode = 2 + +[node name="HSeparator" type="HSeparator" parent="VBoxContainer/Exit"] +layout_mode = 2 +size_flags_horizontal = 3 +theme = ExtResource("1_rv7oa") + +[node name="Exit" type="Button" parent="VBoxContainer/Exit"] +layout_mode = 2 +theme = ExtResource("1_rv7oa") +text = "EXIT" + +[connection signal="pressed" from="VBoxContainer/Exit/Exit" to="." method="_on_exit_pressed"] diff --git a/project.godot b/project.godot index 02973a8..097a641 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="Dunkanoid" -config/version="0.7.2" +config/version="0.8.0" run/main_scene="res://Intro.tscn" config/features=PackedStringArray("4.2", "Forward Plus") run/max_fps=30