diff --git a/.gitignore b/.gitignore index ce28c2c..ae2bfac 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Godot 4+ specific ignores .godot/ +export_presets.cfg # Steffo's random assets folder available-assets/ diff --git a/export_presets.cfg b/export_presets.cfg deleted file mode 100644 index 0efe607..0000000 --- a/export_presets.cfg +++ /dev/null @@ -1,29 +0,0 @@ -[preset.0] - -name="Linux/X11" -platform="Linux/X11" -runnable=true -custom_features="" -export_filter="all_resources" -include_filter="" -exclude_filter="" -export_path="../../../Desktop/ld52/ld52_linux.x86_64" -encryption_include_filters="" -encryption_exclude_filters="" -encrypt_pck=false -encrypt_directory=false -script_export_mode=1 -script_encryption_key="" - -[preset.0.options] - -custom_template/debug="" -custom_template/release="" -debug/export_console_script=1 -binary_format/embed_pck=false -texture_format/bptc=false -texture_format/s3tc=true -texture_format/etc=false -texture_format/etc2=false -texture_format/no_bptc_fallbacks=true -binary_format/architecture="x86_64" diff --git a/island/CropTile.gd b/island/CropTile.gd index 3537e6a..d80d3f7 100644 --- a/island/CropTile.gd +++ b/island/CropTile.gd @@ -1,4 +1,5 @@ extends Node3D +class_name CropTile signal on_planted() diff --git a/island/Island.tscn b/island/Island.tscn index ec36ec1..dc24836 100644 --- a/island/Island.tscn +++ b/island/Island.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=3 uid="uid://bg88gc1w1gw5m"] +[gd_scene load_steps=17 format=3 uid="uid://bg88gc1w1gw5m"] [ext_resource type="Shader" path="res://island/Sea.gdshader" id="1_agjfy"] [ext_resource type="Texture2D" uid="uid://bdoifsf6k0qb8" path="res://assets/water_tile.png" id="1_w6ara"] @@ -23,15 +23,23 @@ shader_parameter/sea = ExtResource("1_w6ara") material = SubResource("ShaderMaterial_3uyyi") size = Vector2(1000, 1000) -[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_htlhh"] -sky_top_color = Color(0.356863, 0.623529, 0.937255, 1) -sky_horizon_color = Color(0.254902, 0.623529, 0.8, 1) -ground_bottom_color = Color(0.254902, 0.623529, 0.8, 1) -ground_horizon_color = Color(0.254902, 0.623529, 0.8, 1) -ground_curve = 7.89838 +[sub_resource type="Gradient" id="Gradient_shcpx"] +interpolation_mode = 2 +offsets = PackedFloat32Array(0.518605, 0.723256, 0.953488) +colors = PackedColorArray(1, 0.694118, 0.741176, 1, 0.0352941, 0.831373, 0.882353, 1, 0.152941, 0.698039, 1, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_yb0rj"] +gradient = SubResource("Gradient_shcpx") +width = 256 +height = 256 +fill_from = Vector2(0, 1) +fill_to = Vector2(0, 0) + +[sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_c0cxy"] +panorama = SubResource("GradientTexture2D_yb0rj") [sub_resource type="Sky" id="Sky_j6hso"] -sky_material = SubResource("ProceduralSkyMaterial_htlhh") +sky_material = SubResource("PanoramaSkyMaterial_c0cxy") [sub_resource type="Environment" id="Environment_302o8"] background_mode = 2 @@ -81,10 +89,10 @@ transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, -27, 0 environment = SubResource("Environment_302o8") [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] -transform = Transform3D(1, 0, 0, 0, -0.337161, 0.941447, 0, -0.941447, -0.337161, 0, 2.08989, 0) +transform = Transform3D(1, 0, 0, 0, -0.249636, 0.96834, 0, -0.96834, -0.249636, 0, 7.44648, 0) [node name="Player" parent="." instance=ExtResource("3_5378m")] -transform = Transform3D(-1, 3.48787e-16, -8.74228e-08, 3.48787e-16, 1, -3.48787e-16, 8.74228e-08, -3.48787e-16, -1, 0, 4.89631, 0) +transform = Transform3D(-1, 3.48787e-16, -8.74228e-08, 3.48787e-16, 1, -3.48787e-16, 8.74228e-08, -3.48787e-16, -1, 2.08165e-12, 4.896, 2.08165e-12) [node name="CropTiles" type="Node3D" parent="."] @@ -97,6 +105,12 @@ debug_growth_offset = 0.5 [node name="CropTile3" parent="CropTiles" instance=ExtResource("8_4ooup")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 2, 8) +debug_growth = true +debug_growth_offset = 0.6 + +[node name="CropTile4" parent="CropTiles" instance=ExtResource("8_4ooup")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, -2) +debug_growth = true debug_growth_offset = 0.6 [node name="Produce" type="Node3D" parent="."] diff --git a/menu/Menu.tscn b/menu/Menu.tscn index ee73af3..60cf0bf 100644 --- a/menu/Menu.tscn +++ b/menu/Menu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=5 format=3 uid="uid://bufi0wh54u5x5"] +[gd_scene load_steps=4 format=3 uid="uid://bufi0wh54u5x5"] [ext_resource type="Theme" uid="uid://c5a1nyqumj46j" path="res://menu/menu_theme.tres" id="1_mkxnc"] [ext_resource type="Script" path="res://menu/Menu.gd" id="2_6amk3"] diff --git a/player/onhand/PeaShooter.gd b/player/onhand/PeaShooter.gd index 388f481..db35b88 100644 --- a/player/onhand/PeaShooter.gd +++ b/player/onhand/PeaShooter.gd @@ -6,6 +6,7 @@ var last_fired := 0 var remaining := 10 @onready var ray = $RayCast3D +var croptile = preload("res://island/CropTile.tscn") func _init() -> void: @@ -37,6 +38,7 @@ func shoot() -> void: var normal = ray.get_collision_normal() as Vector3 var point = ray.get_collision_point() as Vector3 var object = ray.get_collider() as Node3D + try_placing_seed(ray) # decalInstance.position = point # object.add_child(decalInstance) else: @@ -44,3 +46,21 @@ func shoot() -> void: pass remaining -= 1 + + +func try_placing_seed(ray: RayCast3D) -> bool: + var point = ray.get_collision_point() as Vector3 + var normal = ray.get_collision_normal() as Vector3 + var obj = ray.get_collider() as Node3D + print(point, normal, obj.name) + if normal != Vector3(0,1,0): + print("Not horizontal, no plant for you :<") + return false + + var correct_point = point.floor() + var crop = croptile.instantiate() as CropTile + crop.position = correct_point + crop.debug_growth = true + get_tree().root.add_child(crop) + + return true diff --git a/project.godot b/project.godot index 1b8b417..9136e38 100644 --- a/project.godot +++ b/project.godot @@ -14,6 +14,11 @@ _global_script_classes=[{ "language": &"GDScript", "path": "res://player/onhand/BaseWeapon.gd" }, { +"base": "Node3D", +"class": &"CropTile", +"language": &"GDScript", +"path": "res://island/CropTile.gd" +}, { "base": "BaseWeapon", "class": &"PeaShooter", "language": &"GDScript", @@ -31,6 +36,7 @@ _global_script_classes=[{ }] _global_script_class_icons={ "BaseWeapon": "", +"CropTile": "", "PeaShooter": "", "Player": "", "PlayerInputData": "" @@ -115,5 +121,4 @@ fire={ [rendering] -renderer/rendering_method="gl_compatibility" environment/defaults/default_clear_color=Color(0.231373, 0.490196, 0.309804, 1)