Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
0c881af6fb | |||
45a3759417 | |||
d1ae283585 | |||
183f7f16f3 | |||
db7788fac2 | |||
af3d1d335b | |||
bfcfbee56d | |||
9d19dc41ee | |||
99b8c777c7 | |||
84f9fef897 | |||
5747a036c3 | |||
671896be77 |
@ -1,13 +1,13 @@
|
|||||||
# Godot-Pong
|
# Godot-Pong
|
||||||
|
|
||||||
Pong made poorly in godot. Just trying to make a some what complete projoct and move on. As of right now this game is **only** local multiplayer, and the first player to 5 points "wins". 🎉
|
Pong made poorly in godot. Just trying to make a some what complete project and move on. As of right now this game is **only** local multiplayer, and the first player to 5 points "wins". 🎉
|
||||||
|
|
||||||
|
|
||||||
## Controls:
|
## Controls:
|
||||||
- Keyboard
|
- Keyboard
|
||||||
- Player 1 - WASD
|
- Player 1 - WASD
|
||||||
- Player 2 - Arrow Keys
|
- Player 2 - Arrow Keys
|
||||||
- Gamepad
|
- Multiple Gamepads (D-Pad & Left Analog Stick)
|
||||||
|
|
||||||
|
|
||||||
## Needs Work:
|
## Needs Work:
|
||||||
@ -15,5 +15,5 @@ Pong made poorly in godot. Just trying to make a some what complete projoct and
|
|||||||
- CPU logic for single player (or CPU only) 🤖
|
- CPU logic for single player (or CPU only) 🤖
|
||||||
- A settings menu that persists between launches 📓
|
- A settings menu that persists between launches 📓
|
||||||
- Some form of network multiplayer 💻
|
- Some form of network multiplayer 💻
|
||||||
- Select menu options via gamepad 🎮
|
- ~~Select menu options via gamepad 🎮~~
|
||||||
- More sprite effects or fx in general 🔥
|
- More sprite effects or fx in general 🔥
|
||||||
|
BIN
assets-raw/star.xcf
Normal file
BIN
assets-raw/star.xcf
Normal file
Binary file not shown.
BIN
assets/star.png
Normal file
BIN
assets/star.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 703 B |
35
assets/star.png.import
Normal file
35
assets/star.png.import
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/star.png-db40ec76fb3fd808480ce0481255e27b.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/star.png"
|
||||||
|
dest_files=[ "res://.import/star.png-db40ec76fb3fd808480ce0481255e27b.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
process/normal_map_invert_y=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
@ -45,6 +45,79 @@ window=false
|
|||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
|
ui_accept={
|
||||||
|
"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":16777221,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777222,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":32,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
ui_select={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [ ]
|
||||||
|
}
|
||||||
|
ui_cancel={
|
||||||
|
"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":16777217,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
ui_focus_next={
|
||||||
|
"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":16777218,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":5,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
ui_focus_prev={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":true,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777218,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":4,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
ui_left={
|
||||||
|
"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":16777231,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":65,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
ui_right={
|
||||||
|
"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":16777233,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":68,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
ui_up={
|
||||||
|
"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":16777232,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
ui_down={
|
||||||
|
"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":16777234,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":83,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
ui_page_up={
|
||||||
|
"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":16777235,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":6,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
ui_page_down={
|
||||||
|
"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":16777236,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":7,"pressure":0.0,"pressed":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
P1_Up={
|
P1_Up={
|
||||||
"deadzone": 0.5,
|
"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":87,"physical_scancode":0,"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":87,"physical_scancode":0,"unicode":0,"echo":false,"script":null)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
extends Actor
|
extends Actor
|
||||||
|
|
||||||
export var top_speed: = 1000
|
export var top_speed: = 1000
|
||||||
|
onready var particles: Particles2D = $Particles2D
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
randomize()
|
randomize()
|
||||||
@ -15,8 +16,12 @@ func _on_BounceCheck_body_entered(body: PhysicsBody2D) -> void:
|
|||||||
bounce(body)
|
bounce(body)
|
||||||
|
|
||||||
func bounce(object: PhysicsBody2D) -> void:
|
func bounce(object: PhysicsBody2D) -> void:
|
||||||
if speed.x <= top_speed:
|
if speed.x >= top_speed:
|
||||||
|
speed.x = top_speed
|
||||||
|
particles.visible = true
|
||||||
|
else:
|
||||||
speed.x *= 1.1
|
speed.x *= 1.1
|
||||||
|
|
||||||
if object is Actor:
|
if object is Actor:
|
||||||
_direction.x = -_direction.x
|
_direction.x = -_direction.x
|
||||||
$"SFX/BounceSound-2".play()
|
$"SFX/BounceSound-2".play()
|
||||||
|
@ -1,15 +1,27 @@
|
|||||||
[gd_scene load_steps=7 format=2]
|
[gd_scene load_steps=9 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://src/Actors/Ball.gd" type="Script" id=1]
|
[ext_resource path="res://src/Actors/Ball.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://assets/Ball.png" type="Texture" id=2]
|
[ext_resource path="res://assets/Ball.png" type="Texture" id=2]
|
||||||
[ext_resource path="res://assets/bounce_sfx-01.ogg" type="AudioStream" id=3]
|
[ext_resource path="res://assets/bounce_sfx-01.ogg" type="AudioStream" id=3]
|
||||||
[ext_resource path="res://assets/bounce_sfx-02.ogg" type="AudioStream" id=4]
|
[ext_resource path="res://assets/bounce_sfx-02.ogg" type="AudioStream" id=4]
|
||||||
|
[ext_resource path="res://assets/star.png" type="Texture" id=5]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=2]
|
[sub_resource type="RectangleShape2D" id=2]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="RectangleShape2D" id=1]
|
||||||
extents = Vector2( 14.25, 15 )
|
extents = Vector2( 14.25, 15 )
|
||||||
|
|
||||||
|
[sub_resource type="ParticlesMaterial" id=3]
|
||||||
|
flag_disable_z = true
|
||||||
|
direction = Vector3( -1, 0, 0 )
|
||||||
|
spread = 180.0
|
||||||
|
gravity = Vector3( 0, 0, 0 )
|
||||||
|
initial_velocity = 150.0
|
||||||
|
orbit_velocity = 0.0
|
||||||
|
orbit_velocity_random = 0.0
|
||||||
|
scale = 0.5
|
||||||
|
color = Color( 1, 1, 1, 0.470588 )
|
||||||
|
|
||||||
[node name="Ball" type="KinematicBody2D"]
|
[node name="Ball" type="KinematicBody2D"]
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
speed = Vector2( 200, 100 )
|
speed = Vector2( 200, 100 )
|
||||||
@ -39,4 +51,9 @@ stream = ExtResource( 3 )
|
|||||||
[node name="BounceSound-2" type="AudioStreamPlayer" parent="SFX"]
|
[node name="BounceSound-2" type="AudioStreamPlayer" parent="SFX"]
|
||||||
stream = ExtResource( 4 )
|
stream = ExtResource( 4 )
|
||||||
|
|
||||||
|
[node name="Particles2D" type="Particles2D" parent="."]
|
||||||
|
visible = false
|
||||||
|
process_material = SubResource( 3 )
|
||||||
|
texture = ExtResource( 5 )
|
||||||
|
|
||||||
[connection signal="body_entered" from="BounceCheck" to="." method="_on_BounceCheck_body_entered"]
|
[connection signal="body_entered" from="BounceCheck" to="." method="_on_BounceCheck_body_entered"]
|
||||||
|
30
src/Save/save_settings.gd
Normal file
30
src/Save/save_settings.gd
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
extends Node
|
||||||
|
|
||||||
|
const SETTINGS_FILE = "GameSettings.save"
|
||||||
|
|
||||||
|
var game_data: = {}
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
load_data()
|
||||||
|
|
||||||
|
func load_data():
|
||||||
|
var file: = File.new()
|
||||||
|
|
||||||
|
if not file.file_exists(SETTINGS_FILE):
|
||||||
|
game_data = {
|
||||||
|
"fullscreen": false,
|
||||||
|
"vsync": false,
|
||||||
|
"particle_effects": true,
|
||||||
|
"master_vol": -10
|
||||||
|
}
|
||||||
|
save_data()
|
||||||
|
|
||||||
|
file.open(SETTINGS_FILE, File.READ)
|
||||||
|
game_data = file.get_var()
|
||||||
|
file.close()
|
||||||
|
|
||||||
|
func save_data():
|
||||||
|
var file: = File.new()
|
||||||
|
file.open(SETTINGS_FILE, File.WRITE)
|
||||||
|
file.store_var(game_data)
|
||||||
|
file.close()
|
@ -69,7 +69,6 @@ __meta__ = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[node name="Player1" parent="Actors" instance=ExtResource( 1 )]
|
[node name="Player1" parent="Actors" instance=ExtResource( 1 )]
|
||||||
pause_mode = 2
|
|
||||||
modulate = Color( 0.0862745, 0.54902, 0.254902, 1 )
|
modulate = Color( 0.0862745, 0.54902, 0.254902, 1 )
|
||||||
position = Vector2( 64, 376 )
|
position = Vector2( 64, 376 )
|
||||||
|
|
||||||
|
6
src/Screens/MainMenu.gd
Normal file
6
src/Screens/MainMenu.gd
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
onready var play_button: Button = $MenuButtons/PlayButton
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
play_button.grab_focus()
|
@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=9 format=2]
|
[gd_scene load_steps=10 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets-raw/BBB_Simulator_Black.otf" type="DynamicFontData" id=1]
|
[ext_resource path="res://assets-raw/BBB_Simulator_Black.otf" type="DynamicFontData" id=1]
|
||||||
[ext_resource path="res://assets/Background.png" type="Texture" id=2]
|
[ext_resource path="res://assets/Background.png" type="Texture" id=2]
|
||||||
@ -6,6 +6,7 @@
|
|||||||
[ext_resource path="res://src/UI/QuitButton.tscn" type="PackedScene" id=4]
|
[ext_resource path="res://src/UI/QuitButton.tscn" type="PackedScene" id=4]
|
||||||
[ext_resource path="res://src/UI/ChangeScene.tscn" type="PackedScene" id=5]
|
[ext_resource path="res://src/UI/ChangeScene.tscn" type="PackedScene" id=5]
|
||||||
[ext_resource path="res://src/UI/Title.tscn" type="PackedScene" id=6]
|
[ext_resource path="res://src/UI/Title.tscn" type="PackedScene" id=6]
|
||||||
|
[ext_resource path="res://src/Screens/MainMenu.gd" type="Script" id=7]
|
||||||
|
|
||||||
[sub_resource type="DynamicFont" id=1]
|
[sub_resource type="DynamicFont" id=1]
|
||||||
font_data = ExtResource( 1 )
|
font_data = ExtResource( 1 )
|
||||||
@ -17,6 +18,7 @@ default_font = SubResource( 1 )
|
|||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
theme = ExtResource( 3 )
|
theme = ExtResource( 3 )
|
||||||
|
script = ExtResource( 7 )
|
||||||
|
|
||||||
[node name="Background" type="TextureRect" parent="."]
|
[node name="Background" type="TextureRect" parent="."]
|
||||||
modulate = Color( 0, 0, 0, 1 )
|
modulate = Color( 0, 0, 0, 1 )
|
||||||
@ -50,13 +52,26 @@ alignment = 1
|
|||||||
|
|
||||||
[node name="PlayButton" parent="MenuButtons" instance=ExtResource( 5 )]
|
[node name="PlayButton" parent="MenuButtons" instance=ExtResource( 5 )]
|
||||||
margin_right = 171.0
|
margin_right = 171.0
|
||||||
margin_bottom = 47.0
|
margin_bottom = 40.0
|
||||||
|
focus_next = NodePath("../SettingsButton")
|
||||||
|
focus_previous = NodePath("../QuitButton")
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
text = "Play"
|
text = "Play"
|
||||||
next_scene_path = "res://src/Screens/Game.tscn"
|
next_scene_path = "res://src/Screens/Game.tscn"
|
||||||
|
|
||||||
[node name="QuitButton" parent="MenuButtons" instance=ExtResource( 4 )]
|
[node name="SettingsButton" parent="MenuButtons" instance=ExtResource( 5 )]
|
||||||
margin_top = 51.0
|
margin_top = 44.0
|
||||||
margin_right = 171.0
|
margin_right = 171.0
|
||||||
margin_bottom = 99.0
|
margin_bottom = 84.0
|
||||||
|
focus_next = NodePath("../QuitButton")
|
||||||
|
focus_previous = NodePath("../PlayButton")
|
||||||
|
text = "Settings"
|
||||||
|
next_scene_path = "res://src/Screens/SettingsMenu.tscn"
|
||||||
|
|
||||||
|
[node name="QuitButton" parent="MenuButtons" instance=ExtResource( 4 )]
|
||||||
|
margin_top = 88.0
|
||||||
|
margin_right = 171.0
|
||||||
|
margin_bottom = 128.0
|
||||||
|
focus_next = NodePath("../PlayButton")
|
||||||
|
focus_previous = NodePath("../SettingsButton")
|
||||||
size_flags_vertical = 3
|
size_flags_vertical = 3
|
||||||
|
@ -52,6 +52,8 @@ alignment = 1
|
|||||||
[node name="Restart" parent="MenuButtons" instance=ExtResource( 5 )]
|
[node name="Restart" parent="MenuButtons" instance=ExtResource( 5 )]
|
||||||
margin_right = 171.0
|
margin_right = 171.0
|
||||||
margin_bottom = 40.0
|
margin_bottom = 40.0
|
||||||
|
focus_next = NodePath("../MainMenuButton")
|
||||||
|
focus_previous = NodePath("../QuitButton")
|
||||||
text = "Restart"
|
text = "Restart"
|
||||||
next_scene_path = "res://src/Screens/Game.tscn"
|
next_scene_path = "res://src/Screens/Game.tscn"
|
||||||
|
|
||||||
@ -59,6 +61,8 @@ next_scene_path = "res://src/Screens/Game.tscn"
|
|||||||
margin_top = 44.0
|
margin_top = 44.0
|
||||||
margin_right = 171.0
|
margin_right = 171.0
|
||||||
margin_bottom = 84.0
|
margin_bottom = 84.0
|
||||||
|
focus_next = NodePath("../QuitButton")
|
||||||
|
focus_previous = NodePath("../Restart")
|
||||||
text = "Main Menu"
|
text = "Main Menu"
|
||||||
next_scene_path = "res://src/Screens/MainMenu.tscn"
|
next_scene_path = "res://src/Screens/MainMenu.tscn"
|
||||||
|
|
||||||
@ -66,3 +70,5 @@ next_scene_path = "res://src/Screens/MainMenu.tscn"
|
|||||||
margin_top = 88.0
|
margin_top = 88.0
|
||||||
margin_right = 171.0
|
margin_right = 171.0
|
||||||
margin_bottom = 128.0
|
margin_bottom = 128.0
|
||||||
|
focus_next = NodePath("../Restart")
|
||||||
|
focus_previous = NodePath("../MainMenuButton")
|
||||||
|
14
src/Screens/SettingsMenu.gd
Normal file
14
src/Screens/SettingsMenu.gd
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
extends Control
|
||||||
|
|
||||||
|
# TODO: Add GFX settings (resolution, fullscreen, effects & vsync)
|
||||||
|
# TODO: Add Audio settings (Master Volume, since only 2 SFX)
|
||||||
|
# TODO: Make them presist between launchs
|
||||||
|
|
||||||
|
onready var fullscreen: CheckButton = $MarginContainer/GameSettings/FullScreenToggle
|
||||||
|
onready var v_sync: CheckButton = $MarginContainer/GameSettings/VSyncCheckToggle
|
||||||
|
onready var paticle_effects: CheckButton = $MarginContainer/GameSettings/ParticleEffectsToggle
|
||||||
|
onready var game_volume_slider: HSlider = $MarginContainer/GameSettings/VolumeSlider/VolumeSliderBar
|
||||||
|
onready var game_volume_label: Label = $MarginContainer/GameSettings/VolumeSlider/VolumeSliderLabel
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
fullscreen.grab_focus()
|
140
src/Screens/SettingsMenu.tscn
Normal file
140
src/Screens/SettingsMenu.tscn
Normal file
@ -0,0 +1,140 @@
|
|||||||
|
[gd_scene load_steps=10 format=2]
|
||||||
|
|
||||||
|
[ext_resource path="res://assets/Background.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://assets-raw/BBB_Simulator_Black.otf" type="DynamicFontData" id=2]
|
||||||
|
[ext_resource path="res://src/UI/Title.tscn" type="PackedScene" id=3]
|
||||||
|
[ext_resource path="res://src/Screens/SettingsMenu.gd" type="Script" id=4]
|
||||||
|
[ext_resource path="res://src/UI/ChangeScene.tscn" type="PackedScene" id=5]
|
||||||
|
[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=6]
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFont" id=1]
|
||||||
|
font_data = ExtResource( 2 )
|
||||||
|
|
||||||
|
[sub_resource type="Theme" id=2]
|
||||||
|
default_font = SubResource( 1 )
|
||||||
|
|
||||||
|
[sub_resource type="DynamicFont" id=3]
|
||||||
|
size = 12
|
||||||
|
font_data = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="SettingsMenu" type="Control"]
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
script = ExtResource( 4 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_vertical_guides_": [ 640.0 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Background" type="TextureRect" parent="."]
|
||||||
|
modulate = Color( 0, 0, 0, 1 )
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
theme = SubResource( 2 )
|
||||||
|
texture = ExtResource( 1 )
|
||||||
|
|
||||||
|
[node name="Title" parent="." instance=ExtResource( 3 )]
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
margin_left = -150.5
|
||||||
|
margin_top = 112.0
|
||||||
|
margin_right = 150.5
|
||||||
|
margin_bottom = 179.0
|
||||||
|
text = "Settings"
|
||||||
|
|
||||||
|
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
margin_left = -150.0
|
||||||
|
margin_top = -100.0
|
||||||
|
margin_right = 150.0
|
||||||
|
margin_bottom = 100.0
|
||||||
|
theme = ExtResource( 6 )
|
||||||
|
|
||||||
|
[node name="GameSettings" type="GridContainer" parent="MarginContainer"]
|
||||||
|
margin_right = 300.0
|
||||||
|
margin_bottom = 200.0
|
||||||
|
columns = 2
|
||||||
|
|
||||||
|
[node name="FullScreenLabel" type="Label" parent="MarginContainer/GameSettings"]
|
||||||
|
margin_top = 4.0
|
||||||
|
margin_right = 194.0
|
||||||
|
margin_bottom = 38.0
|
||||||
|
text = "Fullscreen:"
|
||||||
|
|
||||||
|
[node name="FullScreenToggle" type="CheckButton" parent="MarginContainer/GameSettings"]
|
||||||
|
margin_left = 198.0
|
||||||
|
margin_right = 274.0
|
||||||
|
margin_bottom = 42.0
|
||||||
|
focus_next = NodePath("../VSyncToggle")
|
||||||
|
focus_previous = NodePath("../../../BackButton")
|
||||||
|
|
||||||
|
[node name="VSyncLabel" type="Label" parent="MarginContainer/GameSettings"]
|
||||||
|
margin_top = 50.0
|
||||||
|
margin_right = 194.0
|
||||||
|
margin_bottom = 84.0
|
||||||
|
text = "V-Sync:"
|
||||||
|
|
||||||
|
[node name="VSyncToggle" type="CheckButton" parent="MarginContainer/GameSettings"]
|
||||||
|
margin_left = 198.0
|
||||||
|
margin_top = 46.0
|
||||||
|
margin_right = 274.0
|
||||||
|
margin_bottom = 88.0
|
||||||
|
focus_next = NodePath("../ParticleEffectsToggle")
|
||||||
|
focus_previous = NodePath("../FullScreenToggle")
|
||||||
|
|
||||||
|
[node name="ParticleEffectsLabel" type="Label" parent="MarginContainer/GameSettings"]
|
||||||
|
margin_top = 96.0
|
||||||
|
margin_right = 194.0
|
||||||
|
margin_bottom = 130.0
|
||||||
|
text = "Particle Effects:"
|
||||||
|
|
||||||
|
[node name="ParticleEffectsToggle" type="CheckButton" parent="MarginContainer/GameSettings"]
|
||||||
|
margin_left = 198.0
|
||||||
|
margin_top = 92.0
|
||||||
|
margin_right = 274.0
|
||||||
|
margin_bottom = 134.0
|
||||||
|
focus_next = NodePath("../VolumeSlider/VolumeSliderBar")
|
||||||
|
focus_previous = NodePath("../VSyncToggle")
|
||||||
|
|
||||||
|
[node name="VolumeLabel" type="Label" parent="MarginContainer/GameSettings"]
|
||||||
|
margin_top = 140.0
|
||||||
|
margin_right = 194.0
|
||||||
|
margin_bottom = 174.0
|
||||||
|
text = "Volume:"
|
||||||
|
|
||||||
|
[node name="VolumeSlider" type="VBoxContainer" parent="MarginContainer/GameSettings"]
|
||||||
|
margin_left = 198.0
|
||||||
|
margin_top = 138.0
|
||||||
|
margin_right = 274.0
|
||||||
|
margin_bottom = 176.0
|
||||||
|
|
||||||
|
[node name="VolumeSliderBar" type="HSlider" parent="MarginContainer/GameSettings/VolumeSlider"]
|
||||||
|
margin_right = 76.0
|
||||||
|
margin_bottom = 16.0
|
||||||
|
focus_next = NodePath("../../../../BackButton")
|
||||||
|
focus_previous = NodePath("../../ParticleEffectsToggle")
|
||||||
|
|
||||||
|
[node name="VolumeSliderText" type="Label" parent="MarginContainer/GameSettings/VolumeSlider"]
|
||||||
|
margin_top = 20.0
|
||||||
|
margin_right = 76.0
|
||||||
|
margin_bottom = 38.0
|
||||||
|
custom_fonts/font = SubResource( 3 )
|
||||||
|
text = "100%"
|
||||||
|
align = 1
|
||||||
|
valign = 2
|
||||||
|
|
||||||
|
[node name="BackButton" parent="." instance=ExtResource( 5 )]
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
margin_left = -97.0
|
||||||
|
margin_top = 144.0
|
||||||
|
margin_right = 97.0
|
||||||
|
margin_bottom = 184.0
|
||||||
|
focus_next = NodePath("../MarginContainer/GameSettings/FullScreenToggle")
|
||||||
|
focus_previous = NodePath("../MarginContainer/GameSettings/VolumeSlider/VolumeSliderBar")
|
||||||
|
text = "Back"
|
||||||
|
next_scene_path = "res://src/Screens/MainMenu.tscn"
|
@ -4,6 +4,7 @@ onready var scene_tree = get_tree()
|
|||||||
onready var p1_score: Label = $P1Score
|
onready var p1_score: Label = $P1Score
|
||||||
onready var p2_score: Label = $P2Score
|
onready var p2_score: Label = $P2Score
|
||||||
onready var pause_overlay: ColorRect = $PauseOverlay
|
onready var pause_overlay: ColorRect = $PauseOverlay
|
||||||
|
onready var main_menu_button: Button = $PauseOverlay/MenuButtons/MainMenuButton
|
||||||
|
|
||||||
var paused: = false setget set_paused
|
var paused: = false setget set_paused
|
||||||
|
|
||||||
@ -28,3 +29,5 @@ func set_paused(value: bool) -> void:
|
|||||||
paused = value
|
paused = value
|
||||||
scene_tree.paused = value
|
scene_tree.paused = value
|
||||||
pause_overlay.visible = value
|
pause_overlay.visible = value
|
||||||
|
if value:
|
||||||
|
main_menu_button.grab_focus()
|
||||||
|
@ -66,6 +66,8 @@ alignment = 1
|
|||||||
margin_top = 7.0
|
margin_top = 7.0
|
||||||
margin_right = 171.0
|
margin_right = 171.0
|
||||||
margin_bottom = 47.0
|
margin_bottom = 47.0
|
||||||
|
focus_next = NodePath("../QuitButton")
|
||||||
|
focus_previous = NodePath("../QuitButton")
|
||||||
text = "Main Menu"
|
text = "Main Menu"
|
||||||
next_scene_path = "res://src/Screens/MainMenu.tscn"
|
next_scene_path = "res://src/Screens/MainMenu.tscn"
|
||||||
|
|
||||||
@ -73,3 +75,5 @@ next_scene_path = "res://src/Screens/MainMenu.tscn"
|
|||||||
margin_top = 51.0
|
margin_top = 51.0
|
||||||
margin_right = 171.0
|
margin_right = 171.0
|
||||||
margin_bottom = 91.0
|
margin_bottom = 91.0
|
||||||
|
focus_next = NodePath("../MainMenuButton")
|
||||||
|
focus_previous = NodePath("../MainMenuButton")
|
||||||
|
Loading…
Reference in New Issue
Block a user