Merge branch 'main' into globaaaals
This commit is contained in:
commit
df074ff756
19 changed files with 411 additions and 0 deletions
BIN
ButtonBase.xcf
Normal file
BIN
ButtonBase.xcf
Normal file
Binary file not shown.
BIN
ButtonBasePressed.xcf
Normal file
BIN
ButtonBasePressed.xcf
Normal file
Binary file not shown.
BIN
UI-Background-Colour.xcf
Normal file
BIN
UI-Background-Colour.xcf
Normal file
Binary file not shown.
BIN
UI/templeos_font.ttf
Normal file
BIN
UI/templeos_font.ttf
Normal file
Binary file not shown.
34
UI/templeos_font.ttf.import
Normal file
34
UI/templeos_font.ttf.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="font_data_dynamic"
|
||||
type="FontFile"
|
||||
uid="uid://dexlelugh10is"
|
||||
path="res://.godot/imported/templeos_font.ttf-31870174b86b680d08fac45957776bd3.fontdata"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://UI/templeos_font.ttf"
|
||||
dest_files=["res://.godot/imported/templeos_font.ttf-31870174b86b680d08fac45957776bd3.fontdata"]
|
||||
|
||||
[params]
|
||||
|
||||
Rendering=null
|
||||
antialiasing=1
|
||||
generate_mipmaps=false
|
||||
disable_embedded_bitmaps=true
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
Compress=null
|
||||
compress=true
|
||||
preload=[]
|
||||
language_support={}
|
||||
script_support={}
|
||||
opentype_features={}
|
8
UI/text.tres
Normal file
8
UI/text.tres
Normal file
|
@ -0,0 +1,8 @@
|
|||
[gd_resource type="Theme" load_steps=2 format=3 uid="uid://ve18rbkeiwti"]
|
||||
|
||||
[ext_resource type="FontFile" uid="uid://dexlelugh10is" path="res://UI/templeos_font.ttf" id="1_vl4vs"]
|
||||
|
||||
[resource]
|
||||
Label/colors/font_color = Color(0, 0, 0, 1)
|
||||
Label/font_sizes/font_size = 30
|
||||
Label/fonts/font = ExtResource("1_vl4vs")
|
BIN
scenes/stockticker/BuyButton.png
Normal file
BIN
scenes/stockticker/BuyButton.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
34
scenes/stockticker/BuyButton.png.import
Normal file
34
scenes/stockticker/BuyButton.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://vie3nmimge1t"
|
||||
path="res://.godot/imported/BuyButton.png-edf9857fa46aeca6354e57c5c5fa4250.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/stockticker/BuyButton.png"
|
||||
dest_files=["res://.godot/imported/BuyButton.png-edf9857fa46aeca6354e57c5c5fa4250.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
scenes/stockticker/BuyButtonPressed.png
Normal file
BIN
scenes/stockticker/BuyButtonPressed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
34
scenes/stockticker/BuyButtonPressed.png.import
Normal file
34
scenes/stockticker/BuyButtonPressed.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dvidbk3clx6dn"
|
||||
path="res://.godot/imported/BuyButtonPressed.png-d376e992e63d9760db484195b2fac916.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/stockticker/BuyButtonPressed.png"
|
||||
dest_files=["res://.godot/imported/BuyButtonPressed.png-d376e992e63d9760db484195b2fac916.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
scenes/stockticker/SellButton.png
Normal file
BIN
scenes/stockticker/SellButton.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
34
scenes/stockticker/SellButton.png.import
Normal file
34
scenes/stockticker/SellButton.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dw8wpd47me7wu"
|
||||
path="res://.godot/imported/SellButton.png-2e342f0eff8cadc862043eaf743fb942.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/stockticker/SellButton.png"
|
||||
dest_files=["res://.godot/imported/SellButton.png-2e342f0eff8cadc862043eaf743fb942.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
scenes/stockticker/SellButtonPressed.png
Normal file
BIN
scenes/stockticker/SellButtonPressed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
34
scenes/stockticker/SellButtonPressed.png.import
Normal file
34
scenes/stockticker/SellButtonPressed.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://b773rtpy6rtx5"
|
||||
path="res://.godot/imported/SellButtonPressed.png-e8a6d05fa42b79b6b606b25427b1ccae.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/stockticker/SellButtonPressed.png"
|
||||
dest_files=["res://.godot/imported/SellButtonPressed.png-e8a6d05fa42b79b6b606b25427b1ccae.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
|
122
scenes/stockticker/Stock Ticker.tscn
Normal file
122
scenes/stockticker/Stock Ticker.tscn
Normal file
|
@ -0,0 +1,122 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://g2veoq55y14i"]
|
||||
|
||||
[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://scenes/stockticker/buy_n_sell.gd" id="4_l8sru"]
|
||||
[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"]
|
||||
|
||||
[node name="Node2D" type="Node2D"]
|
||||
|
||||
[node name="Background" type="Sprite2D" parent="."]
|
||||
modulate = Color(0.796078, 0.796078, 0.796078, 1)
|
||||
position = Vector2(576.25, 323.75)
|
||||
scale = Vector2(1153.5, 648.5)
|
||||
texture = ExtResource("1_wbfee")
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
autostart = true
|
||||
|
||||
[node name="Stonks" type="Node2D" parent="."]
|
||||
script = ExtResource("2_pan4m")
|
||||
|
||||
[node name="Sprite2D" 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
|
||||
default_color = Color(0.458824, 0.458824, 0.458824, 1)
|
||||
|
||||
[node name="MidLine" type="Line2D" parent="Stonks"]
|
||||
position = Vector2(0, 1)
|
||||
points = PackedVector2Array(50, 208, 1000, 208)
|
||||
width = 1.0
|
||||
default_color = Color(0.458824, 0.458824, 0.458824, 1)
|
||||
|
||||
[node name="BottomLine" type="Line2D" parent="Stonks"]
|
||||
position = Vector2(0, -1)
|
||||
points = PackedVector2Array(50, 356, 1000, 356)
|
||||
width = 1.0
|
||||
default_color = Color(0.46, 0.46, 0.46, 1)
|
||||
|
||||
[node name="Top" type="Label" parent="Stonks"]
|
||||
offset_left = 1021.0
|
||||
offset_top = 58.0
|
||||
offset_right = 1114.0
|
||||
offset_bottom = 89.0
|
||||
theme = ExtResource("3_dv3dr")
|
||||
theme_override_colors/font_color = Color(0.63, 0.63, 0.63, 1)
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "0"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Middle" type="Label" parent="Stonks"]
|
||||
offset_left = 1022.0
|
||||
offset_top = 208.0
|
||||
offset_right = 1115.0
|
||||
offset_bottom = 239.0
|
||||
theme = ExtResource("3_dv3dr")
|
||||
theme_override_colors/font_color = Color(0.63, 0.63, 0.63, 1)
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "0"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Bottom" type="Label" parent="Stonks"]
|
||||
offset_left = 1022.0
|
||||
offset_top = 356.0
|
||||
offset_right = 1115.0
|
||||
offset_bottom = 387.0
|
||||
theme = ExtResource("3_dv3dr")
|
||||
theme_override_colors/font_color = Color(0.63, 0.63, 0.63, 1)
|
||||
theme_override_font_sizes/font_size = 12
|
||||
text = "0"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Stonks" type="Line2D" parent="Stonks"]
|
||||
|
||||
[node name="Price Label" type="Label" parent="Stonks"]
|
||||
offset_left = 387.0
|
||||
offset_top = 387.0
|
||||
offset_right = 1112.0
|
||||
offset_bottom = 452.0
|
||||
theme = ExtResource("3_dv3dr")
|
||||
text = "Price:
|
||||
$"
|
||||
|
||||
[node name="BuyNSell" type="Node2D" parent="."]
|
||||
script = ExtResource("4_l8sru")
|
||||
|
||||
[node name="BuyButton" type="TextureButton" parent="BuyNSell"]
|
||||
offset_left = 54.0
|
||||
offset_top = 475.0
|
||||
offset_right = 409.0
|
||||
offset_bottom = 604.0
|
||||
texture_normal = ExtResource("5_mpf30")
|
||||
texture_pressed = ExtResource("6_styy2")
|
||||
|
||||
[node name="SellButton" type="TextureButton" parent="BuyNSell"]
|
||||
offset_left = 441.0
|
||||
offset_top = 477.0
|
||||
offset_right = 796.0
|
||||
offset_bottom = 606.0
|
||||
texture_normal = ExtResource("7_h6hir")
|
||||
texture_pressed = ExtResource("8_essj7")
|
||||
|
||||
[node name="Shares Held Label" type="Label" parent="BuyNSell"]
|
||||
offset_left = 6.0
|
||||
offset_top = 390.0
|
||||
offset_right = 336.0
|
||||
offset_bottom = 455.0
|
||||
theme = ExtResource("3_dv3dr")
|
||||
text = "Shares
|
||||
Held:"
|
||||
|
||||
[connection signal="timeout" from="Timer" to="Stonks" method="_on_timer_timeout"]
|
||||
[connection signal="button_up" from="BuyNSell/BuyButton" to="BuyNSell" method="_on_buy_button_button_up"]
|
||||
[connection signal="button_up" from="BuyNSell/SellButton" to="BuyNSell" method="_on_sell_button_button_up"]
|
BIN
scenes/stockticker/UI-Background-Colour.png
Normal file
BIN
scenes/stockticker/UI-Background-Colour.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 546 B |
34
scenes/stockticker/UI-Background-Colour.png.import
Normal file
34
scenes/stockticker/UI-Background-Colour.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://voruypgyi77e"
|
||||
path="res://.godot/imported/UI-Background-Colour.png-923b8102e8ca62798feecb1dd2a3a275.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://scenes/stockticker/UI-Background-Colour.png"
|
||||
dest_files=["res://.godot/imported/UI-Background-Colour.png-923b8102e8ca62798feecb1dd2a3a275.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
|
25
scenes/stockticker/buy_n_sell.gd
Normal file
25
scenes/stockticker/buy_n_sell.gd
Normal file
|
@ -0,0 +1,25 @@
|
|||
extends Node2D
|
||||
|
||||
var stonks = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var label = $"Shares Held Label"
|
||||
label.text = "Shares\nHeld:%d" % stonks
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_buy_button_button_up() -> void:
|
||||
if stonks < 100:
|
||||
stonks += 1
|
||||
var label = $"Shares Held Label"
|
||||
label.text = "Shares\nHeld:%d" % stonks
|
||||
|
||||
func _on_sell_button_button_up() -> void:
|
||||
if stonks > 0:
|
||||
stonks -= 1
|
||||
var label = $"Shares Held Label"
|
||||
label.text = "Shares\nHeld:%d" % stonks
|
52
scenes/stockticker/stonks.gd
Normal file
52
scenes/stockticker/stonks.gd
Normal file
|
@ -0,0 +1,52 @@
|
|||
extends Node2D
|
||||
|
||||
var price_history = []
|
||||
var max_prices = 15
|
||||
var max_up_multiplier = 2
|
||||
var max_down_multiplier = 2
|
||||
var bailout_counter = 0
|
||||
var bailout_time = 1
|
||||
|
||||
var bailout_price = 5
|
||||
var start_val = 5
|
||||
var prev_price = start_val
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
print(start_val)
|
||||
var label = $"Price Label"
|
||||
label.text = "Price:\n$%f" % start_val
|
||||
price_history.push_front(start_val)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
var new_price = prev_price
|
||||
|
||||
if prev_price <= 0:
|
||||
if bailout_counter < bailout_time:
|
||||
new_price = 0
|
||||
bailout_counter += 1
|
||||
else:
|
||||
new_price = bailout_price
|
||||
bailout_counter = 0
|
||||
elif randf() < 0.5:
|
||||
new_price += 1 * max_up_multiplier * randf()
|
||||
else:
|
||||
new_price -= 1 * max_down_multiplier * randf()
|
||||
|
||||
if new_price < 0: new_price = 0
|
||||
|
||||
if len(price_history) >= max_prices:
|
||||
price_history.pop_front()
|
||||
price_history.push_back(new_price)
|
||||
prev_price = new_price
|
||||
|
||||
var label = $"Price Label"
|
||||
label.text = "Price:\n$%f" % new_price
|
||||
|
||||
print(new_price)
|
Loading…
Add table
Reference in a new issue