Compare commits
5 commits
7af9aca2f5
...
02a89aa068
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02a89aa068 | ||
|
|
5112a2b98a | ||
|
|
3c725316b7 | ||
|
|
0bb85aca7c | ||
|
|
6cd6db088b |
13 changed files with 190 additions and 32 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
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
43
main_menu.gd
Normal 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
1
main_menu.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://bhpge7t5uk4gv
|
||||||
|
|
@ -1,8 +1,10 @@
|
||||||
[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="MainMenu" type="Control"]
|
[node name="MainMenu" type="Control"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
|
|
@ -11,6 +13,7 @@ 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
BIN
mainmenu.ogg
Normal file
Binary file not shown.
19
mainmenu.ogg.import
Normal file
19
mainmenu.ogg.import
Normal 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
|
||||||
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,9 @@
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
|
signal restart_game
|
||||||
|
|
||||||
|
var input_received = false
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
win()
|
win()
|
||||||
|
|
||||||
|
|
@ -14,3 +18,11 @@ func lose():
|
||||||
$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")
|
||||||
|
|
|
||||||
|
|
@ -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
63
world.gd
Normal 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
1
world.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://btq5lp33qphwg
|
||||||
16
world.tscn
Normal file
16
world.tscn
Normal 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
|
||||||
Loading…
Add table
Reference in a new issue