From c203f91773627044032ee48a4279ebefeb9defd2 Mon Sep 17 00:00:00 2001 From: zoe Date: Sat, 4 Dec 2021 21:02:52 +0100 Subject: [PATCH] fix rng --- ...r.png-e929cea0d46f4133150363a964ff9c1b.md5 | 4 +- ....png-e929cea0d46f4133150363a964ff9c1b.stex | Bin 192 -> 190 bytes ...n.png-55cf7f791aa76b3efef5dd425b98ad37.md5 | 4 +- ....png-55cf7f791aa76b3efef5dd425b98ad37.stex | Bin 94 -> 94 bytes ...t.png-eb9d8f974e073ed3fcac9a6fcb0ed59d.md5 | 3 + ....png-eb9d8f974e073ed3fcac9a6fcb0ed59d.stex | Bin 0 -> 166 bytes ...e.png-696f4cca1b0bcc26fbe121cf2289b53b.md5 | 3 + ...c.png-d125e661be6c28155c2d451004121da2.md5 | 4 +- ....png-d125e661be6c28155c2d451004121da2.stex | Bin 104 -> 104 bytes Aseprite/flower.png | Bin 296 -> 293 bytes Aseprite/flower.png.import | 2 +- Aseprite/fullscreen.png | Bin 126 -> 125 bytes Aseprite/music.png | Bin 162 -> 162 bytes World/Flower.gd | 18 +++ World/Flower.tscn | 105 ++++++++++++++++++ World/Main.tscn | 18 +-- World/Plant.gd | 17 ++- mouse-export.png | Bin 0 -> 525 bytes mouse-export.png.import | 35 ++++++ project.godot | 10 +- 20 files changed, 204 insertions(+), 19 deletions(-) create mode 100644 .import/mouse-export.png-eb9d8f974e073ed3fcac9a6fcb0ed59d.md5 create mode 100644 .import/mouse-export.png-eb9d8f974e073ed3fcac9a6fcb0ed59d.stex create mode 100644 .import/mouse.png-696f4cca1b0bcc26fbe121cf2289b53b.md5 create mode 100644 World/Flower.gd create mode 100644 World/Flower.tscn create mode 100644 mouse-export.png create mode 100644 mouse-export.png.import diff --git a/.import/flower.png-e929cea0d46f4133150363a964ff9c1b.md5 b/.import/flower.png-e929cea0d46f4133150363a964ff9c1b.md5 index 3a6e728..730574a 100644 --- a/.import/flower.png-e929cea0d46f4133150363a964ff9c1b.md5 +++ b/.import/flower.png-e929cea0d46f4133150363a964ff9c1b.md5 @@ -1,3 +1,3 @@ -source_md5="e56323172c35ab6fbd3e177f6e1c97af" -dest_md5="dca55ff091eaf824465103f8cc26a901" +source_md5="93e7f572b0038afa24d43c51b3a16333" +dest_md5="fc7ae29ca7b2f63847191521b213e81f" diff --git a/.import/flower.png-e929cea0d46f4133150363a964ff9c1b.stex b/.import/flower.png-e929cea0d46f4133150363a964ff9c1b.stex index 3dc00e0a402349b5e5f3f61d2bd65993f327e21d..505d98186385d315f2266f0e41760b507da4d24c 100644 GIT binary patch literal 190 zcmZ>F2@VNlU|`?`VhB)RV+1l50dcsiQ$UcXo7*%fJ1oG$rxVE54`5&tFki4DS9-;U z)0+bNa@Q*=3b#f4Z%`6AxOzdZ^s?#uO)8{kaB_70k=OkbDOSu7%l+YfW1xy>5YxAc z$B9WiIS(5S9Ei(b_cj0V0SA}=qC0XI_dHa1pAf^UkkGbMflc5jPjTTE;i9{~=F?4D gBbYBpmYk@=^bKnF2@Z*3U|`?^Viq7~U{GLV1d>aDINa4KAjs3rZ3dJb7GUAi17zz*Ixq>?FIbT) zt+CuJcD<>w~e`5 z53*+4{7Jk!kA;m{_w~E_s!vG@i~e)nInnSaP5ga8yTzMF4g&05Cs?0LtY=i6SJ?Ma m>e96H7T+J5-h9Iv{zbsw;&_Fxnei>*zBfDG%4fEeGXek~hDcuk diff --git a/.import/fullscreen.png-55cf7f791aa76b3efef5dd425b98ad37.md5 b/.import/fullscreen.png-55cf7f791aa76b3efef5dd425b98ad37.md5 index 3e87a8d..813603a 100644 --- a/.import/fullscreen.png-55cf7f791aa76b3efef5dd425b98ad37.md5 +++ b/.import/fullscreen.png-55cf7f791aa76b3efef5dd425b98ad37.md5 @@ -1,3 +1,3 @@ -source_md5="d2c223adbb6b13c83613990e6f18bd10" -dest_md5="ca793b2f3d46e3424730440450e8dc84" +source_md5="d8d99212e22df5afe49c354a17538b6c" +dest_md5="43d5d19fe865943da55ee0d1d1acb042" diff --git a/.import/fullscreen.png-55cf7f791aa76b3efef5dd425b98ad37.stex b/.import/fullscreen.png-55cf7f791aa76b3efef5dd425b98ad37.stex index 2e0ced951b00934b72319920551a38cd4fb71e6d..c35e92579cc49ac0630e07f5b270b965caf6eeed 100644 GIT binary patch delta 12 Tcma!xn_$hd&)MSbM0F2@Y{!U|;}Y79eI|P+(&Ol3hR??&=f}Hr-j5CUOEbk%_v~_+ivR!s literal 0 HcmV?d00001 diff --git a/.import/mouse.png-696f4cca1b0bcc26fbe121cf2289b53b.md5 b/.import/mouse.png-696f4cca1b0bcc26fbe121cf2289b53b.md5 new file mode 100644 index 0000000..fa8adbb --- /dev/null +++ b/.import/mouse.png-696f4cca1b0bcc26fbe121cf2289b53b.md5 @@ -0,0 +1,3 @@ +source_md5="6982b8d2888401bab19e0eb6bc3362ce" +dest_md5="0d8f3625f069c03eb3d72769d0d7211f" + diff --git a/.import/music.png-d125e661be6c28155c2d451004121da2.md5 b/.import/music.png-d125e661be6c28155c2d451004121da2.md5 index c90a69a..26809b6 100644 --- a/.import/music.png-d125e661be6c28155c2d451004121da2.md5 +++ b/.import/music.png-d125e661be6c28155c2d451004121da2.md5 @@ -1,3 +1,3 @@ -source_md5="c632c103f99ec61a551cb31ec0143c4f" -dest_md5="91acb9457da06ce66a7ab0f91bb93138" +source_md5="4de23f4ba366cab25aba36e4770f375a" +dest_md5="f1460f412c4dd7b91479c8a41e7c2c47" diff --git a/.import/music.png-d125e661be6c28155c2d451004121da2.stex b/.import/music.png-d125e661be6c28155c2d451004121da2.stex index 510956bf8790e3d37e14634512f10128fba221eb..88ab2e886ee5ee344c9ed789763d0254221db8e5 100644 GIT binary patch delta 50 zcmV-20L}ksXplQCh1r{UJ%oAw0}pCyTWt<97?DAWH)Lc>Wb~%&kFgNZ{{YBdmh#gY ICnquh03?MKLjV8( delta 50 zcmV-20L}ksXplQC2maH@KL~vO;{j?S+ljuiB-}EfLq@!D$)H3=S}a8LKLAr|xBgBU I;dN6009Hp9XaE2J diff --git a/Aseprite/flower.png b/Aseprite/flower.png index f21deea19d5a883380ab554a5e59fd9f404b7e40..01baa8121efc233f11ccf9665bb1e8a001b07cb4 100644 GIT binary patch literal 293 zcmV+=0owkFP)aeA00001b5ch_0Itp) z=>Px#-$_J4R7i>K)x8aaFc1ac=SWbo0E|G3!U{BGgiMzaNW%(5C|!yS01Hq-aa2ag zU>|XQAWE*i55aqY4E$%9GET_G?B4S@pB>xq>b`0mqtlsHOI$nrc&f%h-4d$C(cVjE ztV-NUc)6Fs<{W3rIH4>|scs3!OM<#3WMN8U$C*iq-xOZ%WiZuoM&09jpSUGPmlyR&V|!rsj7nr-$0+wh00000NkvXXu0mjf>WO_L literal 296 zcmV+@0oVSCP)Px#;z>k7R7i>K)x8aaFc1ac=SWboKp24*g%#Y85i(syAPp-Jp>!!S04zWS#ieo- zS^ha<3Pg+ggA;>igK2?v&m?N*q$Aoc$3|2|K$+8P_p l6GV8p3}y*QN@$)v$B^eJt=tt|beI7MJYD@<);T3K0RTV;9@+o^ delta 82 zcmb=en_%c`;pyTSV$qxY=gaeh^=u{wjxRdUp?B=SfddV`x@C?^2bbIP|1+MrT9S?J mUPGXP#(@m4l!PTF*31n5zRBISbg8?*00f?{elF{r5}E)6`XZbF diff --git a/Aseprite/music.png b/Aseprite/music.png index d87b38f1e47fe667b5f8edbe4aeaf9cccbbadb21..d9bca1876fa517937cd99101ad2b2ff67df7b5f0 100644 GIT binary patch delta 112 zcmV-$0FVEo0ipqrIcaR!_x3*n1%QQtfq`L>uL)V2<2Ijx7=TL>7eKZUs{wJF&){_x zvOE)EhvEmL1`GxRP|^Xu#Dhzo37;e}hQkd&PI=f;Auf3qT#B#(Z1RkhW@iAE_8`lL SRe&r20000h5) z$ns2t9f}`}8Za0PKuHJq5)UqUCVY~_7!Ef8IptwXg}CHda4EtDu*ox0nw void: + frame = 0 + play("blossom") + $Tween.interpolate_property(self, "rotation_degrees", 0, 360, 1, Tween.TRANS_BOUNCE, Tween.EASE_OUT) + $Tween.start() + +func remove(): + can_be_removed = true + play("remove") + +func _on_Flower_animation_finished() -> void: + if can_be_removed: + queue_free() diff --git a/World/Flower.tscn b/World/Flower.tscn new file mode 100644 index 0000000..655b18a --- /dev/null +++ b/World/Flower.tscn @@ -0,0 +1,105 @@ +[gd_scene load_steps=22 format=2] + +[ext_resource path="res://Aseprite/flower.png" type="Texture" id=1] +[ext_resource path="res://World/Flower.gd" type="Script" id=2] + +[sub_resource type="AtlasTexture" id=12] +atlas = ExtResource( 1 ) +region = Rect2( 72, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=13] +atlas = ExtResource( 1 ) +region = Rect2( 63, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=14] +atlas = ExtResource( 1 ) +region = Rect2( 45, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=15] +atlas = ExtResource( 1 ) +region = Rect2( 54, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=16] +atlas = ExtResource( 1 ) +region = Rect2( 36, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=17] +atlas = ExtResource( 1 ) +region = Rect2( 27, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=18] +atlas = ExtResource( 1 ) +region = Rect2( 18, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=19] +atlas = ExtResource( 1 ) +region = Rect2( 9, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=20] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=2] +atlas = ExtResource( 1 ) +region = Rect2( 0, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=3] +atlas = ExtResource( 1 ) +region = Rect2( 9, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=4] +atlas = ExtResource( 1 ) +region = Rect2( 18, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=5] +atlas = ExtResource( 1 ) +region = Rect2( 27, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=6] +atlas = ExtResource( 1 ) +region = Rect2( 36, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=7] +atlas = ExtResource( 1 ) +region = Rect2( 45, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=8] +atlas = ExtResource( 1 ) +region = Rect2( 54, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=9] +atlas = ExtResource( 1 ) +region = Rect2( 63, 0, 9, 9 ) + +[sub_resource type="AtlasTexture" id=10] +atlas = ExtResource( 1 ) +region = Rect2( 72, 0, 9, 9 ) + +[sub_resource type="SpriteFrames" id=1] +animations = [ { +"frames": [ SubResource( 12 ), SubResource( 13 ), SubResource( 14 ), SubResource( 15 ), SubResource( 16 ), SubResource( 17 ), SubResource( 18 ), SubResource( 19 ), SubResource( 20 ) ], +"loop": false, +"name": "remove", +"speed": 15.0 +}, { +"frames": [ SubResource( 2 ), SubResource( 3 ), SubResource( 4 ), SubResource( 5 ), SubResource( 6 ), SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ) ], +"loop": false, +"name": "blossom", +"speed": 15.0 +} ] + +[node name="Flower" type="AnimatedSprite"] +frames = SubResource( 1 ) +animation = "blossom" +frame = 8 +playing = true +script = ExtResource( 2 ) + +[node name="Timer" type="Timer" parent="."] +wait_time = 60.0 +autostart = true + +[node name="Tween" type="Tween" parent="."] + +[connection signal="animation_finished" from="." to="." method="_on_Flower_animation_finished"] +[connection signal="timeout" from="Timer" to="." method="remove"] diff --git a/World/Main.tscn b/World/Main.tscn index 08953bc..861c103 100644 --- a/World/Main.tscn +++ b/World/Main.tscn @@ -14,7 +14,7 @@ bg_color = Color( 0.14902, 0.0431373, 0.129412, 1 ) [sub_resource type="StyleBoxFlat" id=2] -bg_color = Color( 0.94902, 0.988235, 0.878431, 1 ) +bg_color = Color( 0.517647, 0.745098, 0.929412, 1 ) expand_margin_left = 2.0 expand_margin_right = 2.0 @@ -22,7 +22,7 @@ expand_margin_right = 2.0 [node name="Plant" parent="." instance=ExtResource( 1 )] -[node name="Panel" type="Panel" parent="."] +[node name="Options" type="Panel" parent="."] margin_left = 236.0 margin_top = 2.0 margin_right = 254.0 @@ -33,7 +33,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="FullscreenButton" type="TextureButton" parent="Panel"] +[node name="FullscreenButton" type="TextureButton" parent="Options"] margin_left = 1.0 margin_top = 123.0 margin_right = 17.0 @@ -45,7 +45,7 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="MusicVolume" type="VSlider" parent="Panel"] +[node name="MusicVolume" type="VSlider" parent="Options"] margin_left = 1.0 margin_top = 1.0 margin_right = 17.0 @@ -63,8 +63,8 @@ __meta__ = { } bus_channel = "Music" -[node name="Panel2" type="Panel" parent="."] -margin_left = 130.0 +[node name="RightPanel" type="Panel" parent="."] +margin_left = 128.0 margin_top = 2.0 margin_right = 234.0 margin_bottom = 142.0 @@ -74,9 +74,9 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="Sprite" type="Sprite" parent="."] +[node name="Pot" type="Sprite" parent="."] position = Vector2( 64, 136 ) texture = ExtResource( 9 ) -[connection signal="pressed" from="Panel/FullscreenButton" to="Panel/FullscreenButton" method="_on_FullscreenButton_pressed"] -[connection signal="value_changed" from="Panel/MusicVolume" to="Panel/MusicVolume" method="_on_MusicVolume_value_changed"] +[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"] diff --git a/World/Plant.gd b/World/Plant.gd index f51a088..0d29bfc 100644 --- a/World/Plant.gd +++ b/World/Plant.gd @@ -4,21 +4,27 @@ export var size = Vector2() var pixels_x = [] var active = [] var rng +var branches = 4 func _process(_delta): - # step() + step() pass func step(): call_deferred("grow") + if randi() % 400 == 0: + blossom() func _ready(): randomize() rng = RandomNumberGenerator.new() + rng.randomize() size.x = ProjectSettings.get_setting("display/window/size/width") / 2 size.y = ProjectSettings.get_setting("display/window/size/height") call_deferred("spawn_pixels") call_deferred("plant_seed") + branches = rng.randi_range(2, 24) + print(branches) func spawn_pixels(): for n in size.x: @@ -42,7 +48,7 @@ func plant_seed(): active.append(plant_seed) func grow(): - if (randi() % 4) >= 1: + if (randi() % branches) >= 1: new_pixel(active[active.size() - 1]) else: new_pixel(active[randi() % active.size()]) @@ -63,3 +69,10 @@ func new_pixel(original_pixel): active.append(new_pixel) new_pixel.age_up() + +func blossom(): + var Flower = preload("res://World/Flower.tscn") + var flower = Flower.instance() + var main = get_tree().current_scene + flower.global_position = active[randi() % active.size()].position + main.add_child(flower) diff --git a/mouse-export.png b/mouse-export.png new file mode 100644 index 0000000000000000000000000000000000000000..2adbe36b41bada3b0dbb1bc6270f000f20ec285b GIT binary patch literal 525 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D%zk9)c}hE&XX zJKHepu!Df>(hYO{C%Wy}d{C1)?+#l{lgv4FfhDEM9y1*-v6@@DzFNZlX8MJcEkSk} z|6b?lZjPTn^J-RkXt>|3t8X8Cz57?~_upTC{=I$6{OGDc{)WF_Utbpee@s6!@&v;+ z2D7bK8M6Ns+)3Ym{%z`pWAgLkj=lKx^h<$x#b2P{_kukAo2A)49P=5C8gv_c583ZA z&A)1K?E}wSV_OTgklcH6$6G!~Dlp$*y0PTatnKqIFOB$E{bk27m|)2>#(T5k^JlL) zW_NF$#HI|}1x??le%weYdzBa|%N=!|W@Y+n#e>2>!e|=$8Dw{2x3M7;_kN zgx1~epYeLS-E;Nc{I%*2_9)b_fgL=zoN-A>?ETaA-=W&2B@c)laAVuRy20={WAOUl z)!*5kzte}R<~;xKZ{l3p@#Sp55yofMl)J zd!~wIX-EG3zLN5B