Compare commits

..

5 commits

13 changed files with 190 additions and 32 deletions

View file

@ -4,6 +4,9 @@ class_name GameManager extends Node2D
@export var desk: Desk @export var desk: Desk
@export var turn_manager: TurnManager @export var turn_manager: TurnManager
signal lost
signal won
var paintings_sold = 0 var paintings_sold = 0
@export var paintings_total = 7 @export var paintings_total = 7
@ -31,36 +34,36 @@ signal new_painting_displayed
func _ready() -> void: func _ready() -> void:
audience_manager.ask_accepted.connect(_handle_ask_accepted) audience_manager.ask_accepted.connect(_handle_ask_accepted)
desk.gavel.gavel_hit.connect(_handle_gavel_hit) desk.gavel.gavel_hit.connect(_handle_gavel_hit)
#paintings_total = randi_range(7,10) #paintings_total = randi_range(7,10)
target_sales = randi_range(2,5) * sales_magnitude target_sales = randi_range(2,5) * sales_magnitude
var new_painting = 0 var new_painting = 0
var new_painting_value: int var new_painting_value: int
while new_painting < paintings_total: while new_painting < paintings_total:
new_painting_value = (target_sales/randf_range(paintings_total - 2, paintings_total + 2)) new_painting_value = (target_sales/randf_range(paintings_total - 2, paintings_total + 2))
new_painting_value = snappedi(new_painting_value, single_painting_magnitude) new_painting_value = snappedi(new_painting_value, single_painting_magnitude)
print(str(new_painting_value)) print(str(new_painting_value))
paintings.append(new_painting_value) paintings.append(new_painting_value)
new_painting += 1 new_painting += 1
print(paintings) print(paintings)
print("You have " + str(paintings_total) + " paintings. Sell them for at least $" + str(target_sales) + " or face the consequences!") print("You have " + str(paintings_total) + " paintings. Sell them for at least $" + str(target_sales) + " or face the consequences!")
print("Hit the gavel and input the starting price to begin!") print("Hit the gavel and input the starting price to begin!")
DisplayServer.tts_speak("You have " + str(paintings_total) + " paintings. Sell them fast for at least $" + str(target_sales) + " or face the consequences!", turn_manager.voice_id, turn_manager.tts_volume, turn_manager.tts_pitch) DisplayServer.tts_speak("You have " + str(paintings_total) + " paintings. Sell them fast for at least $" + str(target_sales) + " or face the consequences!", turn_manager.voice_id, turn_manager.tts_volume, turn_manager.tts_pitch)
DisplayServer.tts_speak("Hit the gavel and input the starting price to begin!", turn_manager.voice_id, turn_manager.tts_volume, turn_manager.tts_pitch) DisplayServer.tts_speak("Hit the gavel and input the starting price to begin!", turn_manager.voice_id, turn_manager.tts_volume, turn_manager.tts_pitch)
next_painting(0) next_painting(0)
#build out the initialization process, which should: #build out the initialization process, which should:
# -- generate paintings and assign values # -- generate paintings and assign values
# -- start the turn timer/auction timer # -- start the turn timer/auction timer
# ---- also add an auction timer # ---- also add an auction timer
# -- have tts announcement of starting bid and start of auction # -- have tts announcement of starting bid and start of auction
func _handle_gavel_hit(): func _handle_gavel_hit():
if state == bidding_state.CLOSED: if state == bidding_state.CLOSED:
@ -81,7 +84,7 @@ func _handle_gavel_hit():
(print(str(state))) (print(str(state)))
else: else:
end_auction() end_auction()
else: else:
pass pass
@ -101,7 +104,7 @@ func next_painting(a: int):
$NextPainting.play() $NextPainting.play()
starting_price = paintings[a] starting_price = paintings[a]
current_bid = 0 current_bid = 0
# will need to add animation/image swap # will need to add animation/image swap
new_painting_displayed.emit() new_painting_displayed.emit()

View file

@ -47,6 +47,7 @@ texture = ExtResource("3_272bh")
position = Vector2(1075, 130) position = Vector2(1075, 130)
[node name="GameManager" type="Node2D" parent="." node_paths=PackedStringArray("audience_manager", "desk", "turn_manager", "current_bid_display")] [node name="GameManager" type="Node2D" parent="." node_paths=PackedStringArray("audience_manager", "desk", "turn_manager", "current_bid_display")]
unique_name_in_owner = true
script = ExtResource("1_ig7tw") script = ExtResource("1_ig7tw")
audience_manager = NodePath("../AudienceManager") audience_manager = NodePath("../AudienceManager")
desk = NodePath("../Desk") desk = NodePath("../Desk")
@ -137,7 +138,8 @@ texture_hover = ExtResource("16_d13ii")
[node name="CursorManager" parent="." instance=ExtResource("20_82xsv")] [node name="CursorManager" parent="." instance=ExtResource("20_82xsv")]
[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] [node name="BackgroundMusic" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("22_ryguw") stream = ExtResource("22_ryguw")
volume_db = -14.0 volume_db = -14.0
autoplay = true autoplay = true

43
main_menu.gd Normal file
View file

@ -0,0 +1,43 @@
extends Node
@onready var menu_text = $Title
@onready var control_ui = $Vignette
@onready var root = self
signal main_menu_interacted
var input_received = false
func _input(event):
if input_received:
return
if event is InputEventKey or event is InputEventMouseButton:
input_received = true
control_ui.visible = false
replace_with_falling_body(menu_text)
emit_signal("main_menu_interacted")
func replace_with_falling_body(node: Node2D):
var global_pos = node.global_position
var body := RigidBody2D.new()
body.gravity_scale = 1
body.position = global_pos
body.global_position = global_pos
var shape := CollisionShape2D.new()
var rect_shape := RectangleShape2D.new()
rect_shape.extents = Vector2(20, 20)
shape.shape = rect_shape
body.add_child(shape)
var parent = node.get_parent()
parent.remove_child(node)
body.add_child(node)
node.position = Vector2.ZERO
root.add_child(body)
var x_force = randf_range(-300.0, 300.0)
var y_force = randf_range(400.0, -100.0)
body.apply_impulse(Vector2(x_force, y_force))

1
main_menu.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://bhpge7t5uk4gv

View file

@ -1,16 +1,19 @@
[gd_scene load_steps=4 format=3 uid="uid://q1x5v4q6uxsj"] [gd_scene load_steps=6 format=3 uid="uid://q1x5v4q6uxsj"]
[ext_resource type="Texture2D" uid="uid://dsfng5b065eyp" path="res://assets/background/full_bg_example.png" id="1_06t4h"] [ext_resource type="Texture2D" uid="uid://dsfng5b065eyp" path="res://assets/background/full_bg_example.png" id="1_06t4h"]
[ext_resource type="Script" uid="uid://bhpge7t5uk4gv" path="res://main_menu.gd" id="1_glbon"]
[ext_resource type="Theme" uid="uid://d2rlcffg7nguy" path="res://menus.tres" id="2_jix8l"] [ext_resource type="Theme" uid="uid://d2rlcffg7nguy" path="res://menus.tres" id="2_jix8l"]
[ext_resource type="Texture2D" uid="uid://cyheahpjvgaec" path="res://assets/menus/main/main.png" id="3_glbon"] [ext_resource type="Texture2D" uid="uid://cyheahpjvgaec" path="res://assets/menus/main/main.png" id="3_glbon"]
[ext_resource type="AudioStream" uid="uid://dx1yvtemmpktm" path="res://mainmenu.ogg" id="4_jix8l"]
[node name="Main Menu" type="Control"] [node name="MainMenu" type="Control"]
layout_mode = 3 layout_mode = 3
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
grow_horizontal = 2 grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
script = ExtResource("1_glbon")
[node name="Background" type="Sprite2D" parent="."] [node name="Background" type="Sprite2D" parent="."]
position = Vector2(640, 360) position = Vector2(640, 360)
@ -41,17 +44,12 @@ grow_vertical = 2
theme = ExtResource("2_jix8l") theme = ExtResource("2_jix8l")
text = "Press any key to start" text = "Press any key to start"
[node name="Title" type="TextureRect" parent="."] [node name="Title" type="Sprite2D" parent="."]
layout_mode = 1 position = Vector2(635, 400)
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -450.0
offset_top = -145.0
offset_right = 450.0
offset_bottom = 145.0
grow_horizontal = 2
grow_vertical = 2
texture = ExtResource("3_glbon") texture = ExtResource("3_glbon")
[node name="MenuMusic" type="AudioStreamPlayer" parent="."]
unique_name_in_owner = true
stream = ExtResource("4_jix8l")
volume_db = -14.0
autoplay = true

BIN
mainmenu.ogg Normal file

Binary file not shown.

19
mainmenu.ogg.import Normal file
View file

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://dx1yvtemmpktm"
path="res://.godot/imported/mainmenu.ogg-aa713911500d6936271f6784f44af7da.oggvorbisstr"
[deps]
source_file="res://mainmenu.ogg"
dest_files=["res://.godot/imported/mainmenu.ogg-aa713911500d6936271f6784f44af7da.oggvorbisstr"]
[params]
loop=true
loop_offset=0.0
bpm=0.0
beat_count=0
bar_beats=4

View file

@ -11,7 +11,7 @@ config_version=5
[application] [application]
config/name="ld58" config/name="ld58"
run/main_scene="uid://dt4nq0nkmjiit" run/main_scene="uid://bnb1i0y0fls7b"
config/features=PackedStringArray("4.5", "Forward Plus") config/features=PackedStringArray("4.5", "Forward Plus")
config/icon="res://icon.svg" config/icon="res://icon.svg"

View file

@ -1,16 +1,28 @@
extends Node2D extends Node2D
signal restart_game
var input_received = false
func _ready() -> void: func _ready() -> void:
win() win()
func win(): func win():
$MorshoReactManager/MorshoHappy.visible = true $MorshoReactManager/MorshoHappy.visible = true
$MorshoReactManager/MorshoAngry.visible = false $MorshoReactManager/MorshoAngry.visible = false
%WinLossAudioPlayer.stream = load("res://win.ogg") %WinLossAudioPlayer.stream = load("res://win.ogg")
%WinLossAudioPlayer.play() %WinLossAudioPlayer.play()
func lose(): func lose():
$MorshoReactManager/MorshoAngry.visible = true $MorshoReactManager/MorshoAngry.visible = true
$MorshoReactManager/MorshoHappy.visible = false $MorshoReactManager/MorshoHappy.visible = false
%WinLossAudioPlayer.stream = load("res://loss.ogg") %WinLossAudioPlayer.stream = load("res://loss.ogg")
%WinLossAudioPlayer.play() %WinLossAudioPlayer.play()
func _input(event):
if input_received:
return
if event is InputEventKey or event is InputEventMouseButton:
input_received = true
emit_signal("restart_game")

View file

@ -4,9 +4,9 @@
[ext_resource type="Script" uid="uid://cp71ivjeuuaaf" path="res://score_screen.gd" id="1_cyy7t"] [ext_resource type="Script" uid="uid://cp71ivjeuuaaf" path="res://score_screen.gd" id="1_cyy7t"]
[ext_resource type="Texture2D" uid="uid://cabsfveh1oc6i" path="res://assets/menus/final score/morshu-happy-large.png" id="1_juxjb"] [ext_resource type="Texture2D" uid="uid://cabsfveh1oc6i" path="res://assets/menus/final score/morshu-happy-large.png" id="1_juxjb"]
[ext_resource type="Texture2D" uid="uid://d24dlalqmr6r0" path="res://assets/menus/final score/morshu-anger-large.png" id="2_3r2db"] [ext_resource type="Texture2D" uid="uid://d24dlalqmr6r0" path="res://assets/menus/final score/morshu-anger-large.png" id="2_3r2db"]
[ext_resource type="Script" uid="uid://bmn6cds78753q" path="res://hotline_miami.gd" id="4_joumd"] [ext_resource type="Script" path="res://hotline_miami.gd" id="4_joumd"]
[node name="Node2D" type="Node2D"] [node name="ScoreScreen" type="Node2D"]
script = ExtResource("1_cyy7t") script = ExtResource("1_cyy7t")
[node name="Control" type="Control" parent="."] [node name="Control" type="Control" parent="."]

63
world.gd Normal file
View file

@ -0,0 +1,63 @@
extends Control
enum GameState { MAIN_MENU, GAME, LOSS, WIN }
var current_game_state: GameState = GameState.MAIN_MENU
var main_menu_scene = preload("res://main_menu.tscn")
var game_scene = preload("res://main.tscn")
var score_screen_scene = preload("res://score_screen.tscn")
func _ready():
$MainMenu.main_menu_interacted.connect(_on_main_menu_interacted)
func transition(new_state: GameState):
# Clean up current scene
if new_state == GameState.MAIN_MENU:
var main_menu_instance = main_menu_scene.instantiate()
add_child(main_menu_instance)
elif new_state == GameState.GAME:
var game_instance = game_scene.instantiate()
add_child(game_instance)
var manager = game_instance.get_node("%GameManager")
manager.lost.connect(_on_loss)
manager.won.connect(_on_win)
elif new_state == GameState.LOSS:
var score_screen_instance = score_screen_scene.instantiate()
add_child(score_screen_instance)
score_screen_instance.lose()
score_screen_instance.restart_game.connect(_on_restart)
elif new_state == GameState.WIN:
var score_screen_instance = score_screen_scene.instantiate()
add_child(score_screen_instance)
score_screen_instance.win()
score_screen_instance.restart_game.connect(_on_restart)
# Clean up old scene
match (current_game_state):
GameState.MAIN_MENU:
var main_menu_instance = $MainMenu
main_menu_instance.queue_free()
GameState.GAME:
var main_instance = $Main
main_instance.queue_free()
GameState.LOSS:
var score_screen_instance = $ScoreScreen
score_screen_instance.queue_free()
GameState.WIN:
var score_screen_instance = $ScoreScreen
score_screen_instance.queue_free()
current_game_state = new_state
func _on_main_menu_interacted():
transition(GameState.GAME)
func _on_loss():
transition(GameState.LOSS)
func _on_win():
transition(GameState.WIN)
func _on_restart():
transition(GameState.GAME)

1
world.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://btq5lp33qphwg

16
world.tscn Normal file
View file

@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=3 uid="uid://bnb1i0y0fls7b"]
[ext_resource type="PackedScene" uid="uid://q1x5v4q6uxsj" path="res://main_menu.tscn" id="1_f3sb7"]
[ext_resource type="Script" uid="uid://btq5lp33qphwg" path="res://world.gd" id="1_fj7yv"]
[node name="World" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_fj7yv")
[node name="MainMenu" parent="." instance=ExtResource("1_f3sb7")]
layout_mode = 1