It's Cow Game! Version 2.04!
This commit is contained in:
commit
a9e1ed9ddd
3148 changed files with 95332 additions and 0 deletions
30
UI/Sugaring/ItemFadeTransition.gd
Normal file
30
UI/Sugaring/ItemFadeTransition.gd
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
extends Node2D
|
||||
|
||||
var transing = false
|
||||
var finalMoments:float = 0
|
||||
var finalMomentsDuration:float = 0.8
|
||||
var transDuration:float = 2
|
||||
|
||||
func start_transition(startImage, finalImage):
|
||||
transing = true
|
||||
%Initial.texture = startImage
|
||||
%Final.texture = finalImage
|
||||
|
||||
func _process(delta):
|
||||
if finalMoments > 0:
|
||||
finalMoments -= delta
|
||||
|
||||
if %Initial.self_modulate.a > 0:
|
||||
%Initial.self_modulate.a -= 2 * delta
|
||||
if %Initial.self_modulate.a < 0:
|
||||
%Initial.self_modulate.a = 0
|
||||
|
||||
if finalMoments <= 0:
|
||||
queue_free()
|
||||
|
||||
if transing:
|
||||
%Final.self_modulate.a += (delta * (float(1)/transDuration))
|
||||
|
||||
if %Final.self_modulate.a >= 1:
|
||||
transing = false
|
||||
finalMoments = finalMomentsDuration
|
||||
13
UI/Sugaring/ItemFadeTransition.tscn
Normal file
13
UI/Sugaring/ItemFadeTransition.tscn
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://bfvcwawqgtpxr"]
|
||||
|
||||
[ext_resource type="Script" path="res://UI/Sugaring/ItemFadeTransition.gd" id="1_q5ohr"]
|
||||
|
||||
[node name="ItemFadeTransition" type="Node2D"]
|
||||
script = ExtResource("1_q5ohr")
|
||||
|
||||
[node name="Initial" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
|
||||
[node name="Final" type="Sprite2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
self_modulate = Color(1, 1, 1, 0)
|
||||
BIN
UI/Sugaring/SugarMound.png
Normal file
BIN
UI/Sugaring/SugarMound.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 483 B |
34
UI/Sugaring/SugarMound.png.import
Normal file
34
UI/Sugaring/SugarMound.png.import
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bc4emgqs4t71u"
|
||||
path="res://.godot/imported/SugarMound.png-d7996a79d2a6210ba01cdd19cedb578e.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://UI/Sugaring/SugarMound.png"
|
||||
dest_files=["res://.godot/imported/SugarMound.png-d7996a79d2a6210ba01cdd19cedb578e.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
|
||||
92
UI/Sugaring/SugaringMenu.gd
Normal file
92
UI/Sugaring/SugaringMenu.gd
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
extends Window
|
||||
|
||||
@onready var inventoryItemDisplayer = %Inventory
|
||||
|
||||
var itemTransitionScene = preload("res://UI/Sugaring/ItemFadeTransition.tscn")
|
||||
|
||||
var playerInventory:Inventory
|
||||
|
||||
var sugarItem = preload("res://Items/Foods/Snack/Sugar.gd")
|
||||
var sugarCount = 0
|
||||
|
||||
var rng = RandomNumberGenerator.new()
|
||||
|
||||
func _ready():
|
||||
inventoryItemDisplayer.buttonPressed.connect(sugar_item)
|
||||
inventoryItemDisplayer.set_title("Normal Items")
|
||||
|
||||
func opened():
|
||||
get_tree().paused = true
|
||||
playerInventory = InventoryManager.get_inventory()
|
||||
inventoryItemDisplayer.inventory = filter_inventory(playerInventory)
|
||||
inventoryItemDisplayer.update_display()
|
||||
|
||||
update_sugar_count()
|
||||
|
||||
func update_sugar_count():
|
||||
var sugarHeld = InventoryManager.get_item_count_by_name("Sugar", "normal", true)
|
||||
|
||||
if sugarHeld > 0:
|
||||
%SugarCount.text = "Sugar Left: " + str(sugarHeld)
|
||||
%SugarParticles.emitting = true
|
||||
else:
|
||||
%SugarCount.text = "OUT OF SUGAR"
|
||||
%SugarParticles.emitting = false
|
||||
|
||||
sugarCount = sugarHeld
|
||||
|
||||
func spend_sugar():
|
||||
InventoryManager.spend_item(sugarItem.new())
|
||||
|
||||
func sugar_item(item):
|
||||
if sugarCount <= 0:
|
||||
return
|
||||
|
||||
spend_sugar()
|
||||
update_sugar_count()
|
||||
|
||||
InventoryManager.remove_item_from_inventory(item)
|
||||
|
||||
var sugarItem = item.duplicate()
|
||||
|
||||
var addSugar = true
|
||||
if item.get_name(false) == "Tomato Juice":
|
||||
sugarItem = load("res://Items/Foods/Condiments/Ketchup.gd").new()
|
||||
addSugar = false
|
||||
if Item.types.Juice in sugarItem.itemTypes and Item.modifications.Concentrated in sugarItem.itemModifications:
|
||||
sugarItem = CandyGenerator.generate_candy(sugarItem)
|
||||
addSugar = false
|
||||
|
||||
if addSugar:
|
||||
sugarItem.set_modification(Item.modifications.Sugared)
|
||||
|
||||
InventoryManager.add_item_to_inventory(sugarItem)
|
||||
|
||||
spawn_item_transition(item, sugarItem)
|
||||
|
||||
inventoryItemDisplayer.inventory = filter_inventory(playerInventory)
|
||||
inventoryItemDisplayer.update_display()
|
||||
|
||||
func spawn_item_transition(startItem, sugaredItem):
|
||||
var itemTransition = itemTransitionScene.instantiate()
|
||||
itemTransition.start_transition(startItem.get_sprite(), sugaredItem.get_sprite())
|
||||
|
||||
add_child(itemTransition)
|
||||
itemTransition.scale = Vector2(2, 2)
|
||||
itemTransition.position = Vector2(450 + rng.randf_range(-70, 70), 365 + rng.randf_range(-20, 20))
|
||||
|
||||
func filter_inventory(inventory):
|
||||
var filteredInv:Inventory = inventory.duplicate()
|
||||
|
||||
var i = filteredInv.items.size() - 1
|
||||
while i >= 0:
|
||||
var currentItem = filteredInv.items[i]
|
||||
if currentItem.itemModifications.size() > 0 and not Item.modifications.Concentrated in currentItem.itemModifications:
|
||||
filteredInv.remove_item(currentItem, filteredInv.quantities[i])
|
||||
i -= 1
|
||||
|
||||
return filteredInv
|
||||
|
||||
func _on_leave_button_pressed():
|
||||
get_tree().paused = false
|
||||
hide()
|
||||
102
UI/Sugaring/SugaringMenu.tscn
Normal file
102
UI/Sugaring/SugaringMenu.tscn
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://cpkhjdfo8muux"]
|
||||
|
||||
[ext_resource type="Script" path="res://UI/Sugaring/SugaringMenu.gd" id="1_lfsbr"]
|
||||
[ext_resource type="Theme" uid="uid://dkofjwlcf80gp" path="res://UI/Themes/InteractionPopupTheme.tres" id="1_qprgy"]
|
||||
[ext_resource type="PackedScene" uid="uid://c3ku75p4ep3c7" path="res://UI/Inventory/InventoryDisplayer.tscn" id="2_mbl82"]
|
||||
[ext_resource type="Texture2D" uid="uid://bc4emgqs4t71u" path="res://UI/Sugaring/SugarMound.png" id="4_vfmd6"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xnej8"]
|
||||
bg_color = Color(0.901961, 0.67451, 0.843137, 1)
|
||||
border_width_left = 4
|
||||
border_width_top = 4
|
||||
border_width_right = 19
|
||||
border_width_bottom = 4
|
||||
border_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="SugaringMenu" type="Window"]
|
||||
process_mode = 3
|
||||
size = Vector2i(600, 500)
|
||||
unresizable = true
|
||||
borderless = true
|
||||
theme = ExtResource("1_qprgy")
|
||||
script = ExtResource("1_lfsbr")
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="."]
|
||||
offset_right = 590.0
|
||||
offset_bottom = 8.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_xnej8")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer"]
|
||||
custom_minimum_size = Vector2(590, 490)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_constants/separation = 11
|
||||
|
||||
[node name="SugarerName" type="Label" parent="PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme_override_colors/font_color = Color(0.4, 0.952941, 1, 1)
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 9
|
||||
theme_override_font_sizes/font_size = 32
|
||||
text = "Sugar Time!"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/margin_left = 8
|
||||
theme_override_constants/margin_right = 8
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="PanelContainer/VBoxContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="Inventory" parent="PanelContainer/VBoxContainer/MarginContainer/HBoxContainer" instance=ExtResource("2_mbl82")]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="PanelContainer/VBoxContainer/MarginContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="SugarCount" type="Label" parent="PanelContainer/VBoxContainer/MarginContainer/HBoxContainer/PanelContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme_override_font_sizes/font_size = 26
|
||||
text = "Sugar Left: 34"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 2
|
||||
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="PanelContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="LeaveButton" type="Button" parent="PanelContainer/VBoxContainer/MarginContainer2"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
text = "Leave"
|
||||
|
||||
[node name="SugarMound" type="Sprite2D" parent="."]
|
||||
position = Vector2(444, 412)
|
||||
scale = Vector2(0.95, 1.072)
|
||||
texture = ExtResource("4_vfmd6")
|
||||
|
||||
[node name="SugarParticles" type="CPUParticles2D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
position = Vector2(445, 65)
|
||||
amount = 50
|
||||
lifetime = 1.05
|
||||
emission_shape = 3
|
||||
emission_rect_extents = Vector2(115, 1)
|
||||
direction = Vector2(0, 1)
|
||||
spread = 9.76
|
||||
gravity = Vector2(0, 400)
|
||||
initial_velocity_min = 100.0
|
||||
initial_velocity_max = 140.0
|
||||
scale_amount_max = 2.0
|
||||
|
||||
[connection signal="pressed" from="PanelContainer/VBoxContainer/MarginContainer2/LeaveButton" to="." method="_on_leave_button_pressed"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue