dev-base #36

Merged
Snoweuph merged 54 commits from dev-base into nightly 2023-04-05 21:01:03 +00:00
28 changed files with 5711 additions and 968 deletions

View file

@ -0,0 +1,84 @@
name: "godot-ci export"
on:
push:
branches:
- nightly
jobs:
export_game:
runs-on: ubuntu-latest
name: Export Game
steps:
- name: Checkout
uses: https://github.com/actions/checkout@v3.3.0
- name: Install Packages
id: wine_install
run: |
apt update -y && apt upgrade -y
apt install -y wine64 nodejs p7zip-full ca-certificates tree jq curl zip
echo "WINE_PATH=$(which wine64)" >> $GITHUB_OUTPUT
- name: Download Godot build-libs
run: |
mkdir -p /root/.local/share/godot/
wget -nv https://github.com/godotengine/godot/releases/download/4.0.2-stable/Godot_v4.0.2-stable_linux.x86_64.zip -O "/root/.local/share/godot/godot.zip"
wget -nv https://github.com/godotengine/godot/releases/download/4.0.2-stable/Godot_v4.0.2-stable_export_templates.tpz -O /root/.local/share/godot/godot_templates.tpz
- name: Setup Godot build-libs
run: |
7z x /root/.local/share/godot/godot.zip -o/root/.local/share/godot/godot_executable -y
chmod +x /root/.local/share/godot/godot_executable/Godot_v4.0.2-stable_linux.x86_64
unzip /root/.local/share/godot/godot_templates.tpz -d /root/.local/share/godot
mv /root/.local/share/godot/templates /root/.local/share/godot/4.0.2.stable
mkdir -p /root/.local/share/godot/export_templates
mv /root/.local/share/godot/4.0.2.stable /root/.local/share/godot/export_templates
/root/.local/share/godot/godot_executable/Godot_v4.0.2-stable_linux.x86_64 --version
- name: Export for Linux
run: |
mkdir -p ./builds/linux/
/root/.local/share/godot/godot_executable/Godot_v4.0.2-stable_linux.x86_64 /var/lib/actions/project.godot -q --headless --export-release "Linux/X11" ./builds/linux/Game.x86_64
- name: Package for Linux
run: |
cd builds
tar -czvf linux.tar.gz -C linux/ .
- name: Export for Windows
run: |
mkdir -p ./builds/windows/
/root/.local/share/godot/godot_executable/Godot_v4.0.2-stable_linux.x86_64 /var/lib/actions/project.godot -q --headless --export-release "Windows Desktop" ./builds/windows/Game.exe
- name: Package for Windows
run: |
cd builds
cd windows; zip -r ../windows.zip *
cd ..
- name: Create Release
run: |
echo "Getting last Release Tag"
VERSION=$(curl -X 'GET' 'https://git.euph.dev/api/v1/repos/${{ github.repository }}/releases?page=1&limit=1' -H 'accept: application/json' -H 'Authorization: token ${{ secrets.RELEASE_TOKEN }}' )
echo $VERSION | jq -r '.[0].tag_name'
VERSION=$(echo $VERSION | jq -r '.[0].tag_name' | awk -F. -v OFS=. '{$NF += 1 ; print}')
echo "Generate new Release with tag: $VERSION"
ID=$(curl -X 'POST' \
'https://git.euph.dev/api/v1/repos/${{ github.repository }}/releases' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: token ${{ secrets.RELEASE_TOKEN }}' \
-d "{
\"body\": \"Automated Nightly Build\",
\"draft\": true,
\"name\": \"Automated Nightly Release $VERSION\",
\"prerelease\": true,
\"tag_name\": \"$VERSION\"
}")
ID=$(echo $ID | jq -r '.id')
echo $ID Upload Linux
curl -X 'POST' \
"https://git.euph.dev/api/v1/repos/${{ github.repository }}/releases/$ID/assets?name=Linux.tar.gz" \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-H 'Authorization: token ${{ secrets.RELEASE_TOKEN }}' \
-F 'attachment=@./builds/linux.tar.gz;type=application/gzip'
echo $ID Upload Windows
curl -X 'POST' \
"https://git.euph.dev/api/v1/repos/${{ github.repository }}/releases/$ID/assets?name=Windows.zip" \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-H 'Authorization: token ${{ secrets.RELEASE_TOKEN }}' \
-F 'attachment=@./builds/windows.zip;type=application/gzip'

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ctjc4gqtv3qc6"
path="res://.godot/imported/colony-brown.png-d928b571d768ac6c176f3573fe704ab7.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Textures/Tilesets/colony-brown.png"
dest_files=["res://.godot/imported/colony-brown.png-d928b571d768ac6c176f3573fe704ab7.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://cjkgicvayjjol"
path="res://.godot/imported/colony-gray.png-9a34ec3b88057b1852fb487901160fe8.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Textures/Tilesets/colony-gray.png"
dest_files=["res://.godot/imported/colony-gray.png-9a34ec3b88057b1852fb487901160fe8.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://chbqdp7mae1vu"
path="res://.godot/imported/colony-green.png-7ee3c69f1f46aa9cb608adfe2dc4035e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Textures/Tilesets/colony-green.png"
dest_files=["res://.godot/imported/colony-green.png-7ee3c69f1f46aa9cb608adfe2dc4035e.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

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dpqdlxd60d8be"
path="res://.godot/imported/colony-red.png-1c62c66c6ffbb95f273cd5ad854bf691.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Textures/Tilesets/colony-red.png"
dest_files=["res://.godot/imported/colony-red.png-1c62c66c6ffbb95f273cd5ad854bf691.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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dx5k5qa1pwbfl"
path="res://.godot/imported/basic_enemy.png-86528a00f666ed79fdb26797653efdd4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Textures/basic_enemy.png"
dest_files=["res://.godot/imported/basic_enemy.png-86528a00f666ed79fdb26797653efdd4.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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

View file

@ -16,9 +16,9 @@ dest_files=["res://.godot/imported/color_cube.png-4881adb426dcdbd1db4cca9d44eddf
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

File diff suppressed because it is too large Load diff

BIN
Guidelines/ColorPallet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 240 B

View file

@ -2,23 +2,23 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://vdjct0e80o51"
path="res://.godot/imported/colony.png-7e0f1c6e1f6ff8cbe6d6c840c822d3ba.ctex"
uid="uid://cua6xdncubtid"
path="res://.godot/imported/ColorPallet.png-d411989842053c34062059f3968fb7f0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Assets/Textures/Tilesets/colony.png"
dest_files=["res://.godot/imported/colony.png-7e0f1c6e1f6ff8cbe6d6c840c822d3ba.ctex"]
source_file="res://Guidelines/ColorPallet.png"
dest_files=["res://.godot/imported/ColorPallet.png-d411989842053c34062059f3968fb7f0.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false

399
Guidelines/ColorPallet.tres Normal file
View file

@ -0,0 +1,399 @@
[gd_resource type="Resource" load_steps=67 format=2]
[ext_resource path="res://src/Palette/PaletteColor.gd" type="Script" id=1]
[ext_resource path="res://src/Palette/Palette.gd" type="Script" id=2]
[sub_resource type="Resource" id=1]
script = ExtResource( 1 )
color = Color( 0.901961, 0.360784, 0.4, 1 )
index = 0
[sub_resource type="Resource" id=2]
script = ExtResource( 1 )
color = Color( 0.901961, 0.592157, 0.360784, 1 )
index = 1
[sub_resource type="Resource" id=3]
script = ExtResource( 1 )
color = Color( 0.894118, 0.901961, 0.360784, 1 )
index = 2
[sub_resource type="Resource" id=4]
script = ExtResource( 1 )
color = Color( 0.360784, 0.901961, 0.360784, 1 )
index = 3
[sub_resource type="Resource" id=5]
script = ExtResource( 1 )
color = Color( 0.360784, 0.901961, 0.733333, 1 )
index = 4
[sub_resource type="Resource" id=6]
script = ExtResource( 1 )
color = Color( 0.360784, 0.815686, 0.901961, 1 )
index = 5
[sub_resource type="Resource" id=7]
script = ExtResource( 1 )
color = Color( 0.360784, 0.423529, 0.901961, 1 )
index = 6
[sub_resource type="Resource" id=8]
script = ExtResource( 1 )
color = Color( 0.545098, 0.360784, 0.901961, 1 )
index = 7
[sub_resource type="Resource" id=9]
script = ExtResource( 1 )
color = Color( 0.74902, 0.298039, 0.329412, 1 )
index = 8
[sub_resource type="Resource" id=10]
script = ExtResource( 1 )
color = Color( 0.74902, 0.490196, 0.298039, 1 )
index = 9
[sub_resource type="Resource" id=11]
script = ExtResource( 1 )
color = Color( 0.741176, 0.74902, 0.298039, 1 )
index = 10
[sub_resource type="Resource" id=12]
script = ExtResource( 1 )
color = Color( 0.298039, 0.74902, 0.298039, 1 )
index = 11
[sub_resource type="Resource" id=13]
script = ExtResource( 1 )
color = Color( 0.298039, 0.74902, 0.611765, 1 )
index = 12
[sub_resource type="Resource" id=14]
script = ExtResource( 1 )
color = Color( 0.298039, 0.682353, 0.74902, 1 )
index = 13
[sub_resource type="Resource" id=15]
script = ExtResource( 1 )
color = Color( 0.298039, 0.352941, 0.74902, 1 )
index = 14
[sub_resource type="Resource" id=16]
script = ExtResource( 1 )
color = Color( 0.458824, 0.298039, 0.74902, 1 )
index = 15
[sub_resource type="Resource" id=17]
script = ExtResource( 1 )
color = Color( 0.501961, 0.2, 0.223529, 1 )
index = 16
[sub_resource type="Resource" id=18]
script = ExtResource( 1 )
color = Color( 0.501961, 0.32549, 0.2, 1 )
index = 17
[sub_resource type="Resource" id=19]
script = ExtResource( 1 )
color = Color( 0.498039, 0.501961, 0.2, 1 )
index = 18
[sub_resource type="Resource" id=20]
script = ExtResource( 1 )
color = Color( 0.2, 0.501961, 0.2, 1 )
index = 19
[sub_resource type="Resource" id=21]
script = ExtResource( 1 )
color = Color( 0.2, 0.501961, 0.411765, 1 )
index = 20
[sub_resource type="Resource" id=22]
script = ExtResource( 1 )
color = Color( 0.2, 0.45098, 0.501961, 1 )
index = 21
[sub_resource type="Resource" id=23]
script = ExtResource( 1 )
color = Color( 0.2, 0.235294, 0.501961, 1 )
index = 22
[sub_resource type="Resource" id=24]
script = ExtResource( 1 )
color = Color( 0.305882, 0.2, 0.501961, 1 )
index = 23
[sub_resource type="Resource" id=25]
script = ExtResource( 1 )
color = Color( 0.4, 0.160784, 0.180392, 1 )
index = 24
[sub_resource type="Resource" id=26]
script = ExtResource( 1 )
color = Color( 0.4, 0.262745, 0.160784, 1 )
index = 25
[sub_resource type="Resource" id=27]
script = ExtResource( 1 )
color = Color( 0.396078, 0.4, 0.160784, 1 )
index = 26
[sub_resource type="Resource" id=28]
script = ExtResource( 1 )
color = Color( 0.160784, 0.4, 0.160784, 1 )
index = 27
[sub_resource type="Resource" id=29]
script = ExtResource( 1 )
color = Color( 0.160784, 0.4, 0.32549, 1 )
index = 28
[sub_resource type="Resource" id=30]
script = ExtResource( 1 )
color = Color( 0.160784, 0.364706, 0.4, 1 )
index = 29
[sub_resource type="Resource" id=31]
script = ExtResource( 1 )
color = Color( 0.160784, 0.188235, 0.4, 1 )
index = 30
[sub_resource type="Resource" id=32]
script = ExtResource( 1 )
color = Color( 0.243137, 0.160784, 0.4, 1 )
index = 31
[sub_resource type="Resource" id=33]
script = ExtResource( 1 )
color = Color( 0.278431, 0.113725, 0.12549, 1 )
index = 32
[sub_resource type="Resource" id=34]
script = ExtResource( 1 )
color = Color( 0.278431, 0.184314, 0.113725, 1 )
index = 33
[sub_resource type="Resource" id=35]
script = ExtResource( 1 )
color = Color( 0.27451, 0.278431, 0.113725, 1 )
index = 34
[sub_resource type="Resource" id=36]
script = ExtResource( 1 )
color = Color( 0.113725, 0.278431, 0.113725, 1 )
index = 35
[sub_resource type="Resource" id=37]
script = ExtResource( 1 )
color = Color( 0.113725, 0.278431, 0.231373, 1 )
index = 36
[sub_resource type="Resource" id=38]
script = ExtResource( 1 )
color = Color( 0.113725, 0.254902, 0.278431, 1 )
index = 37
[sub_resource type="Resource" id=39]
script = ExtResource( 1 )
color = Color( 0.113725, 0.129412, 0.278431, 1 )
index = 38
[sub_resource type="Resource" id=40]
script = ExtResource( 1 )
color = Color( 0.168627, 0.113725, 0.278431, 1 )
index = 39
[sub_resource type="Resource" id=41]
script = ExtResource( 1 )
color = Color( 0.2, 0.0823529, 0.0901961, 1 )
index = 40
[sub_resource type="Resource" id=42]
script = ExtResource( 1 )
color = Color( 0.2, 0.129412, 0.0823529, 1 )
index = 41
[sub_resource type="Resource" id=43]
script = ExtResource( 1 )
color = Color( 0.2, 0.2, 0.0823529, 1 )
index = 42
[sub_resource type="Resource" id=44]
script = ExtResource( 1 )
color = Color( 0.0823529, 0.2, 0.0823529, 1 )
index = 43
[sub_resource type="Resource" id=45]
script = ExtResource( 1 )
color = Color( 0.0823529, 0.2, 0.164706, 1 )
index = 44
[sub_resource type="Resource" id=46]
script = ExtResource( 1 )
color = Color( 0.0823529, 0.184314, 0.2, 1 )
index = 45
[sub_resource type="Resource" id=47]
script = ExtResource( 1 )
color = Color( 0.0823529, 0.0941176, 0.2, 1 )
index = 46
[sub_resource type="Resource" id=48]
script = ExtResource( 1 )
color = Color( 0.121569, 0.0823529, 0.2, 1 )
index = 47
[sub_resource type="Resource" id=49]
script = ExtResource( 1 )
color = Color( 0.14902, 0.0627451, 0.0705882, 1 )
index = 48
[sub_resource type="Resource" id=50]
script = ExtResource( 1 )
color = Color( 0.14902, 0.0980392, 0.0627451, 1 )
index = 49
[sub_resource type="Resource" id=51]
script = ExtResource( 1 )
color = Color( 0.14902, 0.14902, 0.0627451, 1 )
index = 50
[sub_resource type="Resource" id=52]
script = ExtResource( 1 )
color = Color( 0.0627451, 0.14902, 0.0627451, 1 )
index = 51
[sub_resource type="Resource" id=53]
script = ExtResource( 1 )
color = Color( 0.0627451, 0.14902, 0.121569, 1 )
index = 52
[sub_resource type="Resource" id=54]
script = ExtResource( 1 )
color = Color( 0.0627451, 0.137255, 0.14902, 1 )
index = 53
[sub_resource type="Resource" id=55]
script = ExtResource( 1 )
color = Color( 0.0627451, 0.0705882, 0.14902, 1 )
index = 54
[sub_resource type="Resource" id=56]
script = ExtResource( 1 )
color = Color( 0.0862745, 0.0627451, 0.14902, 1 )
index = 55
[sub_resource type="Resource" id=57]
script = ExtResource( 1 )
color = Color( 0.901961, 0.901961, 0.901961, 1 )
index = 56
[sub_resource type="Resource" id=58]
script = ExtResource( 1 )
color = Color( 0.74902, 0.74902, 0.74902, 1 )
index = 57
[sub_resource type="Resource" id=59]
script = ExtResource( 1 )
color = Color( 0.501961, 0.501961, 0.501961, 1 )
index = 58
[sub_resource type="Resource" id=60]
script = ExtResource( 1 )
color = Color( 0.4, 0.4, 0.4, 1 )
index = 59
[sub_resource type="Resource" id=61]
script = ExtResource( 1 )
color = Color( 0.278431, 0.278431, 0.278431, 1 )
index = 60
[sub_resource type="Resource" id=62]
script = ExtResource( 1 )
color = Color( 0.2, 0.2, 0.2, 1 )
index = 61
[sub_resource type="Resource" id=63]
script = ExtResource( 1 )
color = Color( 0.14902, 0.14902, 0.14902, 1 )
index = 62
[sub_resource type="Resource" id=64]
script = ExtResource( 1 )
color = Color( 0.101961, 0.101961, 0.101961, 1 )
index = 63
[resource]
resource_name = "ColorPallet"
script = ExtResource( 2 )
name = "Color Pallet"
comment = ""
width = 8
height = 8
colors = {
0: SubResource( 1 ),
1: SubResource( 2 ),
2: SubResource( 3 ),
3: SubResource( 4 ),
4: SubResource( 5 ),
5: SubResource( 6 ),
6: SubResource( 7 ),
7: SubResource( 8 ),
8: SubResource( 9 ),
9: SubResource( 10 ),
10: SubResource( 11 ),
11: SubResource( 12 ),
12: SubResource( 13 ),
13: SubResource( 14 ),
14: SubResource( 15 ),
15: SubResource( 16 ),
16: SubResource( 17 ),
17: SubResource( 18 ),
18: SubResource( 19 ),
19: SubResource( 20 ),
20: SubResource( 21 ),
21: SubResource( 22 ),
22: SubResource( 23 ),
23: SubResource( 24 ),
24: SubResource( 25 ),
25: SubResource( 26 ),
26: SubResource( 27 ),
27: SubResource( 28 ),
28: SubResource( 29 ),
29: SubResource( 30 ),
30: SubResource( 31 ),
31: SubResource( 32 ),
32: SubResource( 33 ),
33: SubResource( 34 ),
34: SubResource( 35 ),
35: SubResource( 36 ),
36: SubResource( 37 ),
37: SubResource( 38 ),
38: SubResource( 39 ),
39: SubResource( 40 ),
40: SubResource( 41 ),
41: SubResource( 42 ),
42: SubResource( 43 ),
43: SubResource( 44 ),
44: SubResource( 45 ),
45: SubResource( 46 ),
46: SubResource( 47 ),
47: SubResource( 48 ),
48: SubResource( 49 ),
49: SubResource( 50 ),
50: SubResource( 51 ),
51: SubResource( 52 ),
52: SubResource( 53 ),
53: SubResource( 54 ),
54: SubResource( 55 ),
55: SubResource( 56 ),
56: SubResource( 57 ),
57: SubResource( 58 ),
58: SubResource( 59 ),
59: SubResource( 60 ),
60: SubResource( 61 ),
61: SubResource( 62 ),
62: SubResource( 63 ),
63: SubResource( 64 )
}
colors_max = 64

View file

@ -0,0 +1,2 @@
- Base Sprite Size is 16x16
- Small Sprite Size is 8x8

View file

@ -1,12 +1,25 @@
# 2DHackAndSlay
## Branches
- [stable](https://git.euph.dev/GameDev/2DHackAndSlay/src/branch/stable) - This is the Most stable branch and only will get PRs from [nightly](https://git.euph.dev/GameDev/2DHackAndSlay/src/branch/nightly)
- [nightly](https://git.euph.dev/GameDev/2DHackAndSlay/src/branch/nightly) - This Branch will only get PRs from [dev-base](https://git.euph.dev/GameDev/2DHackAndSlay/src/branch/dev-base)its meant for testing
- [dev-base](https://git.euph.dev/GameDev/2DHackAndSlay/src/branch/dev-base) - On This branch the Diffrent dev branches will be merged and code may be written to combine everything. when this branch is at a somewhat stable branch it gets a PR to [nightly](https://git.euph.dev/GameDev/2DHackAndSlay/src/branch/nightly)
- dev-* - Dev branches with their respective goal which will be merged into dev-base
## Code Linting Rules
### Use Tabs
Tabs are just cooler
### Use Sign-Form instead of Text-Form
#### Why
There are a lot of Operators in godot, and most are based around signs, so for consistency we stay at the Sign-Forms
#### Boolean operators
- `&&` instead of `and`
- `||` instead of `or`
- `!` instead of `not`
## Resources used:
### Game Art

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,132 @@
extends RigidBody2D
@export_group("Movement Properties")
@export var speed := 100.0
@export var turn_speed := 25.0
@export_group("Vision Properties")
@export var ray : RayCast2D
@export_flags_2d_physics var player_collision_layer := 2
@export var max_view_distance := 120.0
@export_range(0.0, 360.0) var angle_cone_of_vision := 120.0
@export_range(0, 72) var sweeping_steps := 34.0
@export var debug_vision := false
@export_group("Behaviour Properties")
@export var follow_keep_distance := 30.0
enum STATES {
IDLE,
TARGETING
}
var state : STATES
var target_positons : Array
var target_distance : float
func _ready():
# Set Raycast into view Direction
ray.target_position = Vector2(max_view_distance, 0)
pass
func swipe_view() -> Array:
# Set Raycast to starting position
ray.rotation_degrees = -angle_cone_of_vision / 2
# Create Array to Store Angles of Hits
var hit_angles : Array
# Clear Player Positions Array
target_positons.clear()
# Reset Targets distance to Infinity
target_distance = INF
for step in sweeping_steps + 1:
# Check Ray
ray.force_raycast_update()
if ray.is_colliding():
# Get Collider
var collider = ray.get_collider()
var collider_class = collider.get_class()
var collision_layer : int
# Get Collision Layer
if collider_class == "TileMap":
collider = collider as TileMap
collision_layer = collider.tile_set.get_physics_layer_collision_layer(0)
else:
collision_layer = collider.get_collision_layer()
# Break if No relevant Collision
if collision_layer & player_collision_layer > 0:
# Checking Collision Layer
hit_angles.append(ray.rotation_degrees)
target_positons.append(to_local(ray.get_collision_point()))
# Check distance
target_distance = min(target_distance, ray.get_collision_point().distance_to(self.global_position))
# Rotate Ray
ray.rotation_degrees += angle_cone_of_vision / sweeping_steps
return hit_angles
func look_at_player(delta : float) -> float:
# Get All Angles at which the Player can be seen
var hit_angles = swipe_view()
# If The Player cant be seen, return and do nothing
if hit_angles.size() <= 0:
state = STATES.IDLE
return 0
state = STATES.TARGETING
# Calculate Average Angle Of Player
var average_angle : float
for angle in hit_angles:
average_angle += angle
average_angle /= hit_angles.size()
# Rotate towards Player, but limit it by rotation speed
self.rotation_degrees += clampf(average_angle, -2 * PI * delta * turn_speed, 2 * PI * delta * turn_speed)
return average_angle
func follow_player(angle : float, delta : float):
if(target_distance > follow_keep_distance):
self.apply_central_force(Vector2.RIGHT.rotated(self.rotation).rotated(deg_to_rad(angle)) * speed * delta * 60)
pass
func _physics_process(delta: float):
var angle := look_at_player(delta)
match state:
STATES.TARGETING:
follow_player(angle, delta)
STATES.IDLE:
# Do Idle Stuff
print("Dam, Nice a pause, time for a Coffee")
pass
func _process(delta: float):
if debug_vision:
queue_redraw()
pass
func _draw():
# Draw a Debug Arc in case that Debug Vision is enabled
if debug_vision:
# Draw All Ray Positions
var angle = -angle_cone_of_vision / 2
for step in sweeping_steps + 1:
self.draw_line(Vector2(), Vector2(max_view_distance,0).rotated(deg_to_rad(angle)), Color.DARK_RED, 0.5, false)
angle += angle_cone_of_vision / sweeping_steps
# Draw Ray Arc
self.draw_arc(Vector2(), max_view_distance, deg_to_rad(-angle_cone_of_vision / 2), deg_to_rad(angle_cone_of_vision / 2), sweeping_steps + 1, Color.RED, 0.5, false)
# Draw A Circle Around the Player if hes seen
for pos in target_positons:
self.draw_circle(pos, 1, Color.RED)
pass

9
Scripts/GameManager.gd Normal file
View file

@ -0,0 +1,9 @@
extends Node
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

View file

@ -0,0 +1,24 @@
extends CharacterBody2D
@export var speed = 100
@export_range(0, 1) var damping_factor := 0.6
func get_move_vector():
var input_direction = Input.get_vector("move_left", "move_right", "move_up", "move_down").normalized()
return input_direction
func move_player(delta : float):
if get_move_vector() == Vector2.ZERO:
# Damp Players Velocity if no Input
self.velocity = self.velocity * (1 - min(1, damping_factor * 60 * delta))
else:
# Set Players Velocity to the Input Direction in the Players Speed
self.velocity = get_move_vector() * speed * delta * 60
# Update The Players Physics Calculations
self.move_and_slide()
pass
func _physics_process(delta : float):
move_player(delta)
pass

View file

@ -1,18 +0,0 @@
extends CharacterBody2D
@export var speed = 50
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
func get_input():
var input_direction = Input.get_vector("move_left", "move_right", "move_up", "move_down")
velocity = input_direction * speed
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _physics_process(delta):
get_input()
move_and_slide()

106
export_presets.cfg Normal file
View file

@ -0,0 +1,106 @@
[preset.0]
name="Linux/X11"
platform="Linux/X11"
runnable=true
dedicated_server=false
custom_features=""
export_filter="all_resources"
include_filter=""
exclude_filter=""
export_path="../../Downloads/2d Hack And Slay.x86_64"
encryption_include_filters=""
encryption_exclude_filters=""
encrypt_pck=false
encrypt_directory=false
script_encryption_key=""
[preset.0.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"
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="#!/usr/bin/env bash
export DISPLAY=:0
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
\"{temp_dir}/{exe_name}\" {cmd_args}"
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=""
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}'"

View file

@ -14,9 +14,15 @@ config/name="2d Hack And Slay"
run/main_scene="res://Scenes/Test Scene.tscn"
config/features=PackedStringArray("4.0")
[autoload]
GameManager="*res://Scripts/GameManager.gd"
[display]
window/stretch/aspect="ignore"
window/stretch/mode="viewport"
window/stretch/aspect="expand"
window/stretch/scale=0.7
[editor]
@ -57,6 +63,17 @@ move_right={
, 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)
]
}
do_shake={
"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":32,"key_label":0,"unicode":32,"echo":false,"script":null)
]
}
[layer_names]
2d_physics/layer_1="Map"
2d_physics/layer_2="Player"
2d_physics/layer_3="Enemys"
[physics]