This commit is contained in:
2024-01-12 21:42:21 +01:00
parent 1c900a23f8
commit 9d921e4992
17 changed files with 382 additions and 0 deletions

2
.gitattributes vendored Normal file
View File

@@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/

View File

@@ -0,0 +1,11 @@
[gd_resource type="MeshLibrary" load_steps=2 format=3 uid="uid://c2bhu7trxj2ef"]
[sub_resource type="PlaneMesh" id="PlaneMesh_3yk7f"]
[resource]
item/0/name = "Debug Plane"
item/0/mesh = SubResource("PlaneMesh_3yk7f")
item/0/mesh_transform = Transform3D(1, 0.495, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/0/shapes = []
item/0/navigation_mesh_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
item/0/navigation_layers = 1

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bt1ywpvnxswet"
path="res://.godot/imported/logo.png-7b927ab1f7edcf84dc521293c77580dc.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/branding/logo.png"
dest_files=["res://.godot/imported/logo.png-7b927ab1f7edcf84dc521293c77580dc.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: 81 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://2xwafdhiha6x"
path="res://.godot/imported/flashlight_effect.png-39f6e7fded086510ce3aace3d3d018c6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/world/flashlight_effect.png"
dest_files=["res://.godot/imported/flashlight_effect.png-39f6e7fded086510ce3aace3d3d018c6.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

1
icon.svg Normal file
View File

@@ -0,0 +1 @@
<svg height="128" width="128" xmlns="http://www.w3.org/2000/svg"><rect x="2" y="2" width="124" height="124" rx="14" fill="#363d52" stroke="#212532" stroke-width="4"/><g transform="scale(.101) translate(122 122)"><g fill="#fff"><path d="M105 673v33q407 354 814 0v-33z"/><path fill="#478cbf" d="m105 673 152 14q12 1 15 14l4 67 132 10 8-61q2-11 15-15h162q13 4 15 15l8 61 132-10 4-67q3-13 15-14l152-14V427q30-39 56-81-35-59-83-108-43 20-82 47-40-37-88-64 7-51 8-102-59-28-123-42-26 43-46 89-49-7-98 0-20-46-46-89-64 14-123 42 1 51 8 102-48 27-88 64-39-27-82-47-48 49-83 108 26 42 56 81zm0 33v39c0 276 813 276 813 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H447l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z"/><path d="M483 600c3 34 55 34 58 0v-86c-3-34-55-34-58 0z"/><circle cx="725" cy="526" r="90"/><circle cx="299" cy="526" r="90"/></g><g fill="#414042"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></g></svg>

After

Width:  |  Height:  |  Size: 950 B

37
icon.svg.import Normal file
View File

@@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://daqrj72cqovyo"
path="res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.svg"
dest_files=["res://.godot/imported/icon.svg-218a8f2b3041327d8a5756f3a245f83b.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
svg/scale=1.0
editor/scale_with_editor_scale=false
editor/convert_colors_with_editor_theme=false

66
project.godot Normal file
View File

@@ -0,0 +1,66 @@
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="Byte of Terror"
run/main_scene="res://scenes/menus/main_menu.tscn"
config/features=PackedStringArray("4.2", "Forward Plus")
boot_splash/bg_color=Color(0, 0, 0, 1)
boot_splash/show_image=false
config/icon="res://icon.svg"
config/auto_accept_quit.release=false
[display]
window/stretch/mode="canvas_items"
[input]
move_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)
]
}
move_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)
]
}
move_forward={
"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)
]
}
move_backward={
"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)
]
}
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)
]
}
mouse_capture={
"deadzone": 0.5,
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":1,"position":Vector2(142, 6),"global_position":Vector2(146, 47),"factor":1.0,"button_index":1,"canceled":false,"pressed":true,"double_click":false,"script":null)
]
}
flashlight={
"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":70,"key_label":0,"unicode":102,"echo":false,"script":null)
]
}
[rendering]
environment/defaults/default_environment="res://resources/environment.tres"
environment/defaults/default_clear_color.release=Color(0, 0, 0, 1)

View File

@@ -0,0 +1,9 @@
[gd_resource type="Environment" format=3 uid="uid://drn5fwa4uhv4m"]
[resource]
background_mode = 2
background_energy_multiplier = 0.0
ambient_light_source = 1
fog_enabled = true
fog_light_color = Color(0.00784314, 0.00784314, 0.00784314, 1)
fog_density = 1.0

23
scenes/levels/debug.tscn Normal file
View File

@@ -0,0 +1,23 @@
[gd_scene load_steps=4 format=3 uid="uid://ckad8stc13n83"]
[ext_resource type="PackedScene" uid="uid://gg5ph541e4p3" path="res://scenes/player.tscn" id="1_2585i"]
[sub_resource type="PlaneMesh" id="PlaneMesh_t51pb"]
size = Vector2(10, 10)
[sub_resource type="BoxShape3D" id="BoxShape3D_067df"]
size = Vector3(10, 0.01, 10)
[node name="Debug" type="Node3D"]
[node name="Ground" type="StaticBody3D" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Ground"]
mesh = SubResource("PlaneMesh_t51pb")
skeleton = NodePath("../..")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Ground"]
shape = SubResource("BoxShape3D_067df")
[node name="Player" parent="." instance=ExtResource("1_2585i")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)

10
scenes/levels/lvl_1.tscn Normal file
View File

@@ -0,0 +1,10 @@
[gd_scene load_steps=2 format=3 uid="uid://eok3g18b83f0"]
[ext_resource type="MeshLibrary" uid="uid://c2bhu7trxj2ef" path="res://assets/meshlib/housing.tres" id="2_68k16"]
[node name="Level1" type="Node3D"]
[node name="GridMap" type="GridMap" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.01438, 0)
mesh_library = ExtResource("2_68k16")
metadata/_editor_floor_ = Vector3(0, -1, 0)

View File

@@ -0,0 +1,74 @@
[gd_scene load_steps=6 format=3 uid="uid://dji1rniuusnmy"]
[ext_resource type="Script" path="res://scripts/menus/main_menu.gd" id="1_1osxu"]
[ext_resource type="Texture2D" uid="uid://bt1ywpvnxswet" path="res://assets/textures/branding/logo.png" id="2_ff1yt"]
[sub_resource type="LabelSettings" id="LabelSettings_yh38l"]
font_size = 55
[sub_resource type="InputEventAction" id="InputEventAction_bc05y"]
action = &"ui_accept"
[sub_resource type="Shortcut" id="Shortcut_fasub"]
events = [SubResource("InputEventAction_bc05y")]
[node name="MainMenu" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_1osxu")
[node name="LogoContainer" type="VBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -197.0
offset_top = -88.5
offset_right = 197.0
offset_bottom = 88.5
grow_horizontal = 2
grow_vertical = 2
[node name="Title" type="Label" parent="LogoContainer"]
layout_mode = 2
size_flags_horizontal = 4
text = "Byte of Terrror"
label_settings = SubResource("LabelSettings_yh38l")
[node name="Subtitle" type="Label" parent="LogoContainer"]
layout_mode = 2
size_flags_horizontal = 4
text = "ein Spiel von Yannik Ain und Merle ? für das"
[node name="TextureRect" type="TextureRect" parent="LogoContainer"]
custom_minimum_size = Vector2(180, 70)
layout_mode = 2
size_flags_horizontal = 4
texture = ExtResource("2_ff1yt")
expand_mode = 1
[node name="StartGame" type="Button" parent="."]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -53.0
offset_top = -93.0
offset_right = 53.0
offset_bottom = -62.0
grow_horizontal = 2
grow_vertical = 0
focus_mode = 0
shortcut = SubResource("Shortcut_fasub")
shortcut_in_tooltip = false
text = "Spiel starten"
[connection signal="pressed" from="StartGame" to="." method="_on_start_game_pressed"]

25
scenes/player.tscn Normal file
View File

@@ -0,0 +1,25 @@
[gd_scene load_steps=4 format=3 uid="uid://gg5ph541e4p3"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_8d33x"]
[ext_resource type="Texture2D" uid="uid://2xwafdhiha6x" path="res://assets/textures/world/flashlight_effect.png" id="1_rxdpg"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_2qx4s"]
[node name="Player" type="CharacterBody3D"]
script = ExtResource("1_8d33x")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("CapsuleShape3D_2qx4s")
[node name="Camera3D" type="Camera3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.7, 0)
[node name="SpotLight3D" type="SpotLight3D" parent="Camera3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.25, -0.25, 0)
light_energy = 3.0
light_indirect_energy = 4.0
light_volumetric_fog_energy = 4.0
light_projector = ExtResource("1_rxdpg")
shadow_enabled = true
spot_range = 43.1073
spot_angle = 52.0559

View File

@@ -0,0 +1,4 @@
extends Control
func _on_start_game_pressed() -> void:
pass # Replace with function body.

50
scripts/player.gd Normal file
View File

@@ -0,0 +1,50 @@
extends CharacterBody3D
const SPEED = 5.0
var gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity")
@onready var camera: Camera3D = $Camera3D
@onready var light: SpotLight3D = $Camera3D/SpotLight3D
var camera_senitivity: float = 0.5
func _ready() -> void:
capture()
func _physics_process(delta: float) -> void:
var input_dir := Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
var direction := (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
velocity.x = direction.x * SPEED * delta * 50
velocity.z = direction.z * SPEED * delta * 50
else:
velocity.x = move_toward(velocity.x, 0, SPEED * delta * 50)
velocity.z = move_toward(velocity.z, 0, SPEED * delta * 50)
move_and_slide()
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion && Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
rotate_y(-event.relative.x * camera_senitivity * 0.0025)
camera.rotate_x(-event.relative.y * camera_senitivity * 0.0015)
camera.rotation_degrees.x = clamp(camera.rotation_degrees.x, -60, 80)
if event.is_action_pressed("pause"):
capture(false)
if event.is_action_pressed("mouse_capture"):
capture()
if event.is_action_pressed("flashlight"):
light.visible = !light.visible
func _notification(what: int) -> void:
if what == NOTIFICATION_APPLICATION_FOCUS_OUT:
capture(false)
func capture(value: bool = true) -> void:
if value:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
else:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE