watering :)

This commit is contained in:
tess 2021-12-05 20:26:10 +01:00
parent b7670afa78
commit b3774be296
19 changed files with 380 additions and 6 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=2]
[gd_scene load_steps=22 format=2]
[ext_resource path="res://World/Plant.tscn" type="PackedScene" id=1]
[ext_resource path="res://World/FullscreenButton.gd" type="Script" id=2]
@ -11,6 +11,9 @@
[ext_resource path="res://Aseprite/pot.png" type="Texture" id=9]
[ext_resource path="res://Font/pixeloid-font/PixeloidMono-1G8ae.ttf" type="DynamicFontData" id=10]
[ext_resource path="res://World/Terminal.gd" type="Script" id=11]
[ext_resource path="res://Aseprite/wateringcan.png" type="Texture" id=12]
[ext_resource path="res://Tools/WateringCan.gd" type="Script" id=13]
[ext_resource path="res://Aseprite/wateringcanactive.png" type="Texture" id=14]
[sub_resource type="Theme" id=7]
@ -37,6 +40,15 @@ content_margin_bottom = 2.0
bg_color = Color( 0.14902, 0.0431373, 0.129412, 1 )
border_color = Color( 0.517647, 0.745098, 0.929412, 1 )
[sub_resource type="ParticlesMaterial" id=13]
flag_disable_z = true
direction = Vector3( -1, 0, 0 )
gravity = Vector3( 0, 98, 0 )
initial_velocity = 15.0
orbit_velocity = 0.0
orbit_velocity_random = 0.0
color = Color( 0.341176, 0.337255, 0.756863, 1 )
[node name="Main" type="Node2D"]
[node name="Plant" parent="." instance=ExtResource( 1 )]
@ -46,6 +58,7 @@ margin_left = 236.0
margin_top = 2.0
margin_right = 254.0
margin_bottom = 142.0
mouse_filter = 2
theme = SubResource( 7 )
custom_styles/panel = SubResource( 1 )
__meta__ = {
@ -87,6 +100,7 @@ margin_left = 128.0
margin_top = 2.0
margin_right = 234.0
margin_bottom = 142.0
mouse_filter = 2
theme = SubResource( 7 )
custom_styles/panel = SubResource( 1 )
__meta__ = {
@ -113,6 +127,29 @@ __meta__ = {
[node name="Reveal" type="Timer" parent="RightPanel/Terminal"]
wait_time = 0.15
[node name="WateringCan" type="TextureButton" parent="RightPanel"]
margin_left = 2.0
margin_top = 122.0
margin_right = 19.0
margin_bottom = 139.0
texture_normal = ExtResource( 12 )
texture_pressed = ExtResource( 14 )
texture_hover = ExtResource( 14 )
texture_disabled = ExtResource( 12 )
script = ExtResource( 13 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Timer" type="Timer" parent="RightPanel/WateringCan"]
[node name="Particles2D" type="Particles2D" parent="RightPanel/WateringCan"]
position = Vector2( -56, -1 )
emitting = false
amount = 15
lifetime = 0.5
process_material = SubResource( 13 )
[node name="Pot" type="Sprite" parent="."]
position = Vector2( 64, 136 )
texture = ExtResource( 9 )
@ -121,3 +158,5 @@ texture = ExtResource( 9 )
[connection signal="pressed" from="Options/FullscreenButton" to="Options/FullscreenButton" method="_on_FullscreenButton_pressed"]
[connection signal="value_changed" from="Options/MusicVolume" to="Options/MusicVolume" method="_on_MusicVolume_value_changed"]
[connection signal="timeout" from="RightPanel/Terminal/Reveal" to="RightPanel/Terminal" method="_on_Reveal_timeout"]
[connection signal="pressed" from="RightPanel/WateringCan" to="RightPanel/WateringCan" method="_on_WateringCan_pressed"]
[connection signal="timeout" from="RightPanel/WateringCan/Timer" to="Plant" method="add_water"]

View file

@ -5,6 +5,7 @@
[node name="Pixel" type="ColorRect"]
margin_right = 1.0
margin_bottom = 1.0
mouse_filter = 2
script = ExtResource( 1 )
__meta__ = {
"_edit_use_anchors_": false

View file

@ -6,7 +6,7 @@ var active = []
var rng
var branches = 4
var water = 10
var water = 20
var health = 100
var social = 50
var light = 50
@ -35,8 +35,7 @@ func step():
func communicate_needs():
var needs = [(50 - water) * 2, 100 - health, 100 - social, (50 - light) * 2]
var n
var most_important = [n, needs[0]]
var most_important = [0, needs[0]]
var i = 0
for need in needs:
if most_important[1] <= need:
@ -45,7 +44,7 @@ func communicate_needs():
i += 1
var names = ["water", "health", "social", "light"]
most_important[0] = names[most_important[0]]
if (last_need[0] != most_important[0]) or (abs(last_need[1] - most_important[1]) >= 10):
if (last_need[0] != most_important[0]) || (abs(last_need[1] - most_important[1]) >= 10):
emit_signal("has_need", most_important)
last_need = most_important
@ -119,3 +118,8 @@ func blossom():
func _on_WaterTimer_timeout() -> void:
water = clamp(water - 1, 0, 100)
func add_water():
water = clamp(water + 1, 0, 100)
print(water)

View file

@ -10,7 +10,7 @@ wait_time = 0.25
autostart = true
[node name="WaterTimer" type="Timer" parent="."]
wait_time = 0.25
wait_time = 20.0
autostart = true
[connection signal="timeout" from="Timer" to="." method="step"]