Browse Source

finished flower logic

added stuff
max
Pixdigit 3 months ago
parent
commit
a18a2e18a4
16 changed files with 2740 additions and 1400 deletions
  1. BIN
     
  2. BIN
     
  3. +2058
    -1389
      assets/models/ship/prototype ship.escn
  4. BIN
     
  5. BIN
     
  6. BIN
     
  7. +359
    -0
      assets/models/ui/Dünger Logo.escn
  8. BIN
     
  9. +160
    -0
      assets/models/ui/Wasser Logo.escn
  10. BIN
     
  11. +51
    -3
      scenes/Ship.tscn
  12. +14
    -0
      scenes/sub_scenes/fertilizer_logo.tscn
  13. +66
    -1
      scenes/sub_scenes/player.tscn
  14. +9
    -4
      scenes/sub_scenes/satzkasten.tscn
  15. +11
    -0
      scenes/sub_scenes/water_logo.tscn
  16. +12
    -3
      src/State.gd

BIN
View File


BIN
View File


+ 2058
- 1389
assets/models/ship/prototype ship.escn
File diff suppressed because it is too large
View File


BIN
View File


BIN
View File


BIN
View File


+ 359
- 0
assets/models/ui/Dünger Logo.escn
File diff suppressed because it is too large
View File


BIN
View File


+ 160
- 0
assets/models/ui/Wasser Logo.escn
File diff suppressed because it is too large
View File


BIN
View File


+ 51
- 3
scenes/Ship.tscn View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=32 format=2]
[gd_scene load_steps=36 format=2]

[ext_resource path="res://scenes/sub_scenes/ship.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/sub_scenes/player.tscn" type="PackedScene" id=2]
@@ -168,6 +168,36 @@ height = 0.1
extents = Vector3( 0.8, 2.16543, 0.8 )

[sub_resource type="GDScript" id=26]
script/source = "extends Area

func _ready():
pass


func _on_body_entered(body):
if body.name == \"Player\":
State.player_inventory = State.ITEM.WATER
"

[sub_resource type="BoxShape" id=27]
extents = Vector3( 1.17384, 2.64489, 1.23621 )

[sub_resource type="GDScript" id=30]
script/source = "extends Area

func _ready():
pass


func _on_body_entered(body):
if body.name == \"Player\":
State.player_inventory = State.ITEM.FERTILIZER
"

[sub_resource type="BoxShape" id=28]
extents = Vector3( 1.47223, 2.50833, 2.55238 )

[sub_resource type="GDScript" id=29]
script/source = "tool
extends Spatial

@@ -345,6 +375,7 @@ transform = Transform( 0.670962, 0.445052, 0.593066, 0.609955, -0.786076, -0.100

[node name="Camera" type="Camera" parent="AnimationPlayer/CameraPath/PathFollow"]
transform = Transform( 0.367442, 0.138072, 0.919741, 0.168566, -0.982425, 0.0801399, 0.914642, 0.12559, -0.38426, 0, 0, 0 )
current = true
far = 300.0
script = SubResource( 21 )
follow_obj = NodePath("../../../../prototype ship/CameraCenter")
@@ -369,9 +400,24 @@ shape = SubResource( 25 )
transform = Transform( 1, 0, 0, 0, -0.416456, -0.909156, 0, 0.909156, -0.416456, 0, -28.5438, 25.5763 )
light_energy = 0.2

[node name="SeagullOrbit" type="Spatial" parent="."]
transform = Transform( -0.998698, 0, -0.0510071, 0, 1, 0, 0.0510071, 0, -0.998698, 0, 30, 0 )
[node name="WaterDetector" type="Area" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -9.99335, 9.65661, -0.110578 )
script = SubResource( 26 )

[node name="CollisionShape" type="CollisionShape" parent="WaterDetector"]
shape = SubResource( 27 )

[node name="FertilizerDetector" type="Area" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -2.71211, -4.76837e-07, 3.47488 )
script = SubResource( 30 )

[node name="CollisionShape" type="CollisionShape" parent="FertilizerDetector"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -10.3587, 8.62152, 1.31896 )
shape = SubResource( 28 )

[node name="SeagullOrbit" type="Spatial" parent="."]
transform = Transform( 0.901694, 0, 0.432375, 0, 1, 0, -0.432375, 0, 0.901694, 0, 30, 0 )
script = SubResource( 29 )
speed = 0.5

[node name="Gull Dummy" parent="SeagullOrbit" instance=ExtResource( 3 )]
@@ -384,3 +430,5 @@ transform = Transform( -1.62921e-07, 0, -1, 0, 1, 0, 1, 0, -1.62921e-07, 11.2304
transform = Transform( 30, 0, 0, 0, 25, 0, 0, 0, 25, -2.66053, 15.0877, 0 )
[connection signal="body_entered" from="AnimationPlayer/Area" to="AnimationPlayer" method="_on_steer_body_entered"]
[connection signal="body_exited" from="AnimationPlayer/Area" to="AnimationPlayer" method="_on_steer_body_exited"]
[connection signal="body_entered" from="WaterDetector" to="WaterDetector" method="_on_body_entered"]
[connection signal="body_entered" from="FertilizerDetector" to="FertilizerDetector" method="_on_body_entered"]

+ 14
- 0
scenes/sub_scenes/fertilizer_logo.tscn View File

@@ -0,0 +1,14 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://assets/models/ui/Dünger Logo.escn" type="PackedScene" id=1]

[node name="Dünger Logo" instance=ExtResource( 1 )]

[node name="Light" parent="." index="0"]
visible = false

[node name="Camera" parent="." index="1"]
visible = false

[node name="Plane" parent="." index="3"]
visible = false

+ 66
- 1
scenes/sub_scenes/player.tscn View File

@@ -1,9 +1,11 @@
[gd_scene load_steps=8 format=2]
[gd_scene load_steps=12 format=2]

[ext_resource path="res://addons/randomAudioStreamPlayer/random_audio_stream_player_3D.gd" type="Script" id=1]
[ext_resource path="res://assets/sound/Steps/Metal_Footstep_02_mono.ogg" type="AudioStream" id=2]
[ext_resource path="res://assets/sound/Steps/Metal_Footstep_01_mono.ogg" type="AudioStream" id=3]
[ext_resource path="res://assets/sound/Steps/Metal_Footstep_03_mono.ogg" type="AudioStream" id=4]
[ext_resource path="res://scenes/sub_scenes/fertilizer_logo.tscn" type="PackedScene" id=5]
[ext_resource path="res://scenes/sub_scenes/water_logo.tscn" type="PackedScene" id=6]

[sub_resource type="GDScript" id=1]
script/source = "extends KinematicBody
@@ -18,6 +20,21 @@ var gravity : Vector3 = Vector3(0,-0.9,0)

onready var audio = get_node(\"RandomAudioStreamPlayer3D\")
onready var stepTimer = get_node(\"Timer\")
onready var fertilizer_logo = get_node(\"FertilizerLogo\")
onready var water_logo = get_node(\"WaterLogo\")

func _ready():
var err = State.connect(\"item_changed\", self, \"_on_item_changed\")
assert(not err)

func _on_item_changed():
water_logo.visible = false
fertilizer_logo.visible = false

if State.player_inventory == State.ITEM.WATER:
water_logo.visible = true
elif State.player_inventory == State.ITEM.FERTILIZER:
fertilizer_logo.visible = true

func _physics_process(_delta):
@@ -73,6 +90,38 @@ mid_height = 2.0
[sub_resource type="CapsuleShape" id=3]
height = 2.0

[sub_resource type="Animation" id=4]
resource_name = "rotate"
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath(".:rotation_degrees")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 360, 0 ) ]
}

[sub_resource type="Animation" id=5]
resource_name = "rotate"
loop = true
tracks/0/type = "value"
tracks/0/path = NodePath(".:rotation_degrees")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/keys = {
"times": PoolRealArray( 0, 1 ),
"transitions": PoolRealArray( 1, 1 ),
"update": 0,
"values": [ Vector3( 0, 0, 0 ), Vector3( 0, 360, 0 ) ]
}

[node name="Player" type="KinematicBody"]
script = SubResource( 1 )
__meta__ = {
@@ -105,4 +154,20 @@ volume_max = 0.0
randomize_pitch = false
pitch_min = 1.0
pitch_max = 1.0

[node name="FertilizerLogo" parent="." instance=ExtResource( 5 )]
transform = Transform( 0.41941, 0, 0.907797, 0, 1, 0, -0.907797, 0, 0.41941, 0, 3, 0 )
visible = false

[node name="AnimationPlayer" type="AnimationPlayer" parent="FertilizerLogo"]
autoplay = "rotate"
anims/rotate = SubResource( 4 )

[node name="WaterLogo" parent="." instance=ExtResource( 6 )]
transform = Transform( 0.901675, 0, -0.432413, 0, 1, 0, 0.432413, 0, 0.901675, 0, 3, 0 )
visible = false

[node name="AnimationPlayer2" type="AnimationPlayer" parent="WaterLogo"]
autoplay = "rotate"
anims/rotate = SubResource( 5 )
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]

+ 9
- 4
scenes/sub_scenes/satzkasten.tscn View File

@@ -16,7 +16,7 @@ export var fertilizer_need: int = 3


export var plant_timers: Dictionary = {
State.PLANT_TYPE.STEERING: 5 * MINUTE,
State.PLANT_TYPE.STEERING: 15 * SECOND,
State.PLANT_TYPE.ENGINE: 3 * MINUTE,
State.PLANT_TYPE.O2: 4 * MINUTE,
State.PLANT_TYPE.CANON: 6 * MINUTE,
@@ -63,9 +63,10 @@ func _ready():

set_state(SEEDLING)

var buffered_time: float = plant_timers[type] + State.rng.randf() * MINUTE
buffered_time = 5
water_timer.start(buffered_time)
if state == GROWN:
var buffered_time: float = plant_timers[type] + State.rng.randf() * MINUTE
buffered_time = 5
water_timer.start(buffered_time)


func set_type(newType: int) -> void:
@@ -92,10 +93,14 @@ func interact():
set_state(SEEDLING)
elif state == SEEDLING and State.player_inventory == State.ITEM.FERTILIZER:
fertilizer_given += 1
elif state == GROWN and State.player_inventory == State.ITEM.WATER:
water_timer.start(plant_timers[type])

if fertilizer_given >= fertilizer_need:
set_state(GROWN)

State.player_inventory = State.ITEM.EMPTY

func set_state(new_state: int):
for plant_type in plant_container.get_children():
plant_type.visible = false


+ 11
- 0
scenes/sub_scenes/water_logo.tscn View File

@@ -0,0 +1,11 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://assets/models/ui/Wasser Logo.escn" type="PackedScene" id=1]

[node name="Wasser Logo" instance=ExtResource( 1 )]

[node name="Light" parent="." index="0"]
visible = false

[node name="Camera" parent="." index="1"]
visible = false

+ 12
- 3
src/State.gd View File

@@ -1,5 +1,7 @@
extends Node

signal item_changed

enum PLANT_TYPE {
ENGINE,
O2,
@@ -19,7 +21,8 @@ var plant_amounts: Dictionary = {
enum ITEM {
EMPTY,
SEED,
FERTILIZER
FERTILIZER,
WATER
}


@@ -28,7 +31,7 @@ var rng: RandomNumberGenerator = RandomNumberGenerator.new()
var o2: float = 0

var selected_plant: Spatial = null
var player_inventory: int = ITEM.FERTILIZER
var player_inventory: int = ITEM.EMPTY setget set_item


func select_plant(plant: Spatial):
@@ -41,6 +44,12 @@ func unselect_plant(plant: Spatial):
selected_plant.highlight.visible = false
selected_plant = null

func set_item(item: int):
assert(item in ITEM.values())
player_inventory = item
emit_signal("item_changed")

func _input(_event):
if Input.is_action_just_pressed("Interact"):
selected_plant.interact()
if selected_plant != null:
selected_plant.interact()

Loading…
Cancel
Save