Compare commits
16 commits
9bf5bc5a19
...
48b8119b38
Author | SHA1 | Date | |
---|---|---|---|
48b8119b38 | |||
6d5b7b30e6 | |||
e148bd8b11 | |||
0e267f5c89 | |||
beacc2baf2 | |||
faf1b6e7a9 | |||
8b13d1663a | |||
28c9ef3b87 | |||
9f5223335c | |||
073a3083e5 | |||
18afcf6bf9 | |||
844593a777 | |||
ed964981cc | |||
86131d8430 | |||
1aa2dd2c71 | |||
97c467bcf4 |
25 changed files with 843 additions and 3540 deletions
BIN
.gitea/Screenshot_Game.png
Normal file
BIN
.gitea/Screenshot_Game.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.8 KiB |
BIN
.gitea/Screenshot_Main Menu.png
Normal file
BIN
.gitea/Screenshot_Main Menu.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
.gitea/Screenshot_Settings.png
Normal file
BIN
.gitea/Screenshot_Settings.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
3923
Assets/Base.tres
3923
Assets/Base.tres
File diff suppressed because one or more lines are too long
BIN
Assets/sounds/apple.wav
Normal file
BIN
Assets/sounds/apple.wav
Normal file
Binary file not shown.
24
Assets/sounds/apple.wav.import
Normal file
24
Assets/sounds/apple.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://d1ofn1jqfbxpk"
|
||||
path="res://.godot/imported/apple.wav-a01bb26f0b5c4896b182943a709ad34a.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/sounds/apple.wav"
|
||||
dest_files=["res://.godot/imported/apple.wav-a01bb26f0b5c4896b182943a709ad34a.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
BIN
Assets/sounds/bonk.wav
Normal file
BIN
Assets/sounds/bonk.wav
Normal file
Binary file not shown.
24
Assets/sounds/bonk.wav.import
Normal file
24
Assets/sounds/bonk.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://ccoi138at5ti1"
|
||||
path="res://.godot/imported/bonk.wav-aa99158cccd620b22f38a61b11b19720.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/sounds/bonk.wav"
|
||||
dest_files=["res://.godot/imported/bonk.wav-aa99158cccd620b22f38a61b11b19720.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
BIN
Assets/sounds/change.wav
Normal file
BIN
Assets/sounds/change.wav
Normal file
Binary file not shown.
24
Assets/sounds/change.wav.import
Normal file
24
Assets/sounds/change.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://d4bi0dxjmvfyx"
|
||||
path="res://.godot/imported/change.wav-7680df3c33005109844bcf97c715b6a0.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/sounds/change.wav"
|
||||
dest_files=["res://.godot/imported/change.wav-7680df3c33005109844bcf97c715b6a0.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
BIN
Assets/sounds/menu_change.wav
Normal file
BIN
Assets/sounds/menu_change.wav
Normal file
Binary file not shown.
24
Assets/sounds/menu_change.wav.import
Normal file
24
Assets/sounds/menu_change.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://d0o66pmjueo1x"
|
||||
path="res://.godot/imported/menu_change.wav-0907e7667575c0342f4eac40c2d561ea.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/sounds/menu_change.wav"
|
||||
dest_files=["res://.godot/imported/menu_change.wav-0907e7667575c0342f4eac40c2d561ea.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
BIN
Assets/sounds/start.wav
Normal file
BIN
Assets/sounds/start.wav
Normal file
Binary file not shown.
24
Assets/sounds/start.wav.import
Normal file
24
Assets/sounds/start.wav.import
Normal file
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://b0wk8jyi64qbd"
|
||||
path="res://.godot/imported/start.wav-f56cc3e2759d662ff6c2d3258ce259b6.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/sounds/start.wav"
|
||||
dest_files=["res://.godot/imported/start.wav-f56cc3e2759d662ff6c2d3258ce259b6.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
BIN
Assets/tile.png
BIN
Assets/tile.png
Binary file not shown.
Before Width: | Height: | Size: 83 B After Width: | Height: | Size: 125 B |
BIN
Assets/tile_selected.png
Normal file
BIN
Assets/tile_selected.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 150 B |
34
Assets/tile_selected.png.import
Normal file
34
Assets/tile_selected.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://nimd0066t7qm"
|
||||
path="res://.godot/imported/tile_selected.png-b6ca25c977e696fcf5a4350cf08a3708.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/tile_selected.png"
|
||||
dest_files=["res://.godot/imported/tile_selected.png-b6ca25c977e696fcf5a4350cf08a3708.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
9
License.md
Normal file
9
License.md
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2023 Snoweuph
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
11
Readme.md
Normal file
11
Readme.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
# Snake
|
||||
|
||||
## Info
|
||||
- made with Godot `4.0.1`
|
||||
- [Color Pallet](https://lospec.com/palette-list/2bit-demiboy)
|
||||
|
||||
## Screenshots
|
||||
|
||||
![main Menu](https://git.euph.dev/Snoweuph/Snake/raw/branch/master/.gitea/Screenshot_Main%20Menu.png)
|
||||
![Settings](https://git.euph.dev/Snoweuph/Snake/raw/branch/master/.gitea/Screenshot_Settings.png)
|
||||
![Game](https://git.euph.dev/Snoweuph/Snake/raw/branch/master/.gitea/Screenshot_Game.png)
|
|
@ -1,15 +1,17 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://drs4bhpd3vrh2"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://drs4bhpd3vrh2"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/GameManager.gd" id="1_lps27"]
|
||||
[ext_resource type="Texture2D" uid="uid://vv33w22kwgpc" path="res://Assets/tile.png" id="2_wiemx"]
|
||||
[ext_resource type="Script" path="res://Scripts/TileColors.gd" id="3_gnesl"]
|
||||
[ext_resource type="AudioStream" uid="uid://d1ofn1jqfbxpk" path="res://Assets/sounds/apple.wav" id="4_a0lry"]
|
||||
[ext_resource type="AudioStream" uid="uid://ccoi138at5ti1" path="res://Assets/sounds/bonk.wav" id="5_btrdr"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_22g0s"]
|
||||
script = ExtResource("3_gnesl")
|
||||
empty = Color(0.294118, 0.337255, 0.301961, 1)
|
||||
snake_head = Color(0.603922, 0.647059, 0.486275, 1)
|
||||
snake_head = Color(0.878431, 0.913725, 0.768627, 1)
|
||||
snake_body = Color(0.603922, 0.647059, 0.486275, 1)
|
||||
apple = Color(0.878431, 0.913725, 0.768627, 1)
|
||||
apple = Color(0.909804, 0.462745, 0.462745, 1)
|
||||
|
||||
[node name="Node2D" type="Control"]
|
||||
layout_mode = 3
|
||||
|
@ -28,7 +30,7 @@ anchor_right = 1.0
|
|||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0.0784314, 0.105882, 0.0666667, 1)
|
||||
color = Color(0.145098, 0.145098, 0.145098, 1)
|
||||
|
||||
[node name="AspectRatioContainer" type="AspectRatioContainer" parent="."]
|
||||
layout_mode = 1
|
||||
|
@ -47,3 +49,9 @@ script = ExtResource("1_lps27")
|
|||
map_size = 10
|
||||
texture = ExtResource("2_wiemx")
|
||||
tile_color = SubResource("Resource_22g0s")
|
||||
|
||||
[node name="AudioStreamPlayer Eat Apple" type="AudioStreamPlayer" parent="AspectRatioContainer/Map"]
|
||||
stream = ExtResource("4_a0lry")
|
||||
|
||||
[node name="AudioStreamPlayer Bonk" type="AudioStreamPlayer" parent="AspectRatioContainer/Map"]
|
||||
stream = ExtResource("5_btrdr")
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://c7ok1re4seqsh"]
|
||||
[gd_scene load_steps=6 format=3 uid="uid://c7ok1re4seqsh"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Main Menu Buttons.gd" id="1_abac4"]
|
||||
[ext_resource type="Theme" uid="uid://clkt54a4wy6tn" path="res://Assets/Base.tres" id="1_b1d2h"]
|
||||
[ext_resource type="AudioStream" uid="uid://b0wk8jyi64qbd" path="res://Assets/sounds/start.wav" id="3_bxs37"]
|
||||
[ext_resource type="AudioStream" uid="uid://d4bi0dxjmvfyx" path="res://Assets/sounds/change.wav" id="4_gb8rx"]
|
||||
[ext_resource type="AudioStream" uid="uid://d0o66pmjueo1x" path="res://Assets/sounds/menu_change.wav" id="5_xb4d6"]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
layout_mode = 3
|
||||
|
@ -47,28 +50,121 @@ text = "Snake"
|
|||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Menu Butons" type="VBoxContainer" parent="MarginContainer/VBoxContainer"]
|
||||
[node name="Tab Group" type="TabContainer" parent="MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
tabs_visible = false
|
||||
|
||||
[node name="Menu Butons" type="VBoxContainer" parent="MarginContainer/VBoxContainer/Tab Group"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Start Button" type="Button" parent="MarginContainer/VBoxContainer/Menu Butons"]
|
||||
[node name="Start Button" type="Button" parent="MarginContainer/VBoxContainer/Tab Group/Menu Butons"]
|
||||
layout_mode = 2
|
||||
focus_neighbor_top = NodePath("../Quit Button")
|
||||
theme = ExtResource("1_b1d2h")
|
||||
theme_override_font_sizes/font_size = 96
|
||||
text = "Start"
|
||||
|
||||
[node name="About Button" type="Button" parent="MarginContainer/VBoxContainer/Menu Butons"]
|
||||
[node name="Settings Button" type="Button" parent="MarginContainer/VBoxContainer/Tab Group/Menu Butons"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_b1d2h")
|
||||
theme_override_font_sizes/font_size = 96
|
||||
text = "Settings"
|
||||
|
||||
[node name="About Button" type="Button" parent="MarginContainer/VBoxContainer/Tab Group/Menu Butons"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_b1d2h")
|
||||
theme_override_font_sizes/font_size = 96
|
||||
text = "About
|
||||
"
|
||||
|
||||
[node name="Quit Button" type="Button" parent="MarginContainer/VBoxContainer/Menu Butons"]
|
||||
[node name="Quit Button" type="Button" parent="MarginContainer/VBoxContainer/Tab Group/Menu Butons"]
|
||||
layout_mode = 2
|
||||
focus_neighbor_bottom = NodePath("../Start Button")
|
||||
theme = ExtResource("1_b1d2h")
|
||||
theme_override_font_sizes/font_size = 96
|
||||
text = "Quit"
|
||||
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/Menu Butons/Start Button" to="." method="_on_start_button_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/Menu Butons/About Button" to="." method="_on_about_button_pressed"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/Menu Butons/Quit Button" to="." method="_on_quit_button_pressed"]
|
||||
[node name="Settings" type="VBoxContainer" parent="MarginContainer/VBoxContainer/Tab Group"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="GridSize" type="HBoxContainer" parent="MarginContainer/VBoxContainer/Tab Group/Settings"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/Tab Group/Settings/GridSize"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_b1d2h")
|
||||
theme_override_font_sizes/font_size = 64
|
||||
text = "Grid Size "
|
||||
|
||||
[node name="GridSize_Slider" type="HSlider" parent="MarginContainer/VBoxContainer/Tab Group/Settings/GridSize"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource("1_b1d2h")
|
||||
min_value = 6.0
|
||||
max_value = 32.0
|
||||
value = 10.0
|
||||
rounded = true
|
||||
|
||||
[node name="Value" type="Label" parent="MarginContainer/VBoxContainer/Tab Group/Settings/GridSize"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_b1d2h")
|
||||
theme_override_font_sizes/font_size = 64
|
||||
text = "00"
|
||||
|
||||
[node name="Speed" type="HBoxContainer" parent="MarginContainer/VBoxContainer/Tab Group/Settings"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/VBoxContainer/Tab Group/Settings/Speed"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_b1d2h")
|
||||
theme_override_font_sizes/font_size = 64
|
||||
text = "Speed "
|
||||
|
||||
[node name="Speed_Slider" type="HSlider" parent="MarginContainer/VBoxContainer/Tab Group/Settings/Speed"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 4
|
||||
theme = ExtResource("1_b1d2h")
|
||||
min_value = 0.25
|
||||
max_value = 5.0
|
||||
step = 0.25
|
||||
value = 1.0
|
||||
|
||||
[node name="Value" type="Label" parent="MarginContainer/VBoxContainer/Tab Group/Settings/Speed"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_b1d2h")
|
||||
theme_override_font_sizes/font_size = 64
|
||||
text = "00"
|
||||
|
||||
[node name="Back Button" type="Button" parent="MarginContainer/VBoxContainer/Tab Group/Settings"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_b1d2h")
|
||||
theme_override_font_sizes/font_size = 96
|
||||
text = "Back"
|
||||
|
||||
[node name="AudioStreamPlayer Start" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_bxs37")
|
||||
|
||||
[node name="AudioStreamPlayer Change UI" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_gb8rx")
|
||||
|
||||
[node name="AudioStreamPlayer Change Value" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("5_xb4d6")
|
||||
|
||||
[connection signal="focus_entered" from="." to="." method="_on_focus_entered"]
|
||||
[connection signal="focus_entered" from="MarginContainer/VBoxContainer/Tab Group/Menu Butons/Start Button" to="." method="_on_focus_entered"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/Tab Group/Menu Butons/Start Button" to="." method="_on_start_button_pressed"]
|
||||
[connection signal="focus_entered" from="MarginContainer/VBoxContainer/Tab Group/Menu Butons/Settings Button" to="." method="_on_focus_entered"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/Tab Group/Menu Butons/Settings Button" to="." method="_on_settings_button_pressed"]
|
||||
[connection signal="focus_entered" from="MarginContainer/VBoxContainer/Tab Group/Menu Butons/About Button" to="." method="_on_focus_entered"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/Tab Group/Menu Butons/About Button" to="." method="_on_about_button_pressed"]
|
||||
[connection signal="focus_entered" from="MarginContainer/VBoxContainer/Tab Group/Menu Butons/Quit Button" to="." method="_on_focus_entered"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/Tab Group/Menu Butons/Quit Button" to="." method="_on_quit_button_pressed"]
|
||||
[connection signal="focus_entered" from="MarginContainer/VBoxContainer/Tab Group/Settings/GridSize/GridSize_Slider" to="." method="_on_focus_entered"]
|
||||
[connection signal="value_changed" from="MarginContainer/VBoxContainer/Tab Group/Settings/GridSize/GridSize_Slider" to="." method="_on_grid_size_slider_value_changed"]
|
||||
[connection signal="focus_entered" from="MarginContainer/VBoxContainer/Tab Group/Settings/Speed/Speed_Slider" to="." method="_on_focus_entered"]
|
||||
[connection signal="value_changed" from="MarginContainer/VBoxContainer/Tab Group/Settings/Speed/Speed_Slider" to="." method="_on_speed_slider_value_changed"]
|
||||
[connection signal="focus_entered" from="MarginContainer/VBoxContainer/Tab Group/Settings/Back Button" to="." method="_on_focus_entered"]
|
||||
[connection signal="pressed" from="MarginContainer/VBoxContainer/Tab Group/Settings/Back Button" to="." method="_on_back_button_pressed"]
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
extends GridContainer
|
||||
|
||||
var config = ConfigFile.new()
|
||||
|
||||
@export var map_size := 15
|
||||
@export var texture : Texture2D
|
||||
@export var speed := 0.25
|
||||
|
||||
@export var tile_color := TileColors.new()
|
||||
|
||||
var start_scene = preload("res://Scene/Main Menu.tscn").instantiate()
|
||||
|
||||
var tiles = []
|
||||
var snake_move_vector : Vector2
|
||||
var last_snake_move_vector : Vector2
|
||||
|
@ -76,6 +80,7 @@ func process_tiles():
|
|||
new_snake_head.state = Tile.States.SNAKE
|
||||
last_snake_move_vector = snake_move_vector
|
||||
if was_apple:
|
||||
$"AudioStreamPlayer Eat Apple".play()
|
||||
snake_length += 1
|
||||
generate_apple()
|
||||
pass
|
||||
|
@ -92,6 +97,14 @@ func process_snake_rotation():
|
|||
snake_move_vector = input.normalized()
|
||||
|
||||
func _ready():
|
||||
#load Config
|
||||
var err = config.load("user://config.cfg")
|
||||
if err != OK:
|
||||
return
|
||||
map_size = config.get_value("Game Play", "grid_size", 10)
|
||||
speed = float(config.get_value("Game Play", "speed", 1))
|
||||
print(speed)
|
||||
|
||||
game_start()
|
||||
pass
|
||||
|
||||
|
@ -106,7 +119,9 @@ func game_start():
|
|||
pass
|
||||
|
||||
func game_stop():
|
||||
$"AudioStreamPlayer Bonk".play()
|
||||
game_is_running = false
|
||||
await $"AudioStreamPlayer Bonk".finished
|
||||
get_tree().change_scene_to_file("res://Scene/Main Menu.tscn")
|
||||
pass
|
||||
|
||||
|
@ -114,7 +129,7 @@ func _process(delta):
|
|||
if !game_is_running:
|
||||
return
|
||||
process_snake_rotation()
|
||||
if(timer >= speed):
|
||||
if(timer * speed >= 0.25):
|
||||
timer = 0
|
||||
process_tiles()
|
||||
timer += delta
|
||||
|
|
|
@ -1,12 +1,62 @@
|
|||
extends Control
|
||||
|
||||
@onready var game_scene = load("res://Scene/Game.tscn").instantiate()
|
||||
var config = ConfigFile.new()
|
||||
|
||||
func _ready():
|
||||
# Set Default Focus
|
||||
$"MarginContainer/VBoxContainer/Tab Group/Menu Butons/Start Button".grab_focus()
|
||||
|
||||
#load Config
|
||||
var err = config.load("user://config.cfg")
|
||||
if err != OK:
|
||||
return
|
||||
# Read Config
|
||||
$"MarginContainer/VBoxContainer/Tab Group/Settings/GridSize/GridSize_Slider".value = config.get_value("Game Play", "grid_size", 10)
|
||||
$"MarginContainer/VBoxContainer/Tab Group/Settings/Speed/Speed_Slider".value = config.get_value("Game Play", "speed", 1)
|
||||
|
||||
# Apply Values to UI
|
||||
$"MarginContainer/VBoxContainer/Tab Group/Settings/GridSize/Value".text = " " + str(int($"MarginContainer/VBoxContainer/Tab Group/Settings/GridSize/GridSize_Slider".value))
|
||||
$"MarginContainer/VBoxContainer/Tab Group/Settings/Speed/Value".text = "%10.2f" % $"MarginContainer/VBoxContainer/Tab Group/Settings/Speed/Speed_Slider".value
|
||||
|
||||
|
||||
|
||||
func _on_start_button_pressed():
|
||||
$"AudioStreamPlayer Start".play()
|
||||
await $"AudioStreamPlayer Start".finished
|
||||
get_tree().change_scene_to_file("res://Scene/Game.tscn")
|
||||
|
||||
func _on_quit_button_pressed():
|
||||
#config.clear()
|
||||
#config.save("user://config.cfg")
|
||||
get_tree().quit()
|
||||
|
||||
|
||||
func _on_about_button_pressed():
|
||||
OS.shell_open("https://git.euph.dev/snoweuph/Snake")
|
||||
|
||||
|
||||
func _on_settings_button_pressed():
|
||||
$"MarginContainer/VBoxContainer/Tab Group".current_tab = 1
|
||||
$"MarginContainer/VBoxContainer/Tab Group/Settings/Back Button".grab_focus()
|
||||
|
||||
|
||||
func _on_back_button_pressed():
|
||||
$"MarginContainer/VBoxContainer/Tab Group".current_tab = 0
|
||||
$"MarginContainer/VBoxContainer/Tab Group/Menu Butons/Start Button".grab_focus()
|
||||
|
||||
func _on_grid_size_slider_value_changed(value):
|
||||
$"AudioStreamPlayer Change Value".play()
|
||||
$"MarginContainer/VBoxContainer/Tab Group/Settings/GridSize/Value".text = " " + str(int(value))
|
||||
config.set_value("Game Play", "grid_size", int(value))
|
||||
config.save("user://config.cfg")
|
||||
|
||||
|
||||
func _on_speed_slider_value_changed(value):
|
||||
$"AudioStreamPlayer Change Value".play()
|
||||
$"MarginContainer/VBoxContainer/Tab Group/Settings/Speed/Value".text = "%10.2f" % value
|
||||
config.set_value("Game Play", "speed", value)
|
||||
config.save("user://config.cfg")
|
||||
|
||||
func _on_focus_entered():
|
||||
$"AudioStreamPlayer Change UI".play()
|
||||
|
|
|
@ -8,7 +8,7 @@ custom_features=""
|
|||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="./"
|
||||
export_path="../../Downloads/Snake.x86_64"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
|
@ -38,3 +38,69 @@ unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
|||
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||
rm -rf \"{temp_dir}\""
|
||||
|
||||
[preset.1]
|
||||
|
||||
name="Windows Desktop"
|
||||
platform="Windows Desktop"
|
||||
runnable=true
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="../../Downloads/Snake.exe"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_encryption_key=""
|
||||
|
||||
[preset.1.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_script=1
|
||||
binary_format/embed_pck=false
|
||||
texture_format/bptc=true
|
||||
texture_format/s3tc=true
|
||||
texture_format/etc=false
|
||||
texture_format/etc2=false
|
||||
binary_format/architecture="x86_64"
|
||||
codesign/enable=false
|
||||
codesign/identity_type=0
|
||||
codesign/identity=""
|
||||
codesign/password=""
|
||||
codesign/timestamp=true
|
||||
codesign/timestamp_server_url=""
|
||||
codesign/digest_algorithm=1
|
||||
codesign/description=""
|
||||
codesign/custom_options=PackedStringArray()
|
||||
application/modify_resources=true
|
||||
application/icon=""
|
||||
application/console_wrapper_icon=""
|
||||
application/icon_interpolation=4
|
||||
application/file_version=""
|
||||
application/product_version=""
|
||||
application/company_name=""
|
||||
application/product_name=""
|
||||
application/file_description=""
|
||||
application/copyright=""
|
||||
application/trademarks=""
|
||||
ssh_remote_deploy/enabled=false
|
||||
ssh_remote_deploy/host="user@host_ip"
|
||||
ssh_remote_deploy/port="22"
|
||||
ssh_remote_deploy/extra_args_ssh=""
|
||||
ssh_remote_deploy/extra_args_scp=""
|
||||
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
|
||||
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
|
||||
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
|
||||
$settings = New-ScheduledTaskSettingsSet
|
||||
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
|
||||
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
|
||||
Start-ScheduledTask -TaskName godot_remote_debug
|
||||
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
|
||||
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||
|
|
|
@ -24,33 +24,46 @@ window/stretch/aspect="expand"
|
|||
|
||||
[input]
|
||||
|
||||
ui_accept={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194309,"physical_keycode":0,"key_label":0,"unicode":4194309,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194310,"physical_keycode":0,"key_label":0,"unicode":4194310,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
ui_select={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
left={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":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":true,"script":null)
|
||||
]
|
||||
}
|
||||
right={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":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":true,"script":null)
|
||||
]
|
||||
}
|
||||
up={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":119,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":11,"pressure":0.0,"pressed":true,"script":null)
|
||||
]
|
||||
}
|
||||
down={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
pause={
|
||||
"deadzone": 0.5,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":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":true,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue