1
Fork 0
mirror of https://github.com/Steffo99/pineapple-surf.git synced 2024-11-22 15:54:20 +00:00

Create growing crop tile

This commit is contained in:
Steffo 2023-01-07 23:56:57 +01:00
parent d7dbcfbdbb
commit 5f729e6e15
Signed by: steffo
GPG key ID: 6965406171929D01
9 changed files with 151 additions and 1 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,9 @@
newmtl material1
Ka 1.000000 1.000000 1.000000
Kd 1.000000 1.000000 1.000000
Ks 0.000000 0.000000 0.000000
Tr 0.000000
illum 0
Ns 0.000000
map_Kd texture_1.png
map_d texture_1.png

BIN
assets/island_model/crop.obj (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,21 @@
[remap]
importer="wavefront_obj"
importer_version=1
type="Mesh"
uid="uid://crd64tj6aklbp"
path="res://.godot/imported/crop.obj-927c4a1ce8bef417256a300eee1a729a.mesh"
[deps]
files=["res://.godot/imported/crop.obj-927c4a1ce8bef417256a300eee1a729a.mesh"]
source_file="res://assets/island_model/crop.obj"
dest_files=["res://.godot/imported/crop.obj-927c4a1ce8bef417256a300eee1a729a.mesh", "res://.godot/imported/crop.obj-927c4a1ce8bef417256a300eee1a729a.mesh"]
[params]
generate_tangents=true
scale_mesh=Vector3(1, 1, 1)
offset_mesh=Vector3(0, 0, 0)
optimize_mesh=true

BIN
assets/island_model/texture_1.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,36 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bwbbfj7eom0vf"
path.s3tc="res://.godot/imported/texture_1.png-9fbd3af4843d9622d58b51ee93c19f7f.s3tc.ctex"
path.etc2="res://.godot/imported/texture_1.png-9fbd3af4843d9622d58b51ee93c19f7f.etc2.ctex"
metadata={
"imported_formats": ["s3tc", "etc2"],
"vram_texture": true
}
[deps]
source_file="res://assets/island_model/texture_1.png"
dest_files=["res://.godot/imported/texture_1.png-9fbd3af4843d9622d58b51ee93c19f7f.s3tc.ctex", "res://.godot/imported/texture_1.png-9fbd3af4843d9622d58b51ee93c19f7f.etc2.ctex"]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/bptc_ldr=0
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

24
island/CropTile.gd Normal file
View file

@ -0,0 +1,24 @@
extends Node3D
signal on_planted()
signal on_complete()
@onready var growth_timer: Timer = $GrowthTimer
@onready var sprout_mesh: MeshInstance3D = $Plant/Sprout
func plant():
growth_timer.start()
emit_signal("on_planted")
func complete():
growth_timer.stop()
emit_signal("on_complete")
func _process(_delta):
var scale_factor = 1 - (growth_timer.time_left / growth_timer.wait_time)
sprout_mesh.scale = Vector3(scale_factor, scale_factor, scale_factor)

49
island/CropTile.tscn Normal file
View file

@ -0,0 +1,49 @@
[gd_scene load_steps=6 format=3 uid="uid://cf35yl04qtru3"]
[ext_resource type="Script" path="res://island/CropTile.gd" id="1_7lls2"]
[ext_resource type="Texture2D" uid="uid://bwbbfj7eom0vf" path="res://assets/island_model/texture_1.png" id="1_fn720"]
[sub_resource type="BoxShape3D" id="BoxShape3D_6ja5h"]
size = Vector3(1, 0.1, 1)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ed1p1"]
resource_name = "material1"
transparency = 2
alpha_scissor_threshold = 0.5
alpha_antialiasing_mode = 0
albedo_texture = ExtResource("1_fn720")
texture_filter = 0
texture_repeat = false
[sub_resource type="ArrayMesh" id="ArrayMesh_28cd1"]
_surfaces = [{
"aabb": AABB(-0.5, 0, -0.5, 1.00001, 1.00001, 1),
"attribute_data": PackedByteArray(143, 194, 117, 63, 183, 109, 91, 63, 31, 133, 107, 63, 219, 182, 109, 63, 31, 133, 107, 63, 183, 109, 91, 63, 143, 194, 117, 63, 219, 182, 109, 63, 143, 194, 117, 63, 183, 109, 91, 63, 31, 133, 107, 63, 183, 109, 91, 63, 31, 133, 107, 63, 219, 182, 109, 63, 143, 194, 117, 63, 219, 182, 109, 63, 143, 194, 117, 63, 183, 109, 91, 63, 31, 133, 107, 63, 183, 109, 91, 63, 31, 133, 107, 63, 219, 182, 109, 63, 143, 194, 117, 63, 219, 182, 109, 63, 143, 194, 117, 63, 183, 109, 91, 63, 31, 133, 107, 63, 183, 109, 91, 63, 31, 133, 107, 63, 219, 182, 109, 63, 143, 194, 117, 63, 219, 182, 109, 63),
"format": 4119,
"index_count": 24,
"index_data": PackedByteArray(0, 0, 1, 0, 2, 0, 3, 0, 1, 0, 0, 0, 4, 0, 5, 0, 6, 0, 7, 0, 4, 0, 6, 0, 8, 0, 9, 0, 10, 0, 11, 0, 8, 0, 10, 0, 12, 0, 13, 0, 14, 0, 15, 0, 12, 0, 14, 0),
"material": SubResource("StandardMaterial3D_ed1p1"),
"name": "material1",
"primitive": 3,
"vertex_count": 16,
"vertex_data": PackedByteArray(0, 0, 0, 63, 0, 0, 128, 63, 0, 0, 0, 191, 255, 191, 255, 127, 255, 255, 255, 223, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 63, 255, 191, 255, 127, 255, 255, 255, 223, 0, 0, 0, 191, 0, 0, 128, 63, 0, 0, 0, 63, 255, 191, 255, 127, 255, 255, 255, 223, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 191, 255, 191, 255, 127, 255, 255, 255, 223, 0, 0, 0, 191, 0, 0, 128, 63, 0, 0, 0, 191, 255, 63, 255, 127, 0, 0, 255, 31, 0, 0, 0, 63, 0, 0, 128, 63, 0, 0, 0, 63, 255, 63, 255, 127, 0, 0, 255, 31, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 255, 63, 255, 127, 0, 0, 255, 31, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 191, 255, 63, 255, 127, 0, 0, 255, 31, 0, 0, 0, 63, 0, 0, 128, 63, 0, 0, 0, 191, 0, 0, 255, 191, 255, 255, 255, 31, 0, 0, 0, 191, 0, 0, 128, 63, 0, 0, 0, 63, 0, 0, 255, 191, 255, 255, 255, 31, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 63, 0, 0, 255, 191, 255, 255, 255, 31, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 191, 0, 0, 255, 191, 255, 255, 255, 31, 0, 0, 0, 63, 0, 0, 128, 63, 0, 0, 0, 63, 255, 255, 255, 191, 255, 191, 255, 63, 0, 0, 0, 191, 0, 0, 128, 63, 0, 0, 0, 191, 255, 255, 255, 191, 255, 191, 255, 63, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 191, 255, 255, 255, 191, 255, 191, 255, 63, 0, 0, 0, 63, 0, 0, 0, 0, 0, 0, 0, 63, 255, 255, 255, 191, 255, 191, 255, 63)
}]
[node name="CropTile" type="Node3D"]
script = ExtResource("1_7lls2")
[node name="Plant" type="Area3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0, 0.5)
[node name="PlantableArea" type="CollisionShape3D" parent="Plant"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.05, 0)
shape = SubResource("BoxShape3D_6ja5h")
[node name="Sprout" type="MeshInstance3D" parent="Plant"]
mesh = SubResource("ArrayMesh_28cd1")
skeleton = NodePath("../../..")
[node name="GrowthTimer" type="Timer" parent="."]
wait_time = 5.0
[connection signal="timeout" from="GrowthTimer" to="." method="complete"]

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=3 uid="uid://bg88gc1w1gw5m"] [gd_scene load_steps=15 format=3 uid="uid://bg88gc1w1gw5m"]
[ext_resource type="Shader" path="res://island/Sea.gdshader" id="1_agjfy"] [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"] [ext_resource type="Texture2D" uid="uid://bdoifsf6k0qb8" path="res://assets/water_tile.png" id="1_w6ara"]
@ -7,6 +7,7 @@
[ext_resource type="PackedScene" uid="uid://tahdk48hqxis" path="res://island/HillMesh.tscn" id="4_5ll24"] [ext_resource type="PackedScene" uid="uid://tahdk48hqxis" path="res://island/HillMesh.tscn" id="4_5ll24"]
[ext_resource type="PackedScene" uid="uid://cxa5irr1atgke" path="res://island/PyramidSmallMesh.tscn" id="5_uf8hd"] [ext_resource type="PackedScene" uid="uid://cxa5irr1atgke" path="res://island/PyramidSmallMesh.tscn" id="5_uf8hd"]
[ext_resource type="PackedScene" uid="uid://bknwefv5ycc3u" path="res://island/PyramidSmolMesh.tscn" id="6_klmt8"] [ext_resource type="PackedScene" uid="uid://bknwefv5ycc3u" path="res://island/PyramidSmolMesh.tscn" id="6_klmt8"]
[ext_resource type="PackedScene" uid="uid://cf35yl04qtru3" path="res://island/CropTile.tscn" id="8_4ooup"]
[sub_resource type="GDScript" id="GDScript_78lo3"] [sub_resource type="GDScript" id="GDScript_78lo3"]
script/source = "extends Node3D script/source = "extends Node3D
@ -88,3 +89,6 @@ transform = Transform3D(1, 0, 0, 0, -0.337161, 0.941447, 0, -0.941447, -0.337161
[node name="Player" parent="." instance=ExtResource("3_5378m")] [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, 0, 4.89631, 0)
[node name="CropTile" parent="." instance=ExtResource("8_4ooup")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 8)