Merge branch 'main' into main-window

This commit is contained in:
Zoey Kitt 2024-11-16 17:31:04 -06:00
commit 9f505c69ed
20 changed files with 537 additions and 22 deletions

BIN
UI/MousePrompt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

34
UI/MousePrompt.png.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://is20ioxt1vtm"
path="res://.godot/imported/MousePrompt.png-ed9ca78d2e5824537b7a8763755c2eae.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://UI/MousePrompt.png"
dest_files=["res://.godot/imported/MousePrompt.png-ed9ca78d2e5824537b7a8763755c2eae.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
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=1

BIN
UI/MousePrompt.xcf Normal file

Binary file not shown.

BIN
UI/MousePrompt2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://us0sonuda24u"
path="res://.godot/imported/MousePrompt2.png-c917e8205ae3985a502b0999c84ef600.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://UI/MousePrompt2.png"
dest_files=["res://.godot/imported/MousePrompt2.png-c917e8205ae3985a502b0999c84ef600.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
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=1

55
libs/shake_pivot.gd Normal file
View file

@ -0,0 +1,55 @@
class_name ShakePivot
extends Node2D
## Shakes on command. Use this node as the parent of a sprite or a camera to make it shake!
## Adapted from https://shaggydev.com/2022/02/23/screen-shake-godot/.
## How quickly to move through the noise.
@export var NOISE_SHAKE_SPEED: float = 20.0
## How much to multiply the noise values (which are in the range (-1, 1)) by.
@export var NOISE_SHAKE_STRENGTH: float = 15.0
## Multiplier for lerping the shake strength to zero.
@export var SHAKE_DECAY_RATE: float = 10.0
## Object that creates random noise to make for a nice shaking motion.
@onready var _noise := FastNoiseLite.new()
## Used to keep track of where we are in the noise so we can smoothly move through it.
var noise_i: float = 0.0
## Value taken from the noise to calculate the shaking node's position.
var shake_strength: float = 0.0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
# Set noise type to simplex, since the tutorial I'm copying (uh I mean taking inspiration from)
# is for an older version of Godot that had a dedicated simplex noise class
_noise.noise_type = FastNoiseLite.TYPE_SIMPLEX
# Randomize the generated noise
_noise.seed = randi()
# Period affects how quickly the noise changes values
_noise.frequency = 0.5
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
# Fade out the intensity over time
shake_strength = lerp(shake_strength, 0.0, SHAKE_DECAY_RATE * delta)
# Shake by adjusting position so we can move the object around
position = get_noise_offset(delta)
## Uses noise to generate a random 2D vector
func get_noise_offset(delta: float) -> Vector2:
noise_i += delta * NOISE_SHAKE_SPEED
# Set the x values of each call to 'get_noise_2d' to a different value so that our x and y
# vectors will read from unrelated areas of noise
return Vector2(
_noise.get_noise_2d(1, noise_i) * shake_strength,
_noise.get_noise_2d(100, noise_i) * shake_strength
)
## Sets the strength to its initial value.
func shake() -> void:
shake_strength = NOISE_SHAKE_STRENGTH

Binary file not shown.

After

Width:  |  Height:  |  Size: 9 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://crpp1qfyk4tv7"
path="res://.godot/imported/Kibbby.png-a5e7e28c8f175ffac07cfcdb8f612803.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scenes/microgames/fishin/Kibbby.png"
dest_files=["res://.godot/imported/Kibbby.png-a5e7e28c8f175ffac07cfcdb8f612803.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
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=1

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dcvie7ynwdfui"
path="res://.godot/imported/KibbbyHappy.png-2f6e79d205df1bdf038b3aa13617c533.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scenes/microgames/fishin/KibbbyHappy.png"
dest_files=["res://.godot/imported/KibbbyHappy.png-2f6e79d205df1bdf038b3aa13617c533.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
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=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://br3jiit0v6jes"
path="res://.godot/imported/KibbbyPulling.png-351fdd0a725255d7bbe5dd2e3b228f38.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scenes/microgames/fishin/KibbbyPulling.png"
dest_files=["res://.godot/imported/KibbbyPulling.png-351fdd0a725255d7bbe5dd2e3b228f38.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
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=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 9 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d4kyih3ivlqqc"
path="res://.godot/imported/KibbbySad.png-583f604f245d5791b483e626ccda4f31.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://scenes/microgames/fishin/KibbbySad.png"
dest_files=["res://.godot/imported/KibbbySad.png-583f604f245d5791b483e626ccda4f31.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
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=1

View file

@ -0,0 +1,113 @@
extends MicrogameWindow
const IN_GAME_WAIT_TIME = 10
var pulling: Sprite2D
var mash: Label
var you: Sprite2D
var sad: Sprite2D
var happy: Sprite2D
var mouse: Sprite2D
var shake: ShakePivot
var shake2: ShakePivot
var shake3: ShakePivot
var start_game_timer: Timer
var in_game_timer: Timer
var succfail_timer: Timer
var in_minigame = false
var num_clicks = 0
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pulling = $ShakePivot/pulling
you = $"you!"
mash = $ShakePivot2/MASH
mouse = $ShakePivot3/Mouse
shake = $ShakePivot
shake2 = $ShakePivot2
shake3 = $ShakePivot3
sad = $SAD
happy = $Happy
start_game_timer = $StartGame
in_game_timer = $InGame
succfail_timer = $SuccessFail
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
pass
func _on_texture_button_button_up() -> void:
shake.shake()
shake2.shake()
shake3.shake()
if in_minigame:
num_clicks -= 1
# YOU WIN
if num_clicks == 0:
in_minigame = false
# hide non-happy cats
pulling.visible = false
mash.visible = false
mouse.visible = false
sad.visible = false
you.visible = false
# show happy cat
happy.visible = true
in_game_timer.stop()
in_game_timer.wait_time = IN_GAME_WAIT_TIME
succfail_timer.start()
func _on_start_game_timeout() -> void:
if randf() < 0.1:
start_game_timer.stop()
in_game_timer.start()
in_minigame = true
# hide passive cats
you.visible = false
sad.visible = false
happy.visible = false
# show active cat
pulling.visible = true
mash.visible = true
mouse.visible = true
num_clicks = randi_range(5,21)
num_clicks = 21
# YOU LOSE
func _on_in_game_timeout() -> void:
in_minigame = false
# hide non-sad cats
you.visible = false
happy.visible = false
pulling.visible = false
mash.visible = false
mouse.visible = false
# show sad cat
sad.visible = true
in_game_timer.stop()
succfail_timer.start()
func _on_success_fail_timeout() -> void:
sad.visible = false
happy.visible = false
you.visible = true
succfail_timer.stop()
start_game_timer.start()

View file

@ -0,0 +1,130 @@
[gd_scene load_steps=14 format=3 uid="uid://c4s4pigu4pr48"]
[ext_resource type="Texture2D" uid="uid://voruypgyi77e" path="res://scenes/stockticker/UI-Background-Colour.png" id="1_cxqat"]
[ext_resource type="Script" path="res://scenes/microgames/fishin/fishin.gd" id="1_srw8b"]
[ext_resource type="Texture2D" uid="uid://crpp1qfyk4tv7" path="res://scenes/microgames/fishin/Kibbby.png" id="2_atppo"]
[ext_resource type="Texture2D" uid="uid://br3jiit0v6jes" path="res://scenes/microgames/fishin/KibbbyPulling.png" id="3_don82"]
[ext_resource type="Theme" uid="uid://ve18rbkeiwti" path="res://UI/text.tres" id="5_7qce4"]
[ext_resource type="Texture2D" uid="uid://is20ioxt1vtm" path="res://UI/MousePrompt.png" id="6_7ls0g"]
[ext_resource type="Texture2D" uid="uid://us0sonuda24u" path="res://UI/MousePrompt2.png" id="7_qpcgm"]
[ext_resource type="Script" path="res://libs/shake_pivot.gd" id="7_vnrfy"]
[ext_resource type="Texture2D" uid="uid://d4kyih3ivlqqc" path="res://scenes/microgames/fishin/KibbbySad.png" id="9_blola"]
[ext_resource type="Texture2D" uid="uid://dcvie7ynwdfui" path="res://scenes/microgames/fishin/KibbbyHappy.png" id="10_1il5r"]
[sub_resource type="Animation" id="Animation_bep6n"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("ShakePivot3/Mouse:texture")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [null]
}
[sub_resource type="Animation" id="Animation_fxbt5"]
resource_name = "mash"
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("ShakePivot3/Mouse:texture")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.0333334, 0.466667),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [ExtResource("6_7ls0g"), ExtResource("7_qpcgm")]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7e725"]
_data = {
"RESET": SubResource("Animation_bep6n"),
"mash": SubResource("Animation_fxbt5")
}
[node name="Node2D2" type="Window"]
position = Vector2i(0, 36)
size = Vector2i(930, 560)
unresizable = true
script = ExtResource("1_srw8b")
[node name="background" type="Sprite2D" parent="."]
modulate = Color(0.42, 0.700333, 1, 1)
position = Vector2(649.75, 362.25)
scale = Vector2(1300.5, 725.5)
texture = ExtResource("1_cxqat")
[node name="you!" type="Sprite2D" parent="."]
position = Vector2(535, 300)
texture = ExtResource("2_atppo")
[node name="TextureButton" type="TextureButton" parent="."]
offset_right = 1298.0
offset_bottom = 728.0
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_7e725")
}
autoplay = "mash"
speed_scale = 8.0
[node name="ShakePivot" type="Node2D" parent="."]
script = ExtResource("7_vnrfy")
[node name="pulling" type="Sprite2D" parent="ShakePivot"]
visible = false
position = Vector2(535, 300)
texture = ExtResource("3_don82")
[node name="ShakePivot2" type="Node2D" parent="."]
script = ExtResource("7_vnrfy")
[node name="MASH" type="Label" parent="ShakePivot2"]
visible = false
offset_left = 150.0
offset_top = 358.0
offset_right = 570.0
offset_bottom = 598.0
theme = ExtResource("5_7qce4")
theme_override_colors/font_color = Color(1, 0, 0, 1)
theme_override_font_sizes/font_size = 60
text = "MASH!!!"
[node name="ShakePivot3" type="Node2D" parent="."]
script = ExtResource("7_vnrfy")
[node name="Mouse" type="Sprite2D" parent="ShakePivot3"]
visible = false
position = Vector2(412, 532)
scale = Vector2(0.216276, 0.249769)
[node name="StartGame" type="Timer" parent="."]
autostart = true
[node name="InGame" type="Timer" parent="."]
wait_time = 3.0
[node name="SAD" type="Sprite2D" parent="."]
visible = false
position = Vector2(535, 300)
texture = ExtResource("9_blola")
[node name="Happy" type="Sprite2D" parent="."]
visible = false
position = Vector2(535, 300)
texture = ExtResource("10_1il5r")
[node name="SuccessFail" type="Timer" parent="."]
wait_time = 3.0
[connection signal="button_up" from="TextureButton" to="." method="_on_texture_button_button_up"]
[connection signal="timeout" from="StartGame" to="." method="_on_start_game_timeout"]
[connection signal="timeout" from="InGame" to="." method="_on_in_game_timeout"]
[connection signal="timeout" from="SuccessFail" to="." method="_on_success_fail_timeout"]

View file

@ -1,15 +1,17 @@
[gd_scene load_steps=11 format=3 uid="uid://g2veoq55y14i"]
[gd_scene load_steps=13 format=3 uid="uid://g2veoq55y14i"]
[ext_resource type="Script" path="res://scenes/stockticker/transactions.gd" id="1_1gmdn"]
[ext_resource type="Texture2D" uid="uid://voruypgyi77e" path="res://scenes/stockticker/UI-Background-Colour.png" id="1_wbfee"]
[ext_resource type="Script" path="res://scenes/stockticker/stonks.gd" id="2_pan4m"]
[ext_resource type="Theme" uid="uid://ve18rbkeiwti" path="res://UI/text.tres" id="3_dv3dr"]
[ext_resource type="Script" path="res://libs/shake_pivot.gd" id="4_ofsrv"]
[ext_resource type="Texture2D" uid="uid://vie3nmimge1t" path="res://scenes/stockticker/BuyButton.png" id="5_mpf30"]
[ext_resource type="Texture2D" uid="uid://dvidbk3clx6dn" path="res://scenes/stockticker/BuyButtonPressed.png" id="6_styy2"]
[ext_resource type="Texture2D" uid="uid://dw8wpd47me7wu" path="res://scenes/stockticker/SellButton.png" id="7_h6hir"]
[ext_resource type="Texture2D" uid="uid://b773rtpy6rtx5" path="res://scenes/stockticker/SellButtonPressed.png" id="8_essj7"]
[ext_resource type="Theme" path="res://UI/darksouls.tres" id="8_yqn4n"]
[ext_resource type="Texture2D" uid="uid://dpp7abs35p6i5" path="res://scenes/stockticker/fishe/gar.png" id="9_bv8iw"]
[ext_resource type="AudioStream" uid="uid://cy3ahp7fec1y2" path="res://funny_sounds/Metal pipe falling sound effect(loud).mp3" id="10_rkl57"]
[node name="Node2D" type="Node2D"]
script = ExtResource("1_1gmdn")
@ -23,9 +25,34 @@ texture = ExtResource("1_wbfee")
[node name="Timer" type="Timer" parent="."]
autostart = true
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(1036, 555)
scale = Vector2(0.671875, 0.622)
texture = ExtResource("9_bv8iw")
[node name="Label" type="Label" parent="."]
offset_left = 823.0
offset_top = 588.0
offset_right = 1082.0
offset_bottom = 785.0
theme = ExtResource("3_dv3dr")
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 82
text = "GAR"
[node name="Stonks" type="Node2D" parent="."]
script = ExtResource("2_pan4m")
[node name="ShakePivot" type="Node2D" parent="Stonks"]
script = ExtResource("4_ofsrv")
NOISE_SHAKE_STRENGTH = 30.0
SHAKE_DECAY_RATE = 5.0
[node name="StonkWindow" type="Sprite2D" parent="Stonks/ShakePivot"]
position = Vector2(582, 205)
scale = Vector2(1062.25, 337)
texture = ExtResource("1_wbfee")
[node name="SellButton" type="TextureButton" parent="Stonks"]
offset_left = 439.0
offset_top = 565.0
@ -34,11 +61,6 @@ offset_bottom = 694.0
texture_normal = ExtResource("7_h6hir")
texture_pressed = ExtResource("8_essj7")
[node name="StonkWindow" type="Sprite2D" parent="Stonks"]
position = Vector2(582, 205)
scale = Vector2(1062.25, 337)
texture = ExtResource("1_wbfee")
[node name="TopLine" type="Line2D" parent="Stonks"]
points = PackedVector2Array(50, 60, 1000, 60)
width = 1.0
@ -119,6 +141,9 @@ theme = ExtResource("3_dv3dr")
text = "Shares
Held:"
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="Stonks"]
stream = ExtResource("10_rkl57")
[node name="DarkSoulsTextBox" type="Sprite2D" parent="Stonks"]
visible = false
self_modulate = Color(0, 0, 0, 0.721569)
@ -136,21 +161,6 @@ theme = ExtResource("8_yqn4n")
text = "Stock Bankrupt"
horizontal_alignment = 1
[node name="Sprite2D" type="Sprite2D" parent="."]
position = Vector2(1036, 555)
scale = Vector2(0.671875, 0.622)
texture = ExtResource("9_bv8iw")
[node name="Label" type="Label" parent="."]
offset_left = 823.0
offset_top = 588.0
offset_right = 1082.0
offset_bottom = 785.0
theme = ExtResource("3_dv3dr")
theme_override_colors/font_color = Color(0, 0, 0, 1)
theme_override_font_sizes/font_size = 82
text = "GAR"
[connection signal="timeout" from="Timer" to="Stonks" method="_on_timer_timeout"]
[connection signal="buy" from="Stonks" to="." method="_on_stonks_buy"]
[connection signal="sell" from="Stonks" to="." method="_on_stonks_sell"]

View file

@ -20,7 +20,7 @@ var darksouls_text: Label
var price_history = []
var base_pos_mult = 0.5 # no size limit
var base_neg_mult = 0.5 # probably keep this below 1
var base_neg_mult = 100.5 # probably keep this below 1
var hype_mult = 1.0
var hype_decr = 0.1
@ -71,6 +71,7 @@ func draw_stonks(minval: Big, maxval: Big) -> void:
var pos = Vector2(x_pos, y_pos)
stonks.add_point(pos, index)
index += 1
func get_min_price() -> Big:
var minval = Big.new(-1)
@ -135,6 +136,8 @@ func _on_timer_timeout() -> void:
new_price = Big.new(0)
shares = 0
shares_label.text = "Shares\nHeld:%d" % shares
$AudioStreamPlayer.play()
$ShakePivot.shake()
if len(price_history) >= MAX_PRICES:
price_history.pop_front()