Merge branch 'main' of clone.gloom.garden:puregarlic/ld58-collector into main-menu
This commit is contained in:
commit
02a89aa068
12 changed files with 137 additions and 23 deletions
|
|
@ -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()
|
||||||
|
|
||||||
|
|
|
||||||
26
hotline_miami.gd
Normal file
26
hotline_miami.gd
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
@export var viewport_x_div: float
|
||||||
|
@export var viewport_y_div: float
|
||||||
|
@export var x_offset: float = 0.0
|
||||||
|
|
||||||
|
var sway_amplitude = 20
|
||||||
|
var sway_speed = 1.0
|
||||||
|
var tilt_amplitude = 0.1
|
||||||
|
var tilt_lerp_speed = 5.0
|
||||||
|
|
||||||
|
var time := 0.0
|
||||||
|
var base_position := Vector2.ZERO
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
var viewport_size = get_viewport_rect().size
|
||||||
|
base_position = Vector2(viewport_size.x / viewport_x_div + x_offset, viewport_size.y / viewport_y_div)
|
||||||
|
position = base_position
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
time += delta
|
||||||
|
var sway_offset = sin(time * sway_speed) * sway_amplitude
|
||||||
|
position.x = base_position.x + sway_offset
|
||||||
|
var sway_velocity = cos(time * sway_speed) * sway_speed
|
||||||
|
var target_rotation = clamp(sway_velocity * tilt_amplitude, -tilt_amplitude, tilt_amplitude)
|
||||||
|
rotation = lerp(rotation, target_rotation, delta * tilt_lerp_speed)
|
||||||
1
hotline_miami.gd.uid
Normal file
1
hotline_miami.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bmn6cds78753q
|
||||||
BIN
loss.ogg
Normal file
BIN
loss.ogg
Normal file
Binary file not shown.
19
loss.ogg.import
Normal file
19
loss.ogg.import
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="oggvorbisstr"
|
||||||
|
type="AudioStreamOggVorbis"
|
||||||
|
uid="uid://b5r5846lmi31v"
|
||||||
|
path="res://.godot/imported/loss.ogg-a53eed42c0a67db7c9fc2938cae26881.oggvorbisstr"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://loss.ogg"
|
||||||
|
dest_files=["res://.godot/imported/loss.ogg-a53eed42c0a67db7c9fc2938cae26881.oggvorbisstr"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
||||||
|
|
@ -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")
|
||||||
|
|
|
||||||
28
score_screen.gd
Normal file
28
score_screen.gd
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
signal restart_game
|
||||||
|
|
||||||
|
var input_received = false
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
win()
|
||||||
|
|
||||||
|
func win():
|
||||||
|
$MorshoReactManager/MorshoHappy.visible = true
|
||||||
|
$MorshoReactManager/MorshoAngry.visible = false
|
||||||
|
%WinLossAudioPlayer.stream = load("res://win.ogg")
|
||||||
|
%WinLossAudioPlayer.play()
|
||||||
|
|
||||||
|
func lose():
|
||||||
|
$MorshoReactManager/MorshoAngry.visible = true
|
||||||
|
$MorshoReactManager/MorshoHappy.visible = false
|
||||||
|
%WinLossAudioPlayer.stream = load("res://loss.ogg")
|
||||||
|
%WinLossAudioPlayer.play()
|
||||||
|
|
||||||
|
func _input(event):
|
||||||
|
if input_received:
|
||||||
|
return
|
||||||
|
|
||||||
|
if event is InputEventKey or event is InputEventMouseButton:
|
||||||
|
input_received = true
|
||||||
|
emit_signal("restart_game")
|
||||||
1
score_screen.gd.uid
Normal file
1
score_screen.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://cp71ivjeuuaaf
|
||||||
|
|
@ -1,10 +1,13 @@
|
||||||
[gd_scene load_steps=4 format=3 uid="uid://bcnpjrwddi5h8"]
|
[gd_scene load_steps=6 format=3 uid="uid://bcnpjrwddi5h8"]
|
||||||
|
|
||||||
[ext_resource type="Theme" uid="uid://d2rlcffg7nguy" path="res://menus.tres" id="1_3r2db"]
|
[ext_resource type="Theme" uid="uid://d2rlcffg7nguy" path="res://menus.tres" id="1_3r2db"]
|
||||||
|
[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" path="res://hotline_miami.gd" id="4_joumd"]
|
||||||
|
|
||||||
[node name="ScoreScreen" type="Node2D"]
|
[node name="ScoreScreen" type="Node2D"]
|
||||||
|
script = ExtResource("1_cyy7t")
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="."]
|
[node name="Control" type="Control" parent="."]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
|
|
@ -37,9 +40,12 @@ horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
[node name="MorshoReactManager" type="Node2D" parent="."]
|
[node name="MorshoReactManager" type="Node2D" parent="."]
|
||||||
|
texture_filter = 1
|
||||||
position = Vector2(870, 360)
|
position = Vector2(870, 360)
|
||||||
rotation = 0.20420352
|
|
||||||
scale = Vector2(2.5, 2.5)
|
scale = Vector2(2.5, 2.5)
|
||||||
|
script = ExtResource("4_joumd")
|
||||||
|
viewport_x_div = 1.5
|
||||||
|
viewport_y_div = 2.0
|
||||||
|
|
||||||
[node name="MorshoHappy" type="Sprite2D" parent="MorshoReactManager"]
|
[node name="MorshoHappy" type="Sprite2D" parent="MorshoReactManager"]
|
||||||
texture = ExtResource("1_juxjb")
|
texture = ExtResource("1_juxjb")
|
||||||
|
|
@ -47,3 +53,6 @@ texture = ExtResource("1_juxjb")
|
||||||
[node name="MorshoAngry" type="Sprite2D" parent="MorshoReactManager"]
|
[node name="MorshoAngry" type="Sprite2D" parent="MorshoReactManager"]
|
||||||
visible = false
|
visible = false
|
||||||
texture = ExtResource("2_3r2db")
|
texture = ExtResource("2_3r2db")
|
||||||
|
|
||||||
|
[node name="WinLossAudioPlayer" type="AudioStreamPlayer" parent="."]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
|
|
||||||
BIN
win.ogg
Normal file
BIN
win.ogg
Normal file
Binary file not shown.
19
win.ogg.import
Normal file
19
win.ogg.import
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="oggvorbisstr"
|
||||||
|
type="AudioStreamOggVorbis"
|
||||||
|
uid="uid://2g0mcrbwnkfc"
|
||||||
|
path="res://.godot/imported/win.ogg-925680d4a92658a999b17dd5ae4db057.oggvorbisstr"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://win.ogg"
|
||||||
|
dest_files=["res://.godot/imported/win.ogg-925680d4a92658a999b17dd5ae4db057.oggvorbisstr"]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
loop=false
|
||||||
|
loop_offset=0
|
||||||
|
bpm=0
|
||||||
|
beat_count=0
|
||||||
|
bar_beats=4
|
||||||
27
world.gd
27
world.gd
|
|
@ -2,7 +2,6 @@ extends Control
|
||||||
|
|
||||||
enum GameState { MAIN_MENU, GAME, LOSS, WIN }
|
enum GameState { MAIN_MENU, GAME, LOSS, WIN }
|
||||||
var current_game_state: GameState = GameState.MAIN_MENU
|
var current_game_state: GameState = GameState.MAIN_MENU
|
||||||
var manager
|
|
||||||
|
|
||||||
var main_menu_scene = preload("res://main_menu.tscn")
|
var main_menu_scene = preload("res://main_menu.tscn")
|
||||||
var game_scene = preload("res://main.tscn")
|
var game_scene = preload("res://main.tscn")
|
||||||
|
|
@ -16,41 +15,49 @@ func transition(new_state: GameState):
|
||||||
|
|
||||||
if new_state == GameState.MAIN_MENU:
|
if new_state == GameState.MAIN_MENU:
|
||||||
var main_menu_instance = main_menu_scene.instantiate()
|
var main_menu_instance = main_menu_scene.instantiate()
|
||||||
add_child(main_menu_scene)
|
add_child(main_menu_instance)
|
||||||
elif new_state == GameState.GAME:
|
elif new_state == GameState.GAME:
|
||||||
var game_instance = game_scene.instantiate()
|
var game_instance = game_scene.instantiate()
|
||||||
add_child(game_instance)
|
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:
|
elif new_state == GameState.LOSS:
|
||||||
var score_screen_instance = score_screen_scene.instantiate()
|
var score_screen_instance = score_screen_scene.instantiate()
|
||||||
add_child(score_screen_instance)
|
add_child(score_screen_instance)
|
||||||
score_screen_instance.win()
|
score_screen_instance.lose()
|
||||||
|
score_screen_instance.restart_game.connect(_on_restart)
|
||||||
elif new_state == GameState.WIN:
|
elif new_state == GameState.WIN:
|
||||||
pass
|
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
|
# Clean up old scene
|
||||||
match (current_game_state):
|
match (current_game_state):
|
||||||
GameState.MAIN_MENU:
|
GameState.MAIN_MENU:
|
||||||
var main_menu_instance = $MainMenu
|
var main_menu_instance = $MainMenu
|
||||||
var main_menu_instance.destroy()
|
main_menu_instance.queue_free()
|
||||||
GameState.GAME:
|
GameState.GAME:
|
||||||
var main_instance = $Main
|
var main_instance = $Main
|
||||||
main_instance.destroy()
|
main_instance.queue_free()
|
||||||
GameState.LOSS:
|
GameState.LOSS:
|
||||||
var score_screen_instance = $ScoreScreen
|
var score_screen_instance = $ScoreScreen
|
||||||
score_screen_instance.destroy()
|
score_screen_instance.queue_free()
|
||||||
GameState.WIN:
|
GameState.WIN:
|
||||||
var score_screen_instance = $ScoreScreen
|
var score_screen_instance = $ScoreScreen
|
||||||
score_screen_instance.destroy()
|
score_screen_instance.queue_free()
|
||||||
|
|
||||||
current_game_state = new_state
|
current_game_state = new_state
|
||||||
|
|
||||||
func _on_main_menu_interacted():
|
func _on_main_menu_interacted():
|
||||||
transition(GameState.GAME)
|
transition(GameState.GAME)
|
||||||
add_child(manager)
|
|
||||||
manager.failed.connect(_on_loss)
|
|
||||||
|
|
||||||
func _on_loss():
|
func _on_loss():
|
||||||
transition(GameState.LOSS)
|
transition(GameState.LOSS)
|
||||||
|
|
||||||
func _on_win():
|
func _on_win():
|
||||||
transition(GameState.WIN)
|
transition(GameState.WIN)
|
||||||
|
|
||||||
|
func _on_restart():
|
||||||
|
transition(GameState.GAME)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue