It's Cow Game! Version 2.04!
This commit is contained in:
commit
a9e1ed9ddd
3148 changed files with 95332 additions and 0 deletions
11
UI/MessageZone/CharacterMessage.gd
Normal file
11
UI/MessageZone/CharacterMessage.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
extends Label
|
||||
|
||||
var lifeSpan = 4
|
||||
var speed = -1
|
||||
|
||||
func _process(delta):
|
||||
global_position += Vector2(0, speed)*delta
|
||||
|
||||
lifeSpan -= delta
|
||||
if lifeSpan <= 0:
|
||||
queue_free()
|
||||
16
UI/MessageZone/CharacterMessage.tscn
Normal file
16
UI/MessageZone/CharacterMessage.tscn
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://da7fmmxpjb37r"]
|
||||
|
||||
[ext_resource type="Script" path="res://UI/MessageZone/CharacterMessage.gd" id="1_3sv62"]
|
||||
|
||||
[node name="CharacterMessage" type="Label"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/outline_size = 6
|
||||
theme_override_font_sizes/font_size = 23
|
||||
text = "Moo"
|
||||
script = ExtResource("1_3sv62")
|
||||
24
UI/MessageZone/DialogueBox.gd
Normal file
24
UI/MessageZone/DialogueBox.gd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
extends PanelContainer
|
||||
|
||||
var dialogueOptionScene = preload("res://UI/MessageZone/DialogueOption.tscn")
|
||||
|
||||
func set_character_name(characterName:String):
|
||||
%CharacterName.text = characterName
|
||||
|
||||
func set_message(message:String):
|
||||
%Message.text = message
|
||||
%MessageScrollContainer.scroll_vertical = 0
|
||||
|
||||
func set_character_sprite(sprite):
|
||||
%CharacterSprite.texture = sprite
|
||||
|
||||
func clear_dialogue_options():
|
||||
for child in %DialogueOptions.get_children():
|
||||
child.queue_free()
|
||||
|
||||
func add_dialogue_option(optionText):
|
||||
var newDialogueOption = dialogueOptionScene.instantiate()
|
||||
newDialogueOption.text = optionText
|
||||
%DialogueOptions.add_child(newDialogueOption)
|
||||
|
||||
return newDialogueOption
|
||||
86
UI/MessageZone/DialogueBox.tscn
Normal file
86
UI/MessageZone/DialogueBox.tscn
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://cdwgwfki485as"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bryqti0obuaqw" path="res://Player/cow.png" id="1_5xme6"]
|
||||
[ext_resource type="Script" path="res://UI/MessageZone/DialogueBox.gd" id="1_rsx5t"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_sxu2r"]
|
||||
bg_color = Color(0.596078, 0.721569, 0.929412, 1)
|
||||
|
||||
[node name="DialogueBox" type="PanelContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 450.0
|
||||
offset_right = -424.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_vertical = 8
|
||||
mouse_filter = 1
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_sxu2r")
|
||||
script = ExtResource("1_rsx5t")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 13
|
||||
theme_override_constants/margin_top = 4
|
||||
theme_override_constants/margin_right = 13
|
||||
theme_override_constants/margin_bottom = 4
|
||||
|
||||
[node name="HSplitContainer" type="HSplitContainer" parent="MarginContainer"]
|
||||
layout_mode = 2
|
||||
dragger_visibility = 2
|
||||
|
||||
[node name="CharacterSprite" type="TextureRect" parent="MarginContainer/HSplitContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
texture = ExtResource("1_5xme6")
|
||||
expand_mode = 1
|
||||
stretch_mode = 5
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="MarginContainer/HSplitContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 2.5
|
||||
theme_override_constants/margin_left = 6
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer/HSplitContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_stretch_ratio = 2.53
|
||||
|
||||
[node name="CharacterName" type="Label" parent="MarginContainer/HSplitContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 25
|
||||
text = "Cow"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="MessageScrollContainer" type="ScrollContainer" parent="MarginContainer/HSplitContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
size_flags_stretch_ratio = 1.91
|
||||
|
||||
[node name="Message" type="Label" parent="MarginContainer/HSplitContainer/MarginContainer/VBoxContainer/MessageScrollContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/line_spacing = 0
|
||||
text = "Hi"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
autowrap_mode = 3
|
||||
|
||||
[node name="DialogueOptions" type="HFlowContainer" parent="MarginContainer/HSplitContainer/MarginContainer/VBoxContainer"]
|
||||
unique_name_in_owner = true
|
||||
clip_contents = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 6
|
||||
theme_override_constants/h_separation = 18
|
||||
theme_override_constants/v_separation = 0
|
||||
alignment = 1
|
||||
80
UI/MessageZone/DialogueManager.gd
Normal file
80
UI/MessageZone/DialogueManager.gd
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
extends Node
|
||||
|
||||
var dialogueBox
|
||||
|
||||
var currentDialogueResource
|
||||
var currentDialogueLine
|
||||
var currentSpeaker
|
||||
|
||||
func _ready():
|
||||
initialize_variables()
|
||||
|
||||
func initialize_variables():
|
||||
dialogueBox = get_node("/root/MainGame/CanvasLayer/DialogueBox")
|
||||
|
||||
if GameVariables.player != null:
|
||||
GameVariables.player.moved.connect(end_dialogue)
|
||||
|
||||
func _process(delta):
|
||||
if dialogueBox != null and dialogueBox.visible and is_instance_valid(currentSpeaker) and currentSpeaker != null:
|
||||
update_speaker_sprite()
|
||||
|
||||
func set_current_speaker(speaker):
|
||||
currentSpeaker = speaker
|
||||
update_speaker_sprite()
|
||||
|
||||
func update_speaker_sprite():
|
||||
var spriteHolder = currentSpeaker.get_node("Sprite")
|
||||
if spriteHolder != null:
|
||||
var sprite = spriteHolder.sprite_frames.get_frame_texture(spriteHolder.animation, spriteHolder.frame)
|
||||
set_dialogue_sprite(sprite)
|
||||
|
||||
func start_dialogue(dialogueResource):
|
||||
dialogueBox.visible = true
|
||||
|
||||
currentDialogueResource = dialogueResource
|
||||
currentDialogueLine = await currentDialogueResource.get_next_dialogue_line("start")
|
||||
handle_dialogue_line(currentDialogueLine)
|
||||
|
||||
func option_chosen(nextLineID):
|
||||
currentDialogueLine = await currentDialogueResource.get_next_dialogue_line(nextLineID)
|
||||
handle_dialogue_line(currentDialogueLine)
|
||||
|
||||
func handle_dialogue_line(nextLine:DialogueLine):
|
||||
if nextLine == null or !("text" in nextLine):
|
||||
end_dialogue()
|
||||
return
|
||||
|
||||
set_dialogue_name(nextLine.character)
|
||||
set_dialogue_message(nextLine.text)
|
||||
|
||||
currentDialogueLine = nextLine
|
||||
|
||||
handle_dialogue_options(currentDialogueLine.responses)
|
||||
|
||||
func handle_dialogue_options(choices):
|
||||
dialogueBox.clear_dialogue_options()
|
||||
|
||||
if choices.size() == 0:
|
||||
var newOption = dialogueBox.add_dialogue_option("continue")
|
||||
newOption.pressed.connect(option_chosen.bind(currentDialogueLine.next_id))
|
||||
return
|
||||
|
||||
for choice in choices:
|
||||
var newOption = dialogueBox.add_dialogue_option(choice.text)
|
||||
newOption.pressed.connect(option_chosen.bind(choice.next_id))
|
||||
|
||||
func end_dialogue():
|
||||
dialogueBox.visible = false
|
||||
if DialogueBoxManager.currentSpeaker != null:
|
||||
DialogueBoxManager.currentSpeaker.dialogue_cancel()
|
||||
|
||||
func set_dialogue_sprite(sprite):
|
||||
dialogueBox.set_character_sprite(sprite)
|
||||
|
||||
func set_dialogue_name(dialogueName):
|
||||
dialogueBox.set_character_name(dialogueName)
|
||||
|
||||
func set_dialogue_message(message):
|
||||
dialogueBox.set_message(message)
|
||||
|
||||
6
UI/MessageZone/DialogueOption.tscn
Normal file
6
UI/MessageZone/DialogueOption.tscn
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
[gd_scene format=3 uid="uid://bnpoh7hxw6tlq"]
|
||||
|
||||
[node name="LinkButton" type="LinkButton"]
|
||||
theme_override_colors/font_color = Color(1, 0, 0.686275, 1)
|
||||
text = "Continue"
|
||||
underline = 2
|
||||
119
UI/MessageZone/MessageManager.gd
Normal file
119
UI/MessageZone/MessageManager.gd
Normal file
|
|
@ -0,0 +1,119 @@
|
|||
extends Node
|
||||
|
||||
signal messageSent(message)
|
||||
|
||||
var messageZone
|
||||
var canvasLayer
|
||||
var messageButton
|
||||
|
||||
var characterMessageScene = preload("res://UI/MessageZone/CharacterMessage.tscn")
|
||||
var itemPopupScene = preload("res://UI/EventPopups/item_pickup_popup.tscn")
|
||||
var levelupPopupScene = preload("res://UI/EventPopups/levelup_popup.tscn")
|
||||
|
||||
var currentItemPopup = null
|
||||
var itemPopups = []
|
||||
|
||||
var currentlevelPopup = null
|
||||
var levelPopups = []
|
||||
|
||||
func _ready():
|
||||
initialize_variables()
|
||||
|
||||
func item_popup_done():
|
||||
if itemPopups.size() > 0:
|
||||
var newItemPopup = itemPopups.pop_front()
|
||||
canvasLayer.add_child(newItemPopup)
|
||||
currentItemPopup = newItemPopup
|
||||
else:
|
||||
currentItemPopup = null
|
||||
|
||||
func initialize_variables():
|
||||
messageZone = get_node("/root/MainGame/CanvasLayer/MessageZone")
|
||||
canvasLayer = get_node("/root/MainGame/CanvasLayer")
|
||||
messageButton = get_node("/root/MainGame/CanvasLayer/MinimizeMessageZoneButton")
|
||||
|
||||
func item_popup(item):
|
||||
var itemPopup = itemPopupScene.instantiate()
|
||||
itemPopup.set_item(item)
|
||||
|
||||
if currentItemPopup != null:
|
||||
itemPopups.append(itemPopup)
|
||||
else:
|
||||
canvasLayer.add_child(itemPopup)
|
||||
currentItemPopup = itemPopup
|
||||
|
||||
func secret_skill_popup(skill):
|
||||
var levelupPopup = levelupPopupScene.instantiate()
|
||||
levelupPopup.secret_skill(skill)
|
||||
|
||||
if currentlevelPopup != null:
|
||||
levelPopups.append(levelupPopup)
|
||||
else:
|
||||
canvasLayer.add_child(levelupPopup)
|
||||
currentlevelPopup = levelupPopup
|
||||
get_tree().get_root().get_node("MainGame/PuzzleCompleteAudio").play()
|
||||
|
||||
func levelup_popup(skill):
|
||||
var levelupPopup = levelupPopupScene.instantiate()
|
||||
levelupPopup.set_skill(skill)
|
||||
|
||||
if currentlevelPopup != null:
|
||||
levelPopups.append(levelupPopup)
|
||||
else:
|
||||
canvasLayer.add_child(levelupPopup)
|
||||
currentlevelPopup = levelupPopup
|
||||
get_tree().get_root().get_node("MainGame/AudioStreamPlayer").play()
|
||||
|
||||
func maxlevel_popup():
|
||||
var levelupPopup = levelupPopupScene.instantiate()
|
||||
levelupPopup.max_level()
|
||||
|
||||
if currentlevelPopup != null:
|
||||
levelPopups.append(levelupPopup)
|
||||
else:
|
||||
canvasLayer.add_child(levelupPopup)
|
||||
currentlevelPopup = levelupPopup
|
||||
get_tree().get_root().get_node("MainGame/MaxLevelAudio").play()
|
||||
|
||||
func levelup_popup_done():
|
||||
if levelPopups.size() > 0:
|
||||
var newLevelupPopup = levelPopups.pop_front()
|
||||
canvasLayer.add_child(newLevelupPopup)
|
||||
currentlevelPopup = newLevelupPopup
|
||||
if newLevelupPopup.maxLevelPopup:
|
||||
get_tree().get_root().get_node("MainGame/MaxLevelAudio").play()
|
||||
elif newLevelupPopup.secretSkillPopup:
|
||||
get_tree().get_root().get_node("MainGame/PuzzleCompleteAudio").play()
|
||||
else:
|
||||
get_tree().get_root().get_node("MainGame/AudioStreamPlayer").play()
|
||||
else:
|
||||
currentlevelPopup = null
|
||||
|
||||
func addMessage(message, speaker, speakerName = "System",
|
||||
color:Color = Color.BLACK, showInMessageZone:bool = true,
|
||||
showAboveCharacter:bool = true, messageDuration:int = 4, messageSpeed:int = -1):
|
||||
if showInMessageZone:
|
||||
var messageForZone = message
|
||||
if speakerName != "System":
|
||||
messageForZone = speakerName + ": " + messageForZone
|
||||
messageZone.add_message(messageForZone, color)
|
||||
|
||||
# Chat opens on message setting
|
||||
if SaveManager.get_save_value("ShowMessageOpt",true):
|
||||
messageZone.set_message_zone_visibility(true)
|
||||
messageButton.text = "-"
|
||||
canvasLayer.messageZoneMinimized = false
|
||||
|
||||
if showAboveCharacter:
|
||||
var newCharacterMessage = characterMessageScene.instantiate()
|
||||
newCharacterMessage.text = message
|
||||
newCharacterMessage.set("theme_override_colors/font_color", color)
|
||||
|
||||
newCharacterMessage.position = Vector2(0, -120)
|
||||
newCharacterMessage.lifeSpan = messageDuration
|
||||
newCharacterMessage.speed = messageSpeed
|
||||
speaker.add_child(newCharacterMessage)
|
||||
|
||||
messageSent.emit(message)
|
||||
|
||||
|
||||
36
UI/MessageZone/MessageZone.gd
Normal file
36
UI/MessageZone/MessageZone.gd
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
extends PanelContainer
|
||||
|
||||
var textlineScene = preload("res://UI/MessageZone/messageDisplay.tscn")
|
||||
|
||||
var maxMessages = 50
|
||||
|
||||
func set_message_zone_visibility(visible):
|
||||
%MessagePanel.visible = visible
|
||||
|
||||
func add_message(message, color:Color = Color.BLACK):
|
||||
var newLine = textlineScene.instantiate()
|
||||
newLine.set("theme_override_colors/font_color", color)
|
||||
|
||||
newLine.text = message
|
||||
%Messages.add_child(newLine)
|
||||
|
||||
if %Messages.get_children().size() > maxMessages:
|
||||
%Messages.remove_child(%Messages.get_child(0))
|
||||
|
||||
await get_tree().process_frame
|
||||
%MessagesContainer.ensure_control_visible(newLine)
|
||||
|
||||
func _on_chat_input_text_submitted(new_text):
|
||||
if new_text != "":
|
||||
MessageManager.addMessage(new_text, GameVariables.player,
|
||||
"Cow", Color.YELLOW)
|
||||
|
||||
var checkingText = new_text.to_lower()
|
||||
if checkingText == "i'm gay" or checkingText == "im gay":
|
||||
LevelManager.get_skill("appreciating").experience_event("im gay", "said", 175)
|
||||
if checkingText == "i'm trans" or checkingText == "im trans":
|
||||
LevelManager.get_skill("appreciating").experience_event("im trans", "said", 175)
|
||||
if checkingText.contains("moo"):
|
||||
AchievementManager.complete_achievement("Moo")
|
||||
|
||||
%ChatInput.text = ""
|
||||
63
UI/MessageZone/MessageZone.tscn
Normal file
63
UI/MessageZone/MessageZone.tscn
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://wrmllr7715x4"]
|
||||
|
||||
[ext_resource type="Script" path="res://UI/MessageZone/MessageZone.gd" id="1_mdii2"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_x6d11"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gik3d"]
|
||||
bg_color = Color(0.407843, 0.694118, 0.870588, 0.627451)
|
||||
|
||||
[node name="MessageZone" type="PanelContainer"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_top = 450.0
|
||||
offset_right = -424.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxEmpty_x6d11")
|
||||
script = ExtResource("1_mdii2")
|
||||
|
||||
[node name="VSplitContainer" type="VSplitContainer" parent="."]
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
dragger_visibility = 2
|
||||
|
||||
[node name="MessagePanel" type="PanelContainer" parent="VSplitContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
mouse_filter = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_gik3d")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VSplitContainer/MessagePanel"]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
mouse_filter = 2
|
||||
theme_override_constants/margin_left = 4
|
||||
|
||||
[node name="MessagesContainer" type="ScrollContainer" parent="VSplitContainer/MessagePanel/MarginContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
mouse_filter = 2
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="Messages" type="VBoxContainer" parent="VSplitContainer/MessagePanel/MarginContainer/MessagesContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
mouse_filter = 2
|
||||
theme_override_constants/separation = 0
|
||||
|
||||
[node name="ChatInput" type="LineEdit" parent="VSplitContainer"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 8
|
||||
theme_override_colors/font_color = Color(1, 1, 1, 1)
|
||||
placeholder_text = "Speak here"
|
||||
deselect_on_focus_loss_enabled = false
|
||||
caret_blink = true
|
||||
|
||||
[connection signal="text_submitted" from="VSplitContainer/ChatInput" to="." method="_on_chat_input_text_submitted"]
|
||||
12
UI/MessageZone/messageDisplay.tscn
Normal file
12
UI/MessageZone/messageDisplay.tscn
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[gd_scene format=3 uid="uid://1a3xh2dsatuw"]
|
||||
|
||||
[node name="MessageDisplay" type="Label"]
|
||||
offset_right = 306.0
|
||||
offset_bottom = 26.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_constants/line_spacing = 0
|
||||
text = "Samantha Jr: Hi Wolcome to arcade! It's a happy day isn't it?"
|
||||
vertical_alignment = 2
|
||||
autowrap_mode = 3
|
||||
Loading…
Add table
Add a link
Reference in a new issue