Initial commit
This commit is contained in:
commit
ecab582c7f
4
.editorconfig
Normal file
4
.editorconfig
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Normalize EOL for all files that Git considers text files.
|
||||||
|
* text=auto eol=lf
|
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Godot 4+ specific ignores
|
||||||
|
.godot/
|
||||||
|
/android/
|
1
globals.gd
Normal file
1
globals.gd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
extends Node
|
1
globals.gd.uid
Normal file
1
globals.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://bodpvbpaxnou5
|
1
icon.svg
Normal file
1
icon.svg
Normal 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
37
icon.svg.import
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://bbrv2ri8e1yti"
|
||||||
|
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
|
24
logic/world/chunk/chunk.gd
Normal file
24
logic/world/chunk/chunk.gd
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
var tiles : Array[Tile]
|
||||||
|
var chunk_offset : Vector2i
|
||||||
|
|
||||||
|
func _init() -> void:
|
||||||
|
for i in range(TileGlobals.chunk_size ** 2):
|
||||||
|
tiles.append(Tile.new())
|
||||||
|
|
||||||
|
func get_tile(pos : Vector2i):
|
||||||
|
return tiles[pos.y * TileGlobals.chunk_size + pos.x]
|
||||||
|
|
||||||
|
func _draw() -> void:
|
||||||
|
var x : int = 0
|
||||||
|
var y : int = 0
|
||||||
|
|
||||||
|
for tile in tiles:
|
||||||
|
var tile_definition : TileDefinition = TileGlobals.tile_definitions[tile.id]
|
||||||
|
draw_texture(tile_definition.texture, Vector2(x, y) * TileGlobals.tile_size)
|
||||||
|
|
||||||
|
x += 1
|
||||||
|
if x >= TileGlobals.chunk_size:
|
||||||
|
y += 1
|
||||||
|
x = 0
|
1
logic/world/chunk/chunk.gd.uid
Normal file
1
logic/world/chunk/chunk.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://bgcupjxa6vqhj
|
6
logic/world/chunk/chunk.tscn
Normal file
6
logic/world/chunk/chunk.tscn
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[gd_scene load_steps=2 format=3 uid="uid://b5shor4eu6vsy"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bgcupjxa6vqhj" path="res://logic/world/chunk/chunk.gd" id="1_kkcqc"]
|
||||||
|
|
||||||
|
[node name="Chunk" type="Node2D"]
|
||||||
|
script = ExtResource("1_kkcqc")
|
5
logic/world/chunk/tile/tile.gd
Normal file
5
logic/world/chunk/tile/tile.gd
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
class_name Tile
|
||||||
|
|
||||||
|
var id : int = 0
|
1
logic/world/chunk/tile/tile.gd.uid
Normal file
1
logic/world/chunk/tile/tile.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://v68woe1hw3gc
|
7
logic/world/chunk/tile/tile_definition.gd
Normal file
7
logic/world/chunk/tile/tile_definition.gd
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name TileDefinition
|
||||||
|
|
||||||
|
@export var name : String
|
||||||
|
@export var texture : Texture2D
|
||||||
|
@export var barrier : bool = false
|
1
logic/world/chunk/tile/tile_definition.gd.uid
Normal file
1
logic/world/chunk/tile/tile_definition.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://cp4p3pk48mwqx
|
5
logic/world/chunk/tile/tile_definition_array.gd
Normal file
5
logic/world/chunk/tile/tile_definition_array.gd
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
extends Resource
|
||||||
|
|
||||||
|
class_name TileDefinitionArray
|
||||||
|
|
||||||
|
@export var tile_definitions : Array[TileDefinition]
|
1
logic/world/chunk/tile/tile_definition_array.gd.uid
Normal file
1
logic/world/chunk/tile/tile_definition_array.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://18w861lh0xyt
|
9
logic/world/chunk/tile/tile_globals.gd
Normal file
9
logic/world/chunk/tile/tile_globals.gd
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
var tile_definitions : Array[TileDefinition]
|
||||||
|
const chunk_size : int = 16
|
||||||
|
const tile_size : int = 16
|
||||||
|
|
||||||
|
func _init():
|
||||||
|
var tile_definition_array : TileDefinitionArray = preload("res://resources/tiles/base_tiles.tres")
|
||||||
|
tile_definitions = tile_definition_array.tile_definitions
|
1
logic/world/chunk/tile/tile_globals.gd.uid
Normal file
1
logic/world/chunk/tile/tile_globals.gd.uid
Normal file
|
@ -0,0 +1 @@
|
||||||
|
uid://dic4j2rg2nsvb
|
26
project.godot
Normal file
26
project.godot
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
; 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="FactoryExpansion"
|
||||||
|
config/features=PackedStringArray("4.4", "GL Compatibility")
|
||||||
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
Globals="*res://globals.gd"
|
||||||
|
TileGlobals="*res://logic/world/chunk/tile/tile_globals.gd"
|
||||||
|
|
||||||
|
[rendering]
|
||||||
|
|
||||||
|
textures/canvas_textures/default_texture_filter=0
|
||||||
|
renderer/rendering_method="gl_compatibility"
|
||||||
|
renderer/rendering_method.mobile="gl_compatibility"
|
25
resources/tiles/base_tiles.tres
Normal file
25
resources/tiles/base_tiles.tres
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
[gd_resource type="Resource" script_class="TileDefinitionArray" load_steps=7 format=3 uid="uid://7a03sai1i6fd"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://18w861lh0xyt" path="res://logic/world/chunk/tile/tile_definition_array.gd" id="1_58vwe"]
|
||||||
|
[ext_resource type="Script" uid="uid://cp4p3pk48mwqx" path="res://logic/world/chunk/tile/tile_definition.gd" id="2_12vs5"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://31njex15xgpr" path="res://resources/tiles/textures/grass.png" id="3_12vs5"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://dhj4m7xfgfr8r" path="res://resources/tiles/textures/water.png" id="4_edm72"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_c6abn"]
|
||||||
|
script = ExtResource("2_12vs5")
|
||||||
|
name = "Water"
|
||||||
|
texture = ExtResource("4_edm72")
|
||||||
|
barrier = false
|
||||||
|
metadata/_custom_type_script = "uid://cp4p3pk48mwqx"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_edm72"]
|
||||||
|
script = ExtResource("2_12vs5")
|
||||||
|
name = "Grass"
|
||||||
|
texture = ExtResource("3_12vs5")
|
||||||
|
barrier = false
|
||||||
|
metadata/_custom_type_script = "uid://cp4p3pk48mwqx"
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_58vwe")
|
||||||
|
tile_definitions = Array[ExtResource("2_12vs5")]([SubResource("Resource_c6abn"), SubResource("Resource_edm72")])
|
||||||
|
metadata/_custom_type_script = "uid://18w861lh0xyt"
|
BIN
resources/tiles/textures/grass.png
Normal file
BIN
resources/tiles/textures/grass.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 210 B |
34
resources/tiles/textures/grass.png.import
Normal file
34
resources/tiles/textures/grass.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://31njex15xgpr"
|
||||||
|
path="res://.godot/imported/grass.png-b9f264aaa8345ec83a51549170f38e82.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://resources/tiles/textures/grass.png"
|
||||||
|
dest_files=["res://.godot/imported/grass.png-b9f264aaa8345ec83a51549170f38e82.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
|
BIN
resources/tiles/textures/water.png
Normal file
BIN
resources/tiles/textures/water.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 196 B |
34
resources/tiles/textures/water.png.import
Normal file
34
resources/tiles/textures/water.png.import
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="CompressedTexture2D"
|
||||||
|
uid="uid://dhj4m7xfgfr8r"
|
||||||
|
path="res://.godot/imported/water.png-0df44c59650310c522d02ac1e8165335.ctex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://resources/tiles/textures/water.png"
|
||||||
|
dest_files=["res://.godot/imported/water.png-0df44c59650310c522d02ac1e8165335.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
|
Loading…
Reference in a new issue