Initial commit

This commit is contained in:
Jonas Braus
2024-08-06 04:49:41 +02:00
commit f52b63b753
13 changed files with 423 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
# Normalize EOL for all files that Git considers text files.
* text=auto eol=lf
+2
View File
@@ -0,0 +1,2 @@
# Godot 4+ specific ignores
.godot/
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+34
View File
@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b5oukegnirc4m"
path="res://.godot/imported/Icon.png-33e63688031d53466d4d656c73cf10ca.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Icon.png"
dest_files=["res://.godot/imported/Icon.png-33e63688031d53466d4d656c73cf10ca.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
+60
View File
@@ -0,0 +1,60 @@
class_name PlatformData
const vertices = [
Vector3(-1, 0, -1),
Vector3(1, 0, -1),
Vector3(1, 0.2, -1),
Vector3(-1, 0.2, -1),
Vector3(-1, 0, 1),
Vector3(1, 0, 1),
Vector3(1, 0.2, 1),
Vector3(-1, 0.2, 1)
]
const triangles = [
[3, 7, 2, 6],
[0, 3, 1, 2],
[5, 6, 4, 7],
[1, 5, 0, 4],
[4, 7, 0, 3],
[1, 2, 5, 6]
]
const normals = [
Vector3(0, 0, 1),
Vector3(0, -1, 0),
Vector3(0, 1, 0),
Vector3(0, 0, -1),
Vector3(-1, 0, 0),
Vector3(1, 0, 0)
]
const color = [
Color(0.8705, 0.7254, 0.5254),
Color(0.9294, 0.3019, 0.4313),
Color(0.8588, 0.4235, 0.8666)
]
static func defaultMat():
var tempMaterial = StandardMaterial3D.new()
tempMaterial.roughness = 1
tempMaterial.specular_mode = BaseMaterial3D.SPECULAR_DISABLED
tempMaterial.metallic = 0
tempMaterial.metallic_specular = 0
return tempMaterial
static func material1():
var tempMaterial = defaultMat()
tempMaterial.albedo_color = color[0]
return tempMaterial
static func material2():
var tempMaterial = defaultMat()
tempMaterial.albedo_color = color[1]
return tempMaterial
static func material3():
var tempMaterial = defaultMat()
tempMaterial.albedo_color = color[2]
return tempMaterial
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 862 KiB

+35
View File
@@ -0,0 +1,35 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bj5w0ki1au4jr"
path.s3tc="res://.godot/imported/Sky.png-8c43aacd3d620d81964b518cb41623f6.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://Sky.png"
dest_files=["res://.godot/imported/Sky.png-8c43aacd3d620d81964b518cb41623f6.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
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=0
+1
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 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 814 0v-39l-134 12-5 69q-2 10-14 13l-162 11q-12 0-16-11l-10-65H446l-10 65q-4 11-16 11l-162-11q-12-3-14-13l-5-69z" fill="#478cbf"/><path d="M483 600c0 34 58 34 58 0v-86c0-34-58-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: 949 B

+37
View File
@@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://kqmcbc0qwii1"
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
+172
View File
@@ -0,0 +1,172 @@
extends MeshInstance3D
var isActive = false
var inMenu = false
var randomMaterial : int
var randomAxis : int
var last : Node3D
var vertices : Array
var newVerts : Array
var speed = 2.0
var score = 1
const maxMoveDistance = 3.0
var velocity : Vector3
var cam : Camera3D
var labelScore : Label
var rng = RandomNumberGenerator.new()
func calculate_randoms():
randomMaterial = rng.randi_range(0, 2)
randomAxis = rng.randi_range(0, 1)
if last != null:
while randomMaterial == last.randomMaterial:
randomMaterial = rng.randi_range(0, 2)
while randomAxis == last.randomAxis:
randomAxis = rng.randi_range(0, 1)
if randomAxis == 0:
velocity.z = 0
velocity.x = speed
else:
velocity.z = speed
velocity.x = 0
func rebuild_mesh(vertTemplate):
var tempVertices = []
var st = SurfaceTool.new()
st.begin(Mesh.PRIMITIVE_TRIANGLES)
match randomMaterial:
0:
st.set_material(PlatformData.material1())
1:
st.set_material(PlatformData.material2())
2:
st.set_material(PlatformData.material3())
var index = 0
for i in range(0, 6):
st.set_uv(Vector2(0, 0))
st.set_normal(PlatformData.normals[i])
st.add_vertex(vertTemplate[PlatformData.triangles[i][0]])
st.set_uv(Vector2(0, 1))
st.set_normal(PlatformData.normals[i])
st.add_vertex(vertTemplate[PlatformData.triangles[i][1]])
st.set_uv(Vector2(1, 1))
st.set_normal(PlatformData.normals[i])
st.add_vertex(vertTemplate[PlatformData.triangles[i][2]])
st.set_uv(Vector2(1, 0))
st.set_normal(PlatformData.normals[i])
st.add_vertex(vertTemplate[PlatformData.triangles[i][3]])
tempVertices.append(vertTemplate[PlatformData.triangles[i][0]])
tempVertices.append(vertTemplate[PlatformData.triangles[i][1]])
tempVertices.append(vertTemplate[PlatformData.triangles[i][2]])
tempVertices.append(vertTemplate[PlatformData.triangles[i][3]])
st.add_index(index + 2)
st.add_index(index + 3)
st.add_index(index + 1)
st.add_index(index + 2)
st.add_index(index + 1)
st.add_index(index + 0)
index += 4
mesh = st.commit()
vertices = tempVertices
func _ready():
if name == "Platform1":
isActive = true
if isActive:
last = %Base
if not inMenu and name == "Platform1":
cam = %Camera3D
labelScore = %Score
calculate_randoms()
rebuild_mesh(PlatformData.vertices)
func _physics_process(delta):
if not isActive:
return
if abs(position.x) >= maxMoveDistance || abs(position.z) >= maxMoveDistance:
velocity.x *= -1
velocity.z *= -1
translate(velocity * delta)
if Input.is_action_just_pressed("Click") and not inMenu:
isActive = false
cam.translate(Vector3(0, 0.1, 0))
var otherVerts = last.vertices
var _newVerts = []
if len(last.newVerts) == 0:
_newVerts = PlatformData.vertices.duplicate()
else:
_newVerts = last.newVerts.duplicate()
if randomAxis == 0:
var currentX = position.x
var lastX = last.position.x
if vertices[0].x + currentX < otherVerts[0].x + lastX:
_newVerts[0].x = otherVerts[0].x - currentX + lastX
_newVerts[3].x = otherVerts[0].x - currentX + lastX
_newVerts[7].x = otherVerts[0].x - currentX + lastX
_newVerts[4].x = otherVerts[0].x - currentX + lastX
if vertices[3].x + currentX > otherVerts[3].x + lastX:
_newVerts[1].x = otherVerts[3].x - currentX + lastX
_newVerts[2].x = otherVerts[3].x - currentX + lastX
_newVerts[5].x = otherVerts[3].x - currentX + lastX
_newVerts[6].x = otherVerts[3].x - currentX + lastX
if vertices[3].x + currentX < otherVerts[0].x + lastX or vertices[0].x + currentX > otherVerts[3].x + lastX:
get_tree().reload_current_scene()
else:
var currentZ = position.z
var lastZ = last.position.z
if vertices[0].z + currentZ < otherVerts[0].z + lastZ:
_newVerts[0].z = otherVerts[0].z - currentZ + lastZ
_newVerts[1].z = otherVerts[0].z - currentZ + lastZ
_newVerts[2].z = otherVerts[0].z - currentZ + lastZ
_newVerts[3].z = otherVerts[0].z - currentZ + lastZ
if vertices[3].z + currentZ > otherVerts[3].z + lastZ:
_newVerts[4].z = otherVerts[3].z - currentZ + lastZ
_newVerts[5].z = otherVerts[3].z - currentZ + lastZ
_newVerts[6].z = otherVerts[3].z - currentZ + lastZ
_newVerts[7].z = otherVerts[3].z - currentZ + lastZ
if vertices[3].z + currentZ < otherVerts[0].z + lastZ or vertices[0].z + currentZ > otherVerts[3].z + lastZ:
get_tree().reload_current_scene()
newVerts = _newVerts
rebuild_mesh(_newVerts)
var inst = load("res://platform.tscn").instantiate()
inst.cam = cam
inst.labelScore = labelScore
get_parent().add_child(inst)
inst.isActive = false
inst.translate(Vector3(0, 0.2, 0) + position)
inst.last = self
inst.speed = speed + 0.2
inst.calculate_randoms()
inst.rebuild_mesh(newVerts)
labelScore.text = str(score)
inst.score = score + 1
inst.isActive = true
+6
View File
@@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://1t1p7sfwxisv"]
[ext_resource type="Script" path="res://platform.gd" id="1_sqti0"]
[node name="Platform" type="MeshInstance3D"]
script = ExtResource("1_sqti0")
+30
View File
@@ -0,0 +1,30 @@
; 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="Stack"
config/features=PackedStringArray("4.2", "Forward Plus")
boot_splash/image="res://Icon.png"
config/icon="res://Icon.png"
[input]
Click={
"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)
, 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":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
[rendering]
anti_aliasing/quality/screen_space_aa=1
anti_aliasing/quality/use_taa=true
+44
View File
@@ -0,0 +1,44 @@
[gd_scene load_steps=6 format=3 uid="uid://dpeo5y05nt5mi"]
[ext_resource type="PackedScene" uid="uid://1t1p7sfwxisv" path="res://platform.tscn" id="1_jquwx"]
[ext_resource type="Texture2D" uid="uid://bj5w0ki1au4jr" path="res://Sky.png" id="2_rqa7j"]
[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_qnpi8"]
panorama = ExtResource("2_rqa7j")
[sub_resource type="Sky" id="Sky_eicqm"]
sky_material = SubResource("PanoramaSkyMaterial_qnpi8")
[sub_resource type="Environment" id="Environment_20yoh"]
background_mode = 2
sky = SubResource("Sky_eicqm")
tonemap_mode = 3
volumetric_fog_density = 0.01
[node name="World" type="Node3D"]
[node name="Overlay" type="CanvasLayer" parent="."]
[node name="Score" type="Label" parent="Overlay"]
unique_name_in_owner = true
offset_right = 40.0
offset_bottom = 23.0
[node name="Camera3D" type="Camera3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(-0.618408, 0.567333, -0.543787, 2.98023e-08, 0.691967, 0.721929, 0.785857, 0.446447, -0.427918, -4.23832, 6.42557, -3.40231)
[node name="Base" parent="." instance=ExtResource("1_jquwx")]
unique_name_in_owner = true
skeleton = NodePath("../Platform1")
[node name="Platform1" parent="." instance=ExtResource("1_jquwx")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.2, 0)
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_20yoh")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
transform = Transform3D(0.928376, 0.338154, -0.154177, -3.82119e-09, 0.414852, 0.909889, 0.371643, -0.844719, 0.385139, 0, 0, 0)
light_energy = 0.7
light_indirect_energy = 0.0