Moved godot files into a directory to keep things clean

This commit is contained in:
2025-11-05 15:35:08 +11:00
parent cb85608dfe
commit 9f48ca5ee0
28 changed files with 12 additions and 6 deletions

4
project/.editorconfig Normal file
View File

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

View File

@@ -0,0 +1,35 @@
class_name Character extends CharacterBody2D
var _grid_pos: Vector2i = Vector2i.ZERO
var _grid_tween: Tween = null
var _cached_dir: Vector2i = Vector2i.ZERO #used for reversing the current input
func _physics_process(delta: float) -> void:
if _grid_pos * 32 == Vector2i(position):
_check_grid_move(delta)
func _check_grid_move(_delta: float) -> void:
if Input.is_action_pressed("input_north"):
_set_grid_move(Vector2i.UP)
elif Input.is_action_pressed("input_south"):
_set_grid_move(Vector2i.DOWN)
elif Input.is_action_pressed("input_west"):
_set_grid_move(Vector2i.LEFT)
elif Input.is_action_pressed("input_east"):
_set_grid_move(Vector2i.RIGHT)
func _set_grid_move(grid_dir: Vector2i):
_cached_dir = grid_dir
_grid_pos += grid_dir
_grid_tween = create_tween()
_grid_tween.set_ease(Tween.EASE_OUT_IN)
_grid_tween.set_trans(Tween.TRANS_QUAD)
_grid_tween.tween_property(self, "position", Vector2(_grid_pos * 32), 0.3)
func repel_collision(_other: Node2D) -> void:
#NOTE: character's collider has a 1 pixel margin
if _cached_dir != Vector2i.ZERO:
_grid_tween.kill()
_set_grid_move(-_cached_dir) #go backwards
_cached_dir = Vector2i.ZERO #only do this once each collision

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bhcajd6qgtt62"
path="res://.godot/imported/gary_pixels.png-3b277e035a73ecaf93d5fc604cea6ce4.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://character/gary_pixels.png"
dest_files=["res://.godot/imported/gary_pixels.png-3b277e035a73ecaf93d5fc604cea6ce4.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
project/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
project/icon.svg.import Normal file
View File

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

View File

@@ -0,0 +1,24 @@
#Inventory Singleton
extends Node
#game items
@abstract
class Item:
var name: String
func _init(_name: String):
name = _name
class Wood extends Item:
func _init():
super("Wood")
class Stone extends Item:
func _init():
super("Stone")
#inventory controls
var _inventory_contents: Array[Item] = []
func add_item(item: Item) -> void:
_inventory_contents.push_back(item)
print("Inventory: ", _inventory_contents.map(func (i: Item) -> String: return i.name))

View File

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

52
project/project.godot Normal file
View File

@@ -0,0 +1,52 @@
; 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="mini-garden"
run/main_scene="uid://8o4ffx055dof"
config/features=PackedStringArray("4.5", "GL Compatibility")
config/icon="res://icon.svg"
[autoload]
Inventory="*res://items/inventory.gd"
[input]
input_north={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"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":0,"location":0,"echo":false,"script":null)
]
}
input_south={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"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":0,"location":0,"echo":false,"script":null)
]
}
input_east={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"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,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"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":0,"location":0,"echo":false,"script":null)
]
}
input_west={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, 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,"location":0,"echo":false,"script":null)
]
}
[rendering]
textures/canvas_textures/default_texture_filter=0
renderer/rendering_method="mobile"

View File

@@ -0,0 +1,11 @@
extends Area2D
var _durability: int = 3
func _on_body_entered(body: Node2D) -> void:
if body is Character:
_durability -= 1
body.repel_collision(self)
if _durability <= 0:
Inventory.add_item(Inventory.Wood.new())
queue_free()

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bfyw8l1ubdnsj"
path="res://.godot/imported/small_tree.png-cf75decf0f8c1df0d335279ecd86f789.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://small_tree/small_tree.png"
dest_files=["res://.godot/imported/small_tree.png-cf75decf0f8c1df0d335279ecd86f789.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
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/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
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

View File

@@ -0,0 +1,21 @@
[gd_scene load_steps=4 format=3 uid="uid://d2re5mee0xayj"]
[ext_resource type="Texture2D" uid="uid://bfyw8l1ubdnsj" path="res://small_tree/small_tree.png" id="1_1ao6o"]
[ext_resource type="Script" uid="uid://clxosihgty8t5" path="res://small_tree/small_tree.gd" id="1_brd4x"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_vb5bs"]
size = Vector2(32, 32)
[node name="Tree" type="Area2D"]
script = ExtResource("1_brd4x")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_1ao6o")
offset = Vector2(16, 16)
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
visible = false
position = Vector2(16, 16)
shape = SubResource("RectangleShape2D_vb5bs")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]

BIN
project/terrain/dirt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 B

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c5lr861cmya6r"
path="res://.godot/imported/dirt.png-4b2e3b8f4083fb0baf8bb6a15680a151.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://terrain/dirt.png"
dest_files=["res://.godot/imported/dirt.png-4b2e3b8f4083fb0baf8bb6a15680a151.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
project/terrain/grass.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

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

View File

@@ -0,0 +1,9 @@
extends TileMapLayer
var dirt_id = 0
var grass_id = 1
func _unhandled_input(event: InputEvent) -> void:
if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT and event.is_pressed():
var coords: Vector2i = local_to_map(event.position)
set_cell(coords, dirt_id, Vector2i.ZERO, 0)

View File

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

View File

@@ -0,0 +1,19 @@
[gd_resource type="TileSet" load_steps=5 format=3 uid="uid://resk8tvqugsx"]
[ext_resource type="Texture2D" uid="uid://c5lr861cmya6r" path="res://terrain/dirt.png" id="1_m2li2"]
[ext_resource type="Texture2D" uid="uid://bavfwcsgof0tp" path="res://terrain/grass.png" id="2_54oqm"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_busfd"]
texture = ExtResource("1_m2li2")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_wkw05"]
texture = ExtResource("2_54oqm")
texture_region_size = Vector2i(32, 32)
0:0/0 = 0
[resource]
tile_size = Vector2i(32, 32)
sources/0 = SubResource("TileSetAtlasSource_busfd")
sources/1 = SubResource("TileSetAtlasSource_wkw05")

View File

@@ -0,0 +1,15 @@
extends Node2D
@export var small_tree = preload("res://small_tree/small_tree.tscn")
func _ready() -> void:
randomize()
_procgen()
func _procgen() -> void:
for i in range(0, 15):
var grid_pos = Vector2i(randi() % 20, randi() % 20)
if grid_pos.x == 0 and grid_pos.y == 0: continue #NOTE: don't spawn on the player
var st = small_tree.instantiate()
st.position = Vector2(grid_pos * 32)
add_child(st)

View File

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

File diff suppressed because one or more lines are too long