This commit is contained in:
Luca 2025-03-15 10:23:36 +01:00
parent 1cb4b96daa
commit 4cb3d4a56d
15 changed files with 291 additions and 16 deletions

4
.editorconfig Normal file
View file

@ -0,0 +1,4 @@
root = true
[*]
charset = utf-8

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

16
.gitignore vendored
View file

@ -1,17 +1,3 @@
# ---> Godot
# Godot 4+ specific ignores
.godot/
# Godot-specific ignores
.import/
export.cfg
export_presets.cfg
# Imported translations (automatically generated from CSV files)
*.translation
# Mono-specific ignores
.mono/
data_*/
mono_crash.*.json
/android/

View file

@ -1,2 +1 @@
# godot-gridcombat

1
icon.svg Normal file
View file

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="128" height="128"><rect width="124" height="124" x="2" y="2" fill="#363d52" stroke="#212532" stroke-width="4" rx="14"/><g fill="#fff" transform="translate(12.322 12.322)scale(.101)"><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 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"/><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" transform="translate(12.322 12.322)scale(.101)"><circle cx="307" cy="532" r="60"/><circle cx="717" cy="532" r="60"/></g></svg>

After

Width:  |  Height:  |  Size: 994 B

37
icon.svg.import Normal file
View file

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dypghe1i5gbqf"
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

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,46 @@
[gd_scene load_steps=7 format=3 uid="uid://cvenkmwxdryi6"]
[sub_resource type="PlaneMesh" id="PlaneMesh_exru8"]
[sub_resource type="BoxShape3D" id="BoxShape3D_exru8"]
size = Vector3(2, 0.01, 2)
[sub_resource type="BoxMesh" id="BoxMesh_exru8"]
size = Vector3(2, 1, 2)
[sub_resource type="BoxShape3D" id="BoxShape3D_gltjq"]
size = Vector3(2, 1, 2)
[sub_resource type="BoxMesh" id="BoxMesh_gltjq"]
size = Vector3(2, 2, 2)
[sub_resource type="BoxShape3D" id="BoxShape3D_a8ttx"]
size = Vector3(2, 2, 2)
[node name="MeshLibrarySource" type="Node3D"]
[node name="Floor" type="MeshInstance3D" parent="."]
mesh = SubResource("PlaneMesh_exru8")
[node name="StaticBody3D" type="StaticBody3D" parent="Floor"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor/StaticBody3D"]
shape = SubResource("BoxShape3D_exru8")
[node name="Half" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0)
mesh = SubResource("BoxMesh_exru8")
[node name="StaticBody3D" type="StaticBody3D" parent="Half"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Half/StaticBody3D"]
shape = SubResource("BoxShape3D_gltjq")
[node name="Full" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
mesh = SubResource("BoxMesh_gltjq")
[node name="StaticBody3D" type="StaticBody3D" parent="Full"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Full/StaticBody3D"]
shape = SubResource("BoxShape3D_a8ttx")

20
project.godot Normal file
View file

@ -0,0 +1,20 @@
; 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="Godot Gridcombat"
run/main_scene="uid://7ft61imdn5m8"
config/features=PackedStringArray("4.4", "Mobile")
config/icon="res://icon.svg"
[rendering]
renderer/rendering_method="mobile"

58
scenes/main.tscn Normal file
View file

@ -0,0 +1,58 @@
[gd_scene load_steps=7 format=3 uid="uid://7ft61imdn5m8"]
[ext_resource type="Script" uid="uid://cit0n24bxqa4m" path="res://scenes/player.gd" id="1_0wfyh"]
[ext_resource type="PackedScene" uid="uid://bx2mv7jak76rx" path="res://scenes/tile.tscn" id="2_0wfyh"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_0wfyh"]
sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
ground_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
[sub_resource type="Sky" id="Sky_sugp2"]
sky_material = SubResource("ProceduralSkyMaterial_0wfyh")
[sub_resource type="Environment" id="Environment_jyhfs"]
background_mode = 2
sky = SubResource("Sky_sugp2")
tonemap_mode = 2
glow_enabled = true
[sub_resource type="PlaneMesh" id="PlaneMesh_0wfyh"]
[node name="Main" type="Node3D"]
[node name="Player" type="Node3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 13, 7)
script = ExtResource("1_0wfyh")
[node name="Camera3D" type="Camera3D" parent="Player"]
transform = Transform3D(1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 0, 0)
[node name="RayCast3D" type="RayCast3D" parent="Player"]
transform = Transform3D(1, 0, 0, 0, 0.866025, -0.5, 0, 0.5, 0.866025, 0, 0, 0)
target_position = Vector3(0, -20, 0)
[node name="UI" type="CanvasLayer" parent="."]
[node name="Control" type="Control" parent="UI"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
[node name="LevelManager" type="Node3D" parent="."]
[node name="CurrentLevel" type="Node3D" parent="LevelManager"]
[node name="Sun" type="DirectionalLight3D" parent="LevelManager/CurrentLevel"]
transform = Transform3D(-0.866025, -0.433013, 0.25, 0, 0.5, 0.866025, -0.5, 0.75, -0.433013, 0, 0, 0)
shadow_enabled = true
[node name="WorldEnvironment" type="WorldEnvironment" parent="LevelManager/CurrentLevel"]
environment = SubResource("Environment_jyhfs")
[node name="TileList" type="Node3D" parent="LevelManager/CurrentLevel"]
[node name="Tile" parent="LevelManager/CurrentLevel/TileList" instance=ExtResource("2_0wfyh")]
mesh = SubResource("PlaneMesh_0wfyh")

15
scenes/player.gd Normal file
View file

@ -0,0 +1,15 @@
extends Node3D
@onready var camera = $Camera3D
@onready var raycast = $RayCast3D
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
self.position.x = sin(Time.get_ticks_msec() * 0.001) * 5.0
var collision_point = raycast.get_collision_point()
var collider = raycast.get_collider()
#var local_collision_point = grid_map.map_to_local(collision_point)
print(collider)

1
scenes/player.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://cit0n24bxqa4m

19
scenes/tile.gd Normal file
View file

@ -0,0 +1,19 @@
@tool
extends Node3D
@export_range(0, 100) var cover_value: int = 50
enum CoverDirection {X, NEG_X, Z, NEG_Z}
@export var cover_direction: CoverDirection
@onready var current_mesh: MeshInstance3D = MeshInstance3D.new()
@export var mesh: Mesh:
get:
return mesh
set(value):
if current_mesh == null:
self.remove_child(current_mesh)
mesh = value
current_mesh.mesh = mesh
if current_mesh == null:
self.add_child(current_mesh)

1
scenes/tile.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://bsxdwuf51u15n

6
scenes/tile.tscn Normal file
View file

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://bx2mv7jak76rx"]
[ext_resource type="Script" uid="uid://bsxdwuf51u15n" path="res://scenes/tile.gd" id="1_3dk36"]
[node name="Tile" type="Node3D"]
script = ExtResource("1_3dk36")