water mesages

This commit is contained in:
zoe 2021-12-05 17:31:10 +01:00
parent e830272236
commit b7670afa78
10 changed files with 155 additions and 26 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,2 @@
license: SIL Open Font License (OFL)
link: https://www.fontspace.com/pixeloid-font-f69232

8
Menu/Scrollbar.tres Normal file
View file

@ -0,0 +1,8 @@
[gd_resource type="StyleBoxFlat" format=2]
[resource]
bg_color = Color( 0.517647, 0.745098, 0.929412, 1 )
border_width_left = 4
border_width_right = 4
border_width_bottom = 2
border_color = Color( 0.14902, 0.0431373, 0.129412, 1 )

View file

@ -1,3 +1,44 @@
[gd_resource type="Theme" format=2] [gd_resource type="Theme" load_steps=5 format=2]
[ext_resource path="res://Menu/Scrollbar.tres" type="StyleBox" id=1]
[sub_resource type="StyleBoxFlat" id=1]
content_margin_left = 2.0
content_margin_right = 2.0
content_margin_top = 4.0
content_margin_bottom = 4.0
bg_color = Color( 0.14902, 0.0431373, 0.129412, 1 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.517647, 0.745098, 0.929412, 1 )
[sub_resource type="StyleBoxFlat" id=2]
bg_color = Color( 0.14902, 0.0431373, 0.129412, 1 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.745098, 0.929412, 0.517647, 1 )
[sub_resource type="StyleBoxFlat" id=3]
bg_color = Color( 0.14902, 0.0431373, 0.129412, 1 )
border_width_left = 1
border_width_top = 1
border_width_right = 1
border_width_bottom = 1
border_color = Color( 0.745098, 0.929412, 0.517647, 1 )
[resource] [resource]
VScrollBar/icons/decrement = null
VScrollBar/icons/decrement_highlight = null
VScrollBar/icons/decrement_pressed = null
VScrollBar/icons/increment = null
VScrollBar/icons/increment_highlight = null
VScrollBar/icons/increment_pressed = null
VScrollBar/styles/grabber = SubResource( 1 )
VScrollBar/styles/grabber_highlight = SubResource( 2 )
VScrollBar/styles/grabber_pressed = SubResource( 3 )
VScrollBar/styles/scroll = ExtResource( 1 )
VScrollBar/styles/scroll_focus = ExtResource( 1 )

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=2] [gd_scene load_steps=18 format=2]
[ext_resource path="res://World/Plant.tscn" type="PackedScene" id=1] [ext_resource path="res://World/Plant.tscn" type="PackedScene" id=1]
[ext_resource path="res://World/FullscreenButton.gd" type="Script" id=2] [ext_resource path="res://World/FullscreenButton.gd" type="Script" id=2]
@ -9,6 +9,10 @@
[ext_resource path="res://Aseprite/music.png" type="Texture" id=7] [ext_resource path="res://Aseprite/music.png" type="Texture" id=7]
[ext_resource path="res://Aseprite/music_hover.png" type="Texture" id=8] [ext_resource path="res://Aseprite/music_hover.png" type="Texture" id=8]
[ext_resource path="res://Aseprite/pot.png" type="Texture" id=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]
[sub_resource type="Theme" id=7]
[sub_resource type="StyleBoxFlat" id=1] [sub_resource type="StyleBoxFlat" id=1]
bg_color = Color( 0.14902, 0.0431373, 0.129412, 1 ) bg_color = Color( 0.14902, 0.0431373, 0.129412, 1 )
@ -18,6 +22,21 @@ bg_color = Color( 0.517647, 0.745098, 0.929412, 1 )
expand_margin_left = 2.0 expand_margin_left = 2.0
expand_margin_right = 2.0 expand_margin_right = 2.0
[sub_resource type="CanvasItemMaterial" id=3]
[sub_resource type="DynamicFont" id=4]
size = 8
extra_spacing_char = 1
font_data = ExtResource( 10 )
[sub_resource type="StyleBoxFlat" id=6]
content_margin_left = 2.0
content_margin_right = 2.0
content_margin_top = 2.0
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 )
[node name="Main" type="Node2D"] [node name="Main" type="Node2D"]
[node name="Plant" parent="." instance=ExtResource( 1 )] [node name="Plant" parent="." instance=ExtResource( 1 )]
@ -27,7 +46,7 @@ margin_left = 236.0
margin_top = 2.0 margin_top = 2.0
margin_right = 254.0 margin_right = 254.0
margin_bottom = 142.0 margin_bottom = 142.0
theme = ExtResource( 5 ) theme = SubResource( 7 )
custom_styles/panel = SubResource( 1 ) custom_styles/panel = SubResource( 1 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
@ -68,43 +87,37 @@ margin_left = 128.0
margin_top = 2.0 margin_top = 2.0
margin_right = 234.0 margin_right = 234.0
margin_bottom = 142.0 margin_bottom = 142.0
theme = ExtResource( 5 ) theme = SubResource( 7 )
custom_styles/panel = SubResource( 1 ) custom_styles/panel = SubResource( 1 )
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="RichTextLabel" type="RichTextLabel" parent="RightPanel"] [node name="Terminal" type="RichTextLabel" parent="RightPanel"]
material = SubResource( 3 )
margin_left = 1.0 margin_left = 1.0
margin_top = 1.0 margin_top = 1.0
margin_right = 105.0 margin_right = 105.0
margin_bottom = 120.0 margin_bottom = 120.0
theme = ExtResource( 5 )
custom_colors/default_color = Color( 0.94902, 0.988235, 0.878431, 1 )
custom_fonts/normal_font = SubResource( 4 )
custom_styles/normal = SubResource( 6 )
bbcode_enabled = true bbcode_enabled = true
bbcode_text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Cras pulvinar mattis nunc sed blandit libero volutpat sed cras. Vulputate ut pharetra sit amet. Viverra ipsum nunc aliquet bibendum enim facilisis gravida. Sed egestas egestas fringilla phasellus. Amet consectetur adipiscing elit pellentesque. Egestas egestas fringilla phasellus faucibus scelerisque eleifend donec. Facilisi nullam vehicula ipsum a arcu. At erat pellentesque adipiscing commodo elit at imperdiet. Sed euismod nisi porta lorem. Purus faucibus ornare suspendisse sed nisi lacus sed viverra. Sed sed risus pretium quam vulputate. Massa ultricies mi quis hendrerit. Diam in arcu cursus euismod quis viverra nibh cras pulvinar. Nulla pharetra diam sit amet. Sed euismod nisi porta lorem mollis aliquam ut porttitor. Cursus turpis massa tincidunt dui ut ornare lectus. In aliquam sem fringilla ut morbi. scroll_following = true
script = ExtResource( 11 )
Proin sagittis nisl rhoncus mattis rhoncus urna neque. In massa tempor nec feugiat nisl pretium fusce id. Urna condimentum mattis pellentesque id. Ut lectus arcu bibendum at varius vel pharetra vel. Volutpat est velit egestas dui id ornare arcu odio ut. Turpis egestas sed tempus urna. Amet dictum sit amet justo donec. Cursus sit amet dictum sit amet justo. Tellus in hac habitasse platea dictumst vestibulum rhoncus est. Amet nisl purus in mollis nunc. Amet tellus cras adipiscing enim eu turpis egestas pretium. Hac habitasse platea dictumst quisque sagittis purus sit. Eu scelerisque felis imperdiet proin fermentum leo.
Vitae ultricies leo integer malesuada nunc vel. Tempus urna et pharetra pharetra massa massa ultricies. Scelerisque purus semper eget duis. Urna condimentum mattis pellentesque id nibh tortor id aliquet lectus. Ut ornare lectus sit amet est placerat in egestas. Eget lorem dolor sed viverra ipsum nunc aliquet bibendum enim. Nam libero justo laoreet sit amet cursus. Amet consectetur adipiscing elit duis tristique sollicitudin nibh. Odio euismod lacinia at quis risus sed vulputate. Mi in nulla posuere sollicitudin aliquam ultrices sagittis. Sapien et ligula ullamcorper malesuada proin libero. Vitae turpis massa sed elementum tempus. Diam quis enim lobortis scelerisque. Volutpat est velit egestas dui id ornare arcu odio.
Ultricies lacus sed turpis tincidunt id. Id ornare arcu odio ut sem nulla pharetra diam sit. Quam viverra orci sagittis eu volutpat odio facilisis. Vulputate mi sit amet mauris commodo quis imperdiet massa. Blandit massa enim nec dui nunc mattis enim ut tellus. Integer vitae justo eget magna fermentum iaculis eu non diam. Et odio pellentesque diam volutpat commodo sed egestas. Leo a diam sollicitudin tempor id eu nisl. Quis hendrerit dolor magna eget est lorem ipsum dolor. Ultrices gravida dictum fusce ut placerat orci nulla pellentesque dignissim.
Duis at tellus at urna condimentum mattis. At urna condimentum mattis pellentesque id nibh tortor. In ante metus dictum at tempor commodo. Nulla porttitor massa id neque aliquam. Duis tristique sollicitudin nibh sit amet commodo nulla. Mauris vitae ultricies leo integer malesuada nunc vel risus commodo. Faucibus a pellentesque sit amet. Turpis in eu mi bibendum neque egestas congue quisque egestas. Quam lacus suspendisse faucibus interdum posuere. In egestas erat imperdiet sed euismod nisi porta lorem. Tempor nec feugiat nisl pretium fusce id. Ipsum dolor sit amet consectetur adipiscing elit."
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Cras pulvinar mattis nunc sed blandit libero volutpat sed cras. Vulputate ut pharetra sit amet. Viverra ipsum nunc aliquet bibendum enim facilisis gravida. Sed egestas egestas fringilla phasellus. Amet consectetur adipiscing elit pellentesque. Egestas egestas fringilla phasellus faucibus scelerisque eleifend donec. Facilisi nullam vehicula ipsum a arcu. At erat pellentesque adipiscing commodo elit at imperdiet. Sed euismod nisi porta lorem. Purus faucibus ornare suspendisse sed nisi lacus sed viverra. Sed sed risus pretium quam vulputate. Massa ultricies mi quis hendrerit. Diam in arcu cursus euismod quis viverra nibh cras pulvinar. Nulla pharetra diam sit amet. Sed euismod nisi porta lorem mollis aliquam ut porttitor. Cursus turpis massa tincidunt dui ut ornare lectus. In aliquam sem fringilla ut morbi.
Proin sagittis nisl rhoncus mattis rhoncus urna neque. In massa tempor nec feugiat nisl pretium fusce id. Urna condimentum mattis pellentesque id. Ut lectus arcu bibendum at varius vel pharetra vel. Volutpat est velit egestas dui id ornare arcu odio ut. Turpis egestas sed tempus urna. Amet dictum sit amet justo donec. Cursus sit amet dictum sit amet justo. Tellus in hac habitasse platea dictumst vestibulum rhoncus est. Amet nisl purus in mollis nunc. Amet tellus cras adipiscing enim eu turpis egestas pretium. Hac habitasse platea dictumst quisque sagittis purus sit. Eu scelerisque felis imperdiet proin fermentum leo.
Vitae ultricies leo integer malesuada nunc vel. Tempus urna et pharetra pharetra massa massa ultricies. Scelerisque purus semper eget duis. Urna condimentum mattis pellentesque id nibh tortor id aliquet lectus. Ut ornare lectus sit amet est placerat in egestas. Eget lorem dolor sed viverra ipsum nunc aliquet bibendum enim. Nam libero justo laoreet sit amet cursus. Amet consectetur adipiscing elit duis tristique sollicitudin nibh. Odio euismod lacinia at quis risus sed vulputate. Mi in nulla posuere sollicitudin aliquam ultrices sagittis. Sapien et ligula ullamcorper malesuada proin libero. Vitae turpis massa sed elementum tempus. Diam quis enim lobortis scelerisque. Volutpat est velit egestas dui id ornare arcu odio.
Ultricies lacus sed turpis tincidunt id. Id ornare arcu odio ut sem nulla pharetra diam sit. Quam viverra orci sagittis eu volutpat odio facilisis. Vulputate mi sit amet mauris commodo quis imperdiet massa. Blandit massa enim nec dui nunc mattis enim ut tellus. Integer vitae justo eget magna fermentum iaculis eu non diam. Et odio pellentesque diam volutpat commodo sed egestas. Leo a diam sollicitudin tempor id eu nisl. Quis hendrerit dolor magna eget est lorem ipsum dolor. Ultrices gravida dictum fusce ut placerat orci nulla pellentesque dignissim.
Duis at tellus at urna condimentum mattis. At urna condimentum mattis pellentesque id nibh tortor. In ante metus dictum at tempor commodo. Nulla porttitor massa id neque aliquam. Duis tristique sollicitudin nibh sit amet commodo nulla. Mauris vitae ultricies leo integer malesuada nunc vel risus commodo. Faucibus a pellentesque sit amet. Turpis in eu mi bibendum neque egestas congue quisque egestas. Quam lacus suspendisse faucibus interdum posuere. In egestas erat imperdiet sed euismod nisi porta lorem. Tempor nec feugiat nisl pretium fusce id. Ipsum dolor sit amet consectetur adipiscing elit."
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Reveal" type="Timer" parent="RightPanel/Terminal"]
wait_time = 0.15
[node name="Pot" type="Sprite" parent="."] [node name="Pot" type="Sprite" parent="."]
position = Vector2( 64, 136 ) position = Vector2( 64, 136 )
texture = ExtResource( 9 ) texture = ExtResource( 9 )
[connection signal="has_need" from="Plant" to="RightPanel/Terminal" method="_on_Plant_has_need"]
[connection signal="pressed" from="Options/FullscreenButton" to="Options/FullscreenButton" method="_on_FullscreenButton_pressed"] [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="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"]

View file

@ -6,14 +6,49 @@ var active = []
var rng var rng
var branches = 4 var branches = 4
var water = 10
var health = 100
var social = 50
var light = 50
var last_need = ["x", -100]
signal has_need(need_and_value)
func get_mood() -> int:
return (
abs(50 - water) * 2 +
abs(50 - light) * 2 +
(100 - social) +
(100 - health))
func _process(_delta): func _process(_delta):
#step() #step()
pass pass
func step(): func step():
$Timer.wait_time = float(get_mood()) / 100 + 0.25
call_deferred("grow") call_deferred("grow")
if randi() % 400 == 0: if (randi() % 200 == 0) && (get_mood() < 50):
blossom() blossom()
communicate_needs()
func communicate_needs():
var needs = [(50 - water) * 2, 100 - health, 100 - social, (50 - light) * 2]
var n
var most_important = [n, needs[0]]
var i = 0
for need in needs:
if most_important[1] <= need:
most_important[1] = need
most_important[0] = i
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):
emit_signal("has_need", most_important)
last_need = most_important
func _ready(): func _ready():
randomize() randomize()
@ -26,6 +61,7 @@ func _ready():
branches = rng.randi_range(2, 24) branches = rng.randi_range(2, 24)
print(branches) print(branches)
func spawn_pixels(): func spawn_pixels():
for n in size.x: for n in size.x:
var pixels_y = [] var pixels_y = []
@ -42,17 +78,20 @@ func spawn_pixels():
pixels_y.append(pixel) pixels_y.append(pixel)
pixels_x.append(pixels_y) pixels_x.append(pixels_y)
func plant_seed(): func plant_seed():
var plant_seed = pixels_x[size.x / 2][size.y - 10] var plant_seed = pixels_x[size.x / 2][size.y - 10]
plant_seed.active = true plant_seed.active = true
active.append(plant_seed) active.append(plant_seed)
func grow(): func grow():
if (randi() % branches) >= 1: if (randi() % branches) >= 1:
new_pixel(active[active.size() - 1]) new_pixel(active[active.size() - 1])
else: else:
new_pixel(active[randi() % active.size()]) new_pixel(active[randi() % active.size()])
func new_pixel(original_pixel): func new_pixel(original_pixel):
var var_x = rng.randi_range(-1, 1) var var_x = rng.randi_range(-1, 1)
var var_y var var_y
@ -76,3 +115,7 @@ func blossom():
var main = get_tree().current_scene var main = get_tree().current_scene
flower.global_position = active[randi() % active.size()].position flower.global_position = active[randi() % active.size()].position
main.add_child(flower) main.add_child(flower)
func _on_WaterTimer_timeout() -> void:
water = clamp(water - 1, 0, 100)

View file

@ -9,4 +9,9 @@ script = ExtResource( 2 )
wait_time = 0.25 wait_time = 0.25
autostart = true autostart = true
[node name="WaterTimer" type="Timer" parent="."]
wait_time = 0.25
autostart = true
[connection signal="timeout" from="Timer" to="." method="step"] [connection signal="timeout" from="Timer" to="." method="step"]
[connection signal="timeout" from="WaterTimer" to="." method="_on_WaterTimer_timeout"]

17
World/Terminal.gd Normal file
View file

@ -0,0 +1,17 @@
extends RichTextLabel
func _ready() -> void:
visible_characters = 0
func _on_Plant_has_need(need_and_value) -> void:
print_message(need_and_value)
func print_message(mesage):
$Reveal.start()
text = text + "\n >" + str(mesage) + "\n "
func _on_Reveal_timeout() -> void:
if visible_characters <= text.length():
visible_characters += 1
else: $Reveal.stop()