From 1d79bbbb95f1372650914cf543e7d9179653ef6e Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 00:59:28 +0200 Subject: added bgm --- godot/assets/sounds/bgm.mp3 | 3 +++ godot/assets/sounds/bgm.mp3.import | 3 +++ godot/assets/sounds/main_menu.mp3 | 3 +++ godot/assets/sounds/main_menu.mp3.import | 3 +++ godot/scenes/Game.tscn | 15 ++++++++++++++- godot/scenes/Menu.tscn | 7 ++++++- 6 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 godot/assets/sounds/bgm.mp3 create mode 100644 godot/assets/sounds/bgm.mp3.import create mode 100644 godot/assets/sounds/main_menu.mp3 create mode 100644 godot/assets/sounds/main_menu.mp3.import (limited to 'godot') diff --git a/godot/assets/sounds/bgm.mp3 b/godot/assets/sounds/bgm.mp3 new file mode 100644 index 0000000..cad9651 --- /dev/null +++ b/godot/assets/sounds/bgm.mp3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b3907d7df22c82ee15cfff306a69dd3f5f003cec8a031972f84004dc268da51 +size 5963398 diff --git a/godot/assets/sounds/bgm.mp3.import b/godot/assets/sounds/bgm.mp3.import new file mode 100644 index 0000000..c98d401 --- /dev/null +++ b/godot/assets/sounds/bgm.mp3.import @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:128cf14fafb0d84338eca1ea75b9f54d21b86505f97f047a412607dc4e6fbbf3 +size 280 diff --git a/godot/assets/sounds/main_menu.mp3 b/godot/assets/sounds/main_menu.mp3 new file mode 100644 index 0000000..1f262dc --- /dev/null +++ b/godot/assets/sounds/main_menu.mp3 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b320e47c06cc8ba3889e3ac6467eff129fd9c6dced99de1de919783faea9ae23 +size 6169312 diff --git a/godot/assets/sounds/main_menu.mp3.import b/godot/assets/sounds/main_menu.mp3.import new file mode 100644 index 0000000..c593491 --- /dev/null +++ b/godot/assets/sounds/main_menu.mp3.import @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d5090dd2ec3c9f87d013bd43165984f1643934d2f51bd8b2aa3e63e784335a2d +size 298 diff --git a/godot/scenes/Game.tscn b/godot/scenes/Game.tscn index 0896836..9891f4e 100644 --- a/godot/scenes/Game.tscn +++ b/godot/scenes/Game.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=7 format=2] [ext_resource path="res://scenes/Game.gd" type="Script" id=1] [ext_resource path="res://scenes/levels/test_scene_movement/TestSceneMovement.tscn" type="PackedScene" id=2] [ext_resource path="res://assets/theme.tres" type="Theme" id=3] [ext_resource path="res://assets/fonts/format.tres" type="DynamicFont" id=4] +[ext_resource path="res://scenes/objects/Scoreboard.tscn" type="PackedScene" id=5] +[ext_resource path="res://assets/sounds/bgm.mp3" type="AudioStream" id=6] [node name="Game" type="Spatial"] script = ExtResource( 1 ) @@ -57,5 +59,16 @@ margin_right = 360.0 margin_bottom = 343.0 text = "Quit" +[node name="Scoreboard" parent="." instance=ExtResource( 5 )] +visible = false +margin_right = -0.319946 +margin_bottom = 0.47998 + +[node name="Level1" type="Spatial" parent="."] + +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 6 ) +autoplay = true + [connection signal="pressed" from="PausePopup/Panel/VBoxContainer/ResumeButton" to="." method="_on_ResumeButton_pressed"] [connection signal="pressed" from="PausePopup/Panel/VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"] diff --git a/godot/scenes/Menu.tscn b/godot/scenes/Menu.tscn index 5529448..792bc28 100644 --- a/godot/scenes/Menu.tscn +++ b/godot/scenes/Menu.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=2] +[gd_scene load_steps=4 format=2] [ext_resource path="res://assets/theme.tres" type="Theme" id=1] [ext_resource path="res://scenes/Menu.gd" type="Script" id=2] +[ext_resource path="res://assets/sounds/main_menu.mp3" type="AudioStream" id=3] [node name="Menu" type="Control"] anchor_right = 1.0 @@ -38,5 +39,9 @@ margin_bottom = 251.0 focus_neighbour_bottom = NodePath("../StartButton") text = "Quit" +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 3 ) +autoplay = true + [connection signal="pressed" from="VBoxContainer/StartButton" to="." method="_on_StartButton_pressed"] [connection signal="pressed" from="VBoxContainer/QuitButton" to="." method="_on_QuitButton_pressed"] -- cgit From ae7b1a2b6629749c9df00d65a7c5e227268827fc Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 01:00:45 +0200 Subject: moved level loading and score tracking to the game class --- godot/scenes/Game.gd | 47 +++++++++++++++++++++++++++++++++---- godot/scripts/LevelLoader.gd | 55 -------------------------------------------- 2 files changed, 42 insertions(+), 60 deletions(-) delete mode 100644 godot/scripts/LevelLoader.gd (limited to 'godot') diff --git a/godot/scenes/Game.gd b/godot/scenes/Game.gd index 31e543d..29a5537 100644 --- a/godot/scenes/Game.gd +++ b/godot/scenes/Game.gd @@ -1,14 +1,23 @@ extends Spatial +const NUM_LEVELS = 9 +const PAR = [1,2,3,4,5,6,7,8,9] -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" +# level control +var current_level_id = 0 +var levels = [] +# stroke control +var current_strokes = 0 +var strokes_per_level = [0,0,0,0,0,0,0,0,0] # Called when the node enters the scene tree for the first time. func _ready(): - pass # Replace with function body. + for i in range(NUM_LEVELS): + levels.append(get_node("/root/Game/Level%d" % (i+1))) + + current_strokes = 0 + levels[0].show() # Called every frame. 'delta' is the elapsed time since the previous frame. @@ -20,7 +29,6 @@ func _process(delta): - func _on_QuitButton_pressed(): get_tree().quit() @@ -29,3 +37,32 @@ func _on_ResumeButton_pressed(): $PausePopup.hide() get_tree().paused = false Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) + + +func load_next_level(): + levels[current_level_id].hide() + current_level_id = current_level_id + 1 + + # save current strokes and reset + strokes_per_level[current_level_id] = current_strokes + current_strokes = 0 + + if current_level_id >= NUM_LEVELS: + # TODO load main menu + return + + # load next level + levels[current_level_id].show() + + $Scoreboard.update_values(strokes_per_level, PAR) + $Scoreboard.show() + + # TODO teleport player back + + +func add_stroke(): + current_strokes += 1 + + +func revoke_stroke(): + current_strokes -= 1 diff --git a/godot/scripts/LevelLoader.gd b/godot/scripts/LevelLoader.gd deleted file mode 100644 index 2aec587..0000000 --- a/godot/scripts/LevelLoader.gd +++ /dev/null @@ -1,55 +0,0 @@ -extends Node - -const NUM_LEVELS = 9 - -# player node -var player: Spatial = null - -# level control -var current_level_id = 0 -var levels = [] - -# stroke control -var current_strokes = 0 -var strokes_per_level = [] - -# Called when the node enters the scene tree for the first time. -func _ready(): - for i in range(NUM_LEVELS): - levels.append(get_node("/root/Game/Level%d" % (i+1))) - - current_strokes = 0 - levels[0].show() - - player = get_node("/root/Game/PlayerRoot") - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass - -func load_next_level(): - levels[current_level_id].hide() - current_level_id = current_level_id + 1 - - if current_level_id >= NUM_LEVELS: - # TODO load main menu - return - - # load next level - levels[current_level_id].show() - - # save current strokes and reset - strokes_per_level.append(current_strokes) - current_strokes = 0 - - # TODO teleport player back - - -func add_stroke(): - current_strokes += 1 - - -func revoke_stroke(): - current_strokes -= 1 - -- cgit From 98a089669678984edaf6ef37d5a0c463962b007b Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 01:01:02 +0200 Subject: simple scoreboard --- godot/assets/sounds/Uuhhh.mp3.import | 16 +- godot/scenes/objects/Player.tscn | 18 ++ godot/scenes/objects/Scoreboard.gd | 22 ++ godot/scenes/objects/Scoreboard.tscn | 433 +++++++++++++++++++++++++++++++++++ godot/scenes/objects/W8.tscn | 46 ++++ godot/scripts/GoalTriggerBox.gd | 4 +- 6 files changed, 524 insertions(+), 15 deletions(-) create mode 100644 godot/scenes/objects/Player.tscn create mode 100644 godot/scenes/objects/Scoreboard.gd create mode 100644 godot/scenes/objects/Scoreboard.tscn create mode 100644 godot/scenes/objects/W8.tscn (limited to 'godot') diff --git a/godot/assets/sounds/Uuhhh.mp3.import b/godot/assets/sounds/Uuhhh.mp3.import index cbe7703..748d572 100644 --- a/godot/assets/sounds/Uuhhh.mp3.import +++ b/godot/assets/sounds/Uuhhh.mp3.import @@ -1,13 +1,3 @@ -[remap] - -importer="mp3" -type="AudioStreamMP3" -valid=false - -[deps] - -source_file="res://assets/sounds/Uuhhh.mp3" -[params] - -loop=true -loop_offset=0 +version https://git-lfs.github.com/spec/v1 +oid sha256:438df26bf3f392ff8f33d0cdc6ae6379b28a9ae306cccfe80e193127504c589a +size 286 diff --git a/godot/scenes/objects/Player.tscn b/godot/scenes/objects/Player.tscn new file mode 100644 index 0000000..cc3662e --- /dev/null +++ b/godot/scenes/objects/Player.tscn @@ -0,0 +1,18 @@ +[gd_scene load_steps=4 format=2] + +[ext_resource path="res://scenes/objects/W8.tscn" type="PackedScene" id=1] +[ext_resource path="res://scenes/objects/Camera.tscn" type="PackedScene" id=2] +[ext_resource path="res://native/BasicDie.gdns" type="Script" id=3] + +[node name="PlayerRoot" type="Spatial"] +script = ExtResource( 3 ) +camera/camera_clamp = Vector2( 0, -1.3 ) +shooting/max_force = 30.0 +shooting/up_angle = 0.3 +shooting/stopping_velocity = 0.003 + +[node name="W8" parent="." instance=ExtResource( 1 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.1, 0 ) + +[node name="Camera" parent="." instance=ExtResource( 2 )] +transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0 ) diff --git a/godot/scenes/objects/Scoreboard.gd b/godot/scenes/objects/Scoreboard.gd new file mode 100644 index 0000000..0f6d32b --- /dev/null +++ b/godot/scenes/objects/Scoreboard.gd @@ -0,0 +1,22 @@ +extends Control + +func update_values(values, pars): + $Panel/GridContainer/Player0.text = "%d" % values[0] + $Panel/GridContainer/Player1.text = "%d" % values[1] + $Panel/GridContainer/Player2.text = "%d" % values[2] + $Panel/GridContainer/Player3.text = "%d" % values[3] + $Panel/GridContainer/Player4.text = "%d" % values[4] + $Panel/GridContainer/Player5.text = "%d" % values[5] + $Panel/GridContainer/Player6.text = "%d" % values[6] + $Panel/GridContainer/Player7.text = "%d" % values[7] + $Panel/GridContainer/Player8.text = "%d" % values[8] + + $Panel/GridContainer/Par0.text = "%d" % pars[0] + $Panel/GridContainer/Par1.text = "%d" % pars[1] + $Panel/GridContainer/Par2.text = "%d" % pars[2] + $Panel/GridContainer/Par3.text = "%d" % pars[3] + $Panel/GridContainer/Par4.text = "%d" % pars[4] + $Panel/GridContainer/Par5.text = "%d" % pars[5] + $Panel/GridContainer/Par6.text = "%d" % pars[6] + $Panel/GridContainer/Par7.text = "%d" % pars[7] + $Panel/GridContainer/Par8.text = "%d" % pars[8] diff --git a/godot/scenes/objects/Scoreboard.tscn b/godot/scenes/objects/Scoreboard.tscn new file mode 100644 index 0000000..ab9c887 --- /dev/null +++ b/godot/scenes/objects/Scoreboard.tscn @@ -0,0 +1,433 @@ +[gd_scene load_steps=3 format=2] + +[ext_resource path="res://assets/theme.tres" type="Theme" id=1] +[ext_resource path="res://scenes/objects/Scoreboard.gd" type="Script" id=2] + +[node name="Scoreboard" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_right = -0.320004 +margin_bottom = 0.48 +script = ExtResource( 2 ) + +[node name="Panel" type="Panel" parent="."] +anchor_right = 1.0 +anchor_bottom = 0.952 +margin_left = 120.0 +margin_top = 120.0 +margin_right = -119.68 +margin_bottom = -665.617 + +[node name="GridContainer" type="GridContainer" parent="Panel"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 50.0 +margin_top = 50.0 +columns = 10 + +[node name="LabelHeader" type="Label" parent="Panel/GridContainer"] +margin_right = 159.0 +margin_bottom = 51.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "Hole" +align = 3 +valign = 3 +autowrap = true + +[node name="Label" type="Label" parent="Panel/GridContainer"] +margin_left = 163.0 +margin_right = 322.0 +margin_bottom = 51.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "1" +align = 3 +valign = 3 +autowrap = true + +[node name="Label2" type="Label" parent="Panel/GridContainer"] +margin_left = 326.0 +margin_right = 485.0 +margin_bottom = 51.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "2" +align = 3 +valign = 3 +autowrap = true + +[node name="Label3" type="Label" parent="Panel/GridContainer"] +margin_left = 489.0 +margin_right = 648.0 +margin_bottom = 51.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "3" +align = 3 +valign = 3 +autowrap = true + +[node name="Label4" type="Label" parent="Panel/GridContainer"] +margin_left = 652.0 +margin_right = 811.0 +margin_bottom = 51.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "4" +align = 3 +valign = 3 +autowrap = true + +[node name="Label5" type="Label" parent="Panel/GridContainer"] +margin_left = 815.0 +margin_right = 974.0 +margin_bottom = 51.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "5" +align = 3 +valign = 3 +autowrap = true + +[node name="Label6" type="Label" parent="Panel/GridContainer"] +margin_left = 978.0 +margin_right = 1137.0 +margin_bottom = 51.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "6" +align = 3 +valign = 3 +autowrap = true + +[node name="Label7" type="Label" parent="Panel/GridContainer"] +margin_left = 1141.0 +margin_right = 1300.0 +margin_bottom = 51.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "7" +align = 3 +valign = 3 +autowrap = true + +[node name="Label8" type="Label" parent="Panel/GridContainer"] +margin_left = 1304.0 +margin_right = 1463.0 +margin_bottom = 51.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "8" +align = 3 +valign = 3 +autowrap = true + +[node name="Label9" type="Label" parent="Panel/GridContainer"] +margin_left = 1467.0 +margin_right = 1626.0 +margin_bottom = 51.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "9" +align = 3 +valign = 3 +autowrap = true + +[node name="LabelHeader2" type="Label" parent="Panel/GridContainer"] +margin_top = 55.0 +margin_right = 159.0 +margin_bottom = 106.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "Par" +align = 3 +valign = 3 +autowrap = true + +[node name="Par0" type="Label" parent="Panel/GridContainer"] +margin_left = 163.0 +margin_top = 55.0 +margin_right = 322.0 +margin_bottom = 106.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Par1" type="Label" parent="Panel/GridContainer"] +margin_left = 326.0 +margin_top = 55.0 +margin_right = 485.0 +margin_bottom = 106.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Par2" type="Label" parent="Panel/GridContainer"] +margin_left = 489.0 +margin_top = 55.0 +margin_right = 648.0 +margin_bottom = 106.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Par3" type="Label" parent="Panel/GridContainer"] +margin_left = 652.0 +margin_top = 55.0 +margin_right = 811.0 +margin_bottom = 106.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Par4" type="Label" parent="Panel/GridContainer"] +margin_left = 815.0 +margin_top = 55.0 +margin_right = 974.0 +margin_bottom = 106.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Par5" type="Label" parent="Panel/GridContainer"] +margin_left = 978.0 +margin_top = 55.0 +margin_right = 1137.0 +margin_bottom = 106.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Par6" type="Label" parent="Panel/GridContainer"] +margin_left = 1141.0 +margin_top = 55.0 +margin_right = 1300.0 +margin_bottom = 106.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Par7" type="Label" parent="Panel/GridContainer"] +margin_left = 1304.0 +margin_top = 55.0 +margin_right = 1463.0 +margin_bottom = 106.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Par8" type="Label" parent="Panel/GridContainer"] +margin_left = 1467.0 +margin_top = 55.0 +margin_right = 1626.0 +margin_bottom = 106.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="LabelHeader3" type="Label" parent="Panel/GridContainer"] +margin_top = 110.0 +margin_right = 159.0 +margin_bottom = 161.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "Player" +align = 3 +valign = 3 +autowrap = true + +[node name="Player0" type="Label" parent="Panel/GridContainer"] +margin_left = 163.0 +margin_top = 110.0 +margin_right = 322.0 +margin_bottom = 161.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Player1" type="Label" parent="Panel/GridContainer"] +margin_left = 326.0 +margin_top = 110.0 +margin_right = 485.0 +margin_bottom = 161.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Player2" type="Label" parent="Panel/GridContainer"] +margin_left = 489.0 +margin_top = 110.0 +margin_right = 648.0 +margin_bottom = 161.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Player3" type="Label" parent="Panel/GridContainer"] +margin_left = 652.0 +margin_top = 110.0 +margin_right = 811.0 +margin_bottom = 161.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Player4" type="Label" parent="Panel/GridContainer"] +margin_left = 815.0 +margin_top = 110.0 +margin_right = 974.0 +margin_bottom = 161.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Player5" type="Label" parent="Panel/GridContainer"] +margin_left = 978.0 +margin_top = 110.0 +margin_right = 1137.0 +margin_bottom = 161.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Player6" type="Label" parent="Panel/GridContainer"] +margin_left = 1141.0 +margin_top = 110.0 +margin_right = 1300.0 +margin_bottom = 161.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Player7" type="Label" parent="Panel/GridContainer"] +margin_left = 1304.0 +margin_top = 110.0 +margin_right = 1463.0 +margin_bottom = 161.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true + +[node name="Player8" type="Label" parent="Panel/GridContainer"] +margin_left = 1467.0 +margin_top = 110.0 +margin_right = 1626.0 +margin_bottom = 161.0 +size_flags_horizontal = 3 +size_flags_vertical = 1 +size_flags_stretch_ratio = 20.0 +theme = ExtResource( 1 ) +text = "0" +align = 3 +valign = 3 +autowrap = true diff --git a/godot/scenes/objects/W8.tscn b/godot/scenes/objects/W8.tscn new file mode 100644 index 0000000..8766011 --- /dev/null +++ b/godot/scenes/objects/W8.tscn @@ -0,0 +1,46 @@ +[gd_scene load_steps=6 format=2] + +[ext_resource path="res://assets/game_objects/W8baseColor_Mat.material" type="Material" id=2] + +[sub_resource type="ArrayMesh" id=1] +resource_name = "W8_Cone" +surfaces/0 = { +"aabb": AABB( -0.956074, -0.956074, -0.956074, 1.91215, 1.91215, 1.91215 ), +"array_data": PoolByteArray( 243, 55, 39, 61, 242, 55, 39, 189, 1, 25, 107, 191, 90, 166, 181, 114, 182, 56, 213, 56, 243, 55, 39, 189, 242, 55, 39, 189, 1, 25, 107, 191, 166, 166, 202, 117, 195, 56, 249, 56, 243, 55, 39, 189, 242, 55, 39, 61, 1, 25, 107, 191, 166, 90, 68, 9, 203, 59, 28, 52, 243, 55, 39, 61, 242, 55, 39, 61, 1, 25, 107, 191, 90, 90, 179, 93, 211, 56, 187, 56, 0, 0, 0, 0, 194, 217, 73, 189, 30, 67, 109, 191, 74, 129, 189, 114, 188, 56, 231, 56, 0, 0, 0, 0, 0, 0, 0, 0, 64, 193, 116, 191, 127, 127, 208, 102, 215, 56, 221, 56, 0, 0, 0, 0, 0, 0, 0, 0, 64, 193, 116, 191, 127, 127, 35, 17, 234, 59, 51, 52, 196, 217, 73, 189, 0, 0, 0, 0, 30, 67, 109, 191, 129, 74, 9, 124, 216, 56, 251, 56, 196, 217, 73, 189, 0, 0, 0, 0, 30, 67, 109, 191, 129, 74, 64, 18, 219, 59, 3, 52, 0, 0, 0, 0, 194, 217, 73, 61, 30, 67, 109, 191, 74, 127, 179, 77, 229, 56, 195, 56, 0, 0, 0, 0, 194, 217, 73, 61, 30, 67, 109, 191, 74, 127, 62, 8, 207, 59, 68, 52, 196, 217, 73, 61, 0, 0, 0, 0, 30, 67, 109, 191, 127, 74, 185, 106, 196, 56, 200, 56, 1, 25, 107, 63, 242, 55, 39, 189, 232, 55, 39, 189, 90, 184, 179, 121, 112, 54, 156, 54, 1, 25, 107, 63, 243, 55, 39, 61, 232, 55, 39, 189, 90, 72, 181, 101, 169, 54, 105, 54, 1, 25, 107, 63, 244, 55, 39, 61, 253, 55, 39, 61, 54, 36, 202, 109, 143, 54, 33, 54, 1, 25, 107, 63, 242, 55, 39, 189, 253, 55, 39, 61, 54, 220, 206, 34, 252, 39, 251, 57, 31, 67, 109, 63, 252, 254, 180, 177, 177, 217, 73, 189, 126, 204, 185, 112, 141, 54, 131, 54, 64, 193, 116, 63, 2, 43, 165, 48, 23, 193, 39, 51, 126, 0, 0, 17, 30, 36, 240, 57, 64, 193, 116, 63, 2, 43, 165, 48, 23, 193, 39, 51, 126, 0, 48, 126, 104, 54, 89, 54, 30, 67, 109, 63, 196, 217, 73, 61, 245, 193, 47, 51, 74, 52, 189, 105, 157, 54, 69, 54, 30, 67, 109, 63, 0, 0, 0, 49, 206, 217, 73, 61, 74, 0, 230, 32, 252, 37, 8, 58, 30, 67, 109, 63, 0, 0, 0, 49, 206, 217, 73, 61, 74, 0, 253, 122, 102, 54, 29, 54, 30, 67, 109, 63, 195, 217, 73, 189, 245, 193, 47, 51, 74, 204, 211, 31, 126, 39, 231, 57, 30, 67, 109, 63, 195, 217, 73, 189, 245, 193, 47, 51, 74, 204, 98, 116, 75, 54, 141, 54, 221, 55, 39, 61, 242, 55, 39, 189, 1, 25, 107, 63, 36, 220, 190, 39, 246, 50, 180, 59, 221, 55, 39, 61, 242, 55, 39, 61, 1, 25, 107, 63, 36, 36, 196, 102, 169, 55, 244, 46, 8, 56, 39, 189, 240, 55, 39, 61, 1, 25, 107, 63, 220, 36, 154, 101, 224, 55, 32, 46, 7, 56, 39, 189, 242, 55, 39, 189, 1, 25, 107, 63, 220, 220, 133, 89, 136, 51, 193, 59, 179, 217, 73, 61, 252, 254, 180, 177, 30, 67, 109, 63, 52, 0, 211, 39, 190, 50, 195, 59, 179, 217, 73, 61, 252, 254, 180, 177, 30, 67, 109, 63, 52, 0, 228, 102, 131, 55, 187, 46, 81, 109, 158, 179, 172, 28, 154, 176, 64, 193, 116, 63, 0, 0, 161, 47, 27, 51, 212, 59, 81, 109, 158, 179, 172, 28, 154, 176, 64, 193, 116, 63, 0, 0, 190, 93, 159, 55, 238, 45, 245, 193, 175, 179, 194, 217, 73, 61, 30, 67, 109, 63, 0, 52, 172, 100, 197, 55, 141, 46, 218, 217, 73, 189, 0, 0, 128, 177, 30, 67, 109, 63, 204, 0, 137, 91, 144, 51, 213, 59, 218, 217, 73, 189, 0, 0, 128, 177, 30, 67, 109, 63, 204, 0, 155, 97, 211, 55, 133, 45, 245, 193, 171, 179, 195, 217, 73, 189, 30, 67, 109, 63, 0, 204, 155, 41, 64, 51, 186, 59, 1, 25, 107, 191, 242, 55, 39, 189, 240, 55, 39, 61, 202, 220, 154, 101, 27, 56, 70, 59, 1, 25, 107, 191, 242, 55, 39, 61, 240, 55, 39, 61, 202, 36, 133, 103, 41, 58, 135, 40, 1, 25, 107, 191, 242, 55, 39, 61, 246, 55, 39, 189, 166, 72, 79, 6, 77, 58, 90, 41, 1, 25, 107, 191, 242, 55, 39, 189, 246, 55, 39, 189, 166, 184, 196, 121, 54, 56, 43, 59, 31, 67, 109, 191, 0, 0, 0, 0, 192, 217, 73, 61, 182, 0, 155, 105, 33, 56, 89, 59, 31, 67, 109, 191, 0, 0, 0, 0, 192, 217, 73, 61, 182, 0, 137, 102, 39, 58, 137, 38, 64, 193, 116, 191, 0, 0, 0, 0, 46, 230, 13, 178, 129, 0, 190, 127, 59, 56, 76, 59, 64, 193, 116, 191, 0, 0, 0, 0, 46, 230, 13, 178, 129, 0, 161, 1, 68, 58, 172, 38, 30, 67, 109, 191, 205, 217, 73, 61, 124, 173, 63, 178, 182, 52, 155, 8, 59, 58, 248, 40, 30, 67, 109, 191, 0, 0, 0, 0, 199, 217, 73, 189, 129, 52, 48, 117, 73, 56, 50, 59, 30, 67, 109, 191, 0, 0, 0, 0, 199, 217, 73, 189, 129, 52, 78, 16, 92, 58, 107, 40, 30, 67, 109, 191, 205, 217, 73, 189, 124, 173, 63, 178, 182, 204, 172, 111, 40, 56, 56, 59, 243, 55, 39, 189, 1, 25, 107, 63, 242, 55, 39, 189, 184, 90, 180, 1, 140, 57, 188, 52, 242, 55, 39, 189, 1, 25, 107, 63, 243, 55, 39, 61, 220, 54, 140, 101, 105, 57, 157, 52, 242, 55, 39, 61, 1, 25, 107, 63, 244, 55, 39, 61, 36, 54, 180, 101, 78, 57, 209, 52, 242, 55, 39, 61, 1, 25, 107, 63, 242, 55, 39, 189, 72, 90, 165, 90, 91, 57, 24, 53, 195, 217, 73, 189, 30, 67, 109, 63, 153, 186, 72, 48, 204, 74, 149, 14, 122, 57, 172, 52, 0, 0, 0, 46, 64, 193, 116, 63, 129, 149, 40, 49, 0, 126, 130, 32, 110, 57, 223, 52, 205, 12, 189, 177, 30, 67, 109, 63, 196, 217, 73, 61, 0, 74, 159, 99, 91, 57, 183, 52, 194, 217, 73, 61, 30, 67, 109, 63, 233, 6, 164, 49, 52, 74, 171, 97, 84, 57, 244, 52, 0, 0, 0, 0, 30, 67, 109, 63, 195, 217, 73, 189, 204, 126, 138, 65, 112, 57, 28, 53, 0, 0, 0, 0, 30, 67, 109, 63, 195, 217, 73, 189, 204, 126, 74, 1, 140, 57, 229, 52, 242, 55, 39, 189, 1, 25, 107, 191, 243, 55, 39, 189, 184, 166, 180, 114, 123, 53, 161, 57, 243, 55, 39, 61, 1, 25, 107, 191, 242, 55, 39, 189, 72, 166, 165, 117, 96, 53, 125, 57, 242, 55, 39, 61, 1, 25, 107, 191, 243, 55, 39, 61, 36, 202, 180, 37, 254, 52, 171, 57, 243, 55, 39, 189, 1, 25, 107, 191, 242, 55, 39, 61, 220, 202, 140, 93, 68, 53, 187, 57, 0, 0, 0, 0, 30, 67, 109, 191, 195, 217, 73, 189, 204, 129, 171, 113, 110, 53, 143, 57, 0, 0, 192, 174, 64, 193, 116, 191, 172, 28, 102, 48, 0, 129, 129, 95, 57, 53, 154, 57, 195, 217, 73, 61, 30, 67, 109, 191, 234, 6, 164, 49, 52, 182, 183, 37, 253, 52, 151, 57, 195, 217, 73, 61, 30, 67, 109, 191, 234, 6, 164, 49, 52, 182, 123, 124, 54, 53, 123, 57, 164, 27, 16, 177, 30, 67, 109, 191, 195, 217, 73, 61, 0, 182, 149, 39, 33, 53, 179, 57, 195, 217, 73, 189, 30, 67, 109, 191, 149, 186, 72, 48, 204, 182, 159, 105, 96, 53, 174, 57 ), +"array_index_data": PoolByteArray( 38, 0, 2, 0, 48, 0, 15, 0, 60, 0, 24, 0, 27, 0, 61, 0, 36, 0, 39, 0, 58, 0, 1, 0, 3, 0, 13, 0, 51, 0, 26, 0, 37, 0, 49, 0, 14, 0, 25, 0, 50, 0, 0, 0, 5, 0, 4, 0, 0, 0, 11, 0, 5, 0, 1, 0, 5, 0, 7, 0, 1, 0, 4, 0, 5, 0, 2, 0, 6, 0, 10, 0, 2, 0, 8, 0, 6, 0, 3, 0, 5, 0, 11, 0, 3, 0, 9, 0, 5, 0, 12, 0, 18, 0, 16, 0, 12, 0, 23, 0, 18, 0, 13, 0, 18, 0, 19, 0, 13, 0, 16, 0, 18, 0, 14, 0, 18, 0, 21, 0, 14, 0, 19, 0, 18, 0, 15, 0, 17, 0, 22, 0, 15, 0, 20, 0, 17, 0, 24, 0, 30, 0, 28, 0, 24, 0, 35, 0, 30, 0, 25, 0, 31, 0, 32, 0, 25, 0, 29, 0, 31, 0, 26, 0, 31, 0, 34, 0, 26, 0, 32, 0, 31, 0, 27, 0, 30, 0, 35, 0, 27, 0, 33, 0, 30, 0, 36, 0, 42, 0, 40, 0, 36, 0, 47, 0, 42, 0, 37, 0, 43, 0, 44, 0, 37, 0, 41, 0, 43, 0, 38, 0, 43, 0, 46, 0, 38, 0, 44, 0, 43, 0, 39, 0, 42, 0, 47, 0, 39, 0, 45, 0, 42, 0, 48, 0, 53, 0, 52, 0, 48, 0, 57, 0, 53, 0, 49, 0, 53, 0, 54, 0, 49, 0, 52, 0, 53, 0, 50, 0, 53, 0, 55, 0, 50, 0, 54, 0, 53, 0, 51, 0, 53, 0, 56, 0, 51, 0, 55, 0, 53, 0, 58, 0, 63, 0, 62, 0, 58, 0, 67, 0, 63, 0, 59, 0, 63, 0, 65, 0, 59, 0, 62, 0, 63, 0, 60, 0, 63, 0, 66, 0, 60, 0, 64, 0, 63, 0, 61, 0, 63, 0, 67, 0, 61, 0, 66, 0, 63, 0, 3, 0, 16, 0, 13, 0, 3, 0, 11, 0, 16, 0, 11, 0, 12, 0, 16, 0, 11, 0, 0, 0, 12, 0, 2, 0, 57, 0, 48, 0, 2, 0, 10, 0, 57, 0, 9, 0, 51, 0, 56, 0, 9, 0, 3, 0, 51, 0, 50, 0, 19, 0, 14, 0, 50, 0, 55, 0, 19, 0, 55, 0, 13, 0, 19, 0, 55, 0, 51, 0, 13, 0, 14, 0, 29, 0, 25, 0, 14, 0, 21, 0, 29, 0, 20, 0, 24, 0, 28, 0, 20, 0, 15, 0, 24, 0, 49, 0, 32, 0, 26, 0, 49, 0, 54, 0, 32, 0, 54, 0, 25, 0, 32, 0, 54, 0, 50, 0, 25, 0, 26, 0, 41, 0, 37, 0, 26, 0, 34, 0, 41, 0, 33, 0, 36, 0, 40, 0, 33, 0, 27, 0, 36, 0, 48, 0, 44, 0, 38, 0, 48, 0, 52, 0, 44, 0, 52, 0, 37, 0, 44, 0, 52, 0, 49, 0, 37, 0, 38, 0, 8, 0, 2, 0, 38, 0, 46, 0, 8, 0, 45, 0, 1, 0, 7, 0, 45, 0, 39, 0, 1, 0, 0, 0, 62, 0, 59, 0, 0, 0, 4, 0, 62, 0, 4, 0, 58, 0, 62, 0, 4, 0, 1, 0, 58, 0, 59, 0, 23, 0, 12, 0, 59, 0, 65, 0, 23, 0, 64, 0, 15, 0, 22, 0, 64, 0, 60, 0, 15, 0, 60, 0, 35, 0, 24, 0, 60, 0, 66, 0, 35, 0, 66, 0, 27, 0, 35, 0, 66, 0, 61, 0, 27, 0, 61, 0, 47, 0, 36, 0, 61, 0, 67, 0, 47, 0, 67, 0, 39, 0, 47, 0, 67, 0, 58, 0, 39, 0, 0, 0, 59, 0, 12, 0 ), +"blend_shape_data": [ ], +"format": 2194711, +"index_count": 312, +"material": ExtResource( 2 ), +"primitive": 4, +"skeleton_aabb": [ ], +"vertex_count": 68 +} + +[sub_resource type="ConvexPolygonShape" id=2] +points = PoolVector3Array( -0.0850063, -0.879389, -0.0282584, 0.0288993, 0.929375, 0.0289349, 0.0288993, 0.929375, -0.0289349, 0.929367, -0.0289314, 0.0289314, -0.0289784, -0.0289338, 0.929338, -0.929369, 0.028929, 0.028929, 0.0288993, -0.0289349, -0.929375, 0.0288993, -0.929375, 0.0289349, -0.0850063, 0.0282584, -0.879389, 0.0282247, 0.084959, 0.87945, 0.857489, 0.056933, -0.0855785, -0.879454, -0.0849424, 0.0282549, 0.0570775, -0.885814, -0.0571088, 0.0570775, -0.0571088, 0.885814, -0.0571532, 0.885743, -0.0571043, -0.0571532, 0.885743, 0.0571043, 0.0570775, 0.0571088, -0.885814, -0.885806, -0.057097, -0.057097, 0.879446, 0.0849494, 0.0282572, 0.857335, -0.0571018, -0.0855632, -0.0571532, 0.0571043, 0.885743, -0.0571532, -0.885743, 0.0571043, -0.885806, 0.057097, -0.057097, -0.0571532, -0.0571043, -0.885743, 0.0570775, 0.0571088, 0.885814, -0.0571532, -0.885743, -0.0571043, -0.0571532, 0.0571043, -0.885743, 0.0570775, -0.885814, 0.0571088, 0.0570775, 0.885814, 0.0571088, -0.0571532, -0.0571043, 0.885743, -0.885806, 0.057097, 0.057097, 0.0570775, 0.885814, -0.0571088, 0.0570775, -0.0571088, -0.885814, 0.857335, -0.0571018, 0.0855632, -0.885806, -0.057097, 0.057097, 0.857489, 0.056933, 0.0855785, 0.929425, 0.0287513, -0.0289333, 0.929367, -0.0289314, -0.0289314, -0.0289784, 0.929338, -0.0289338, 0.0288993, 0.0289349, -0.929375, -0.929369, -0.028929, -0.028929, -0.0283039, -0.87942, -0.0849561, 0.084933, 0.0282608, 0.879461, -0.0289784, 0.929338, 0.0289338, -0.0289784, -0.0289338, -0.929338, -0.0289784, 0.0289338, 0.929338, 0.0288993, -0.0289349, 0.929375, 0.0288993, -0.929375, -0.0289349, -0.0289784, -0.929338, 0.0289338, -0.929369, 0.028929, -0.028929, -0.0283039, 0.0849561, -0.87942, -0.879454, -0.0282549, 0.0849424, 0.879512, 0.0280816, 0.0849558, 0.879446, -0.0849494, -0.0282572, -0.0282988, -0.822574, 0.141805, 0.17021, 0.0280745, -0.794261, -0.879454, 0.0849424, -0.0282549, -0.0283039, 0.87942, 0.0849561, 0.0282247, 0.87945, -0.084959, 0.0282247, -0.084959, -0.87945, -0.879454, -0.0282549, -0.0849424, -0.0850063, 0.0282584, 0.879389, -0.0850063, 0.879389, 0.0282584, 0.084933, -0.0282608, 0.879461 ) + +[sub_resource type="SphereShape" id=3] + +[sub_resource type="SphereMesh" id=4] + +[node name="RigidBody" type="RigidBody"] + +[node name="MeshDie" type="MeshInstance" parent="."] +mesh = SubResource( 1 ) +skeleton = NodePath("../..") +material/0 = null + +[node name="CollisionShapeDie" type="CollisionShape" parent="."] +shape = SubResource( 2 ) + +[node name="CollisionShapeSphere" type="CollisionShape" parent="."] +transform = Transform( 0.7, 0, 0, 0, 0.7, 0, 0, 0, 0.7, 0, 0, 0 ) +shape = SubResource( 3 ) +disabled = true + +[node name="MeshSphere" type="MeshInstance" parent="."] +transform = Transform( 0.7, 0, 0, 0, 0.7, 0, 0, 0, 0.7, 0, 0, 0 ) +visible = false +mesh = SubResource( 4 ) +material/0 = ExtResource( 2 ) diff --git a/godot/scripts/GoalTriggerBox.gd b/godot/scripts/GoalTriggerBox.gd index 17e98ad..42345d8 100644 --- a/godot/scripts/GoalTriggerBox.gd +++ b/godot/scripts/GoalTriggerBox.gd @@ -1,11 +1,11 @@ extends Area -const Loader = preload("res://scripts/LevelLoader.gd") +const Loader = preload("res://scenes/Game.gd") var loader: Loader = null # Called when the node enters the scene tree for the first time. func _ready(): - loader = get_node("/root/Game/LevelLoader") + loader = get_node("/root/Game") # Called every frame. 'delta' is the elapsed time since the previous frame. -- cgit From 612e037bc85b815865c6019eb9be87d731e14d30 Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 01:08:48 +0200 Subject: scoreboard can be accessed when pressing tab --- godot/scenes/Die.gd | 12 ++++++++++++ godot/scenes/Game.gd | 9 +++++++++ 2 files changed, 21 insertions(+) (limited to 'godot') diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 5e238f1..407f248 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -1,5 +1,7 @@ extends Spatial +const Game = preload("res://scenes/Game.gd") + var camrot_h = 0 var camrot_v = 0 var camrot_v_locked_val = 0 @@ -12,14 +14,24 @@ var dragging = false var mouse_origin = Vector2(0,0) var dice_launch_force = 0 +var _game: Game = null + # Called when the node enters the scene tree for the first time. func _ready(): Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) $CamRoot/Horizontal/Vertical/Camera.add_exception(self) $CamRoot.set_as_toplevel(true) + _game = get_node("/root/Game") func _input(event): + if event is InputEventKey: + if event.scancode == KEY_TAB: + if event.is_pressed(): + _game.open_scoreboard() + else: + _game.close_scoreboard() + if event is InputEventMouseMotion: camrot_h += -event.relative.x * sensitivity camrot_v += -event.relative.y * sensitivity diff --git a/godot/scenes/Game.gd b/godot/scenes/Game.gd index 29a5537..56acb04 100644 --- a/godot/scenes/Game.gd +++ b/godot/scenes/Game.gd @@ -66,3 +66,12 @@ func add_stroke(): func revoke_stroke(): current_strokes -= 1 + + +func open_scoreboard(): + $Scoreboard.update_values(strokes_per_level, PAR) + $Scoreboard.show() + + +func close_scoreboard(): + $Scoreboard.hide() -- cgit From 0e6b438cbb8d894c5d4d31a50a6e87a89d230b91 Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 02:33:03 +0200 Subject: very scuffed detection which way the die faces the mapping of the buffs might be incorrect --- godot/scenes/Die.gd | 82 ++++++++++++++++++++++++++++++++++++++++++++++----- godot/scenes/Die.tscn | 32 +++++++++++++++----- 2 files changed, 100 insertions(+), 14 deletions(-) (limited to 'godot') diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 407f248..62d1d99 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -1,4 +1,4 @@ -extends Spatial +extends RigidBody const Game = preload("res://scenes/Game.gd") @@ -14,6 +14,10 @@ var dragging = false var mouse_origin = Vector2(0,0) var dice_launch_force = 0 +var mat +var target_bounce = 1 +var previous_bounciness = 0 + var _game: Game = null # Called when the node enters the scene tree for the first time. @@ -22,9 +26,13 @@ func _ready(): $CamRoot/Horizontal/Vertical/Camera.add_exception(self) $CamRoot.set_as_toplevel(true) _game = get_node("/root/Game") + mat = get_physics_material_override() + previous_bounciness = mat.get_bounce() + ball() + -func _input(event): +func _input(event): if event is InputEventKey: if event.scancode == KEY_TAB: if event.is_pressed(): @@ -51,11 +59,8 @@ func _input(event): elif dragging and not event.pressed: dragging = false Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) - - - - - + + func _physics_process(delta): camrot_v = clamp(camrot_v, cam_v_min, cam_v_max) @@ -69,6 +74,9 @@ func _physics_process(delta): dice_is_moving = true else: dice_is_moving = false + + if angular_velocity.length() == 0: + get_upwards_side() last_frame_position = Vector3(translation.x, translation.y, translation.x) @@ -76,3 +84,63 @@ func _physics_process(delta): # Called every frame. 'delta' is the elapsed time since the previous frame. #func _process(delta): # pass + + +""" +BUFFS +""" + +func get_upwards_side(): + var forward = -global_transform.basis.z + + var up = forward.angle_to(Vector3.UP) + var down = forward.angle_to(Vector3.DOWN) + var left = forward.angle_to(Vector3.LEFT) + var right = forward.angle_to(Vector3.RIGHT) + var forw = forward.angle_to(Vector3.FORWARD) + var back = forward.angle_to(Vector3.BACK) + + # 0 = ball, 1 = phase, 2 = bounce + var dictionary = { + up: 0, + down: 1, + left: 2, + right: 0, + forw: 1, + back: 2 + } + + var smallest = dictionary.keys().min() + return dictionary[smallest] + + +func extra_stroke(): + _game.revoke_stroke() + + +func bounciness(): + mat.set_bounce(target_bounce) + + +func bounciness_revert(): + mat.set_bounce(previous_bounciness) + + +func phase(): + set_collision_layer_bit(2, false) + + +func phase_revert(): + set_collision_layer_bit(2, true) + + +func ball(): + $BallShape.show() + $BallShape.set_process(true) + $BallShape.disabled = false + + +func ball_revert(): + $BallShape.hide() + $BallShape.set_process(false) + $BallShape.disabled = true diff --git a/godot/scenes/Die.tscn b/godot/scenes/Die.tscn index 813f7b7..2d73734 100644 --- a/godot/scenes/Die.tscn +++ b/godot/scenes/Die.tscn @@ -1,8 +1,13 @@ -[gd_scene load_steps=5 format=2] +[gd_scene load_steps=8 format=2] [ext_resource path="res://scenes/Die.gd" type="Script" id=1] [ext_resource path="res://assets/game_objects/W8baseColor_Mat.material" type="Material" id=2] +[sub_resource type="PhysicsMaterial" id=3] + +[sub_resource type="ConvexPolygonShape" id=2] +points = PoolVector3Array( -0.0850063, -0.879389, -0.0282584, 0.0288993, 0.929375, 0.0289349, 0.0288993, 0.929375, -0.0289349, 0.929367, -0.0289314, 0.0289314, -0.0289784, -0.0289338, 0.929338, -0.929369, 0.028929, 0.028929, 0.0288993, -0.0289349, -0.929375, 0.0288993, -0.929375, 0.0289349, -0.0850063, 0.0282584, -0.879389, 0.0282247, 0.084959, 0.87945, 0.857489, 0.056933, -0.0855785, -0.879454, -0.0849424, 0.0282549, 0.0570775, -0.885814, -0.0571088, 0.0570775, -0.0571088, 0.885814, -0.0571532, 0.885743, -0.0571043, -0.0571532, 0.885743, 0.0571043, 0.0570775, 0.0571088, -0.885814, -0.885806, -0.057097, -0.057097, 0.879446, 0.0849494, 0.0282572, 0.857335, -0.0571018, -0.0855632, -0.0571532, 0.0571043, 0.885743, -0.0571532, -0.885743, 0.0571043, -0.885806, 0.057097, -0.057097, -0.0571532, -0.0571043, -0.885743, 0.0570775, 0.0571088, 0.885814, -0.0571532, -0.885743, -0.0571043, -0.0571532, 0.0571043, -0.885743, 0.0570775, -0.885814, 0.0571088, 0.0570775, 0.885814, 0.0571088, -0.0571532, -0.0571043, 0.885743, -0.885806, 0.057097, 0.057097, 0.0570775, 0.885814, -0.0571088, 0.0570775, -0.0571088, -0.885814, 0.857335, -0.0571018, 0.0855632, -0.885806, -0.057097, 0.057097, 0.857489, 0.056933, 0.0855785, 0.929425, 0.0287513, -0.0289333, 0.929367, -0.0289314, -0.0289314, -0.0289784, 0.929338, -0.0289338, 0.0288993, 0.0289349, -0.929375, -0.929369, -0.028929, -0.028929, -0.0283039, -0.87942, -0.0849561, 0.084933, 0.0282608, 0.879461, -0.0289784, 0.929338, 0.0289338, -0.0289784, -0.0289338, -0.929338, -0.0289784, 0.0289338, 0.929338, 0.0288993, -0.0289349, 0.929375, 0.0288993, -0.929375, -0.0289349, -0.0289784, -0.929338, 0.0289338, -0.929369, 0.028929, -0.028929, -0.0283039, 0.0849561, -0.87942, -0.879454, -0.0282549, 0.0849424, 0.879512, 0.0280816, 0.0849558, 0.879446, -0.0849494, -0.0282572, -0.0282988, -0.822574, 0.141805, 0.17021, 0.0280745, -0.794261, -0.879454, 0.0849424, -0.0282549, -0.0283039, 0.87942, 0.0849561, 0.0282247, 0.87945, -0.084959, 0.0282247, -0.084959, -0.87945, -0.879454, -0.0282549, -0.0849424, -0.0850063, 0.0282584, 0.879389, -0.0850063, 0.879389, 0.0282584, 0.084933, -0.0282608, 0.879461 ) + [sub_resource type="ArrayMesh" id=1] resource_name = "W8_Cone" surfaces/0 = { @@ -18,19 +23,32 @@ surfaces/0 = { "vertex_count": 68 } -[sub_resource type="ConvexPolygonShape" id=2] -points = PoolVector3Array( -0.0850063, -0.879389, -0.0282584, 0.0288993, 0.929375, 0.0289349, 0.0288993, 0.929375, -0.0289349, 0.929367, -0.0289314, 0.0289314, -0.0289784, -0.0289338, 0.929338, -0.929369, 0.028929, 0.028929, 0.0288993, -0.0289349, -0.929375, 0.0288993, -0.929375, 0.0289349, -0.0850063, 0.0282584, -0.879389, 0.0282247, 0.084959, 0.87945, 0.857489, 0.056933, -0.0855785, -0.879454, -0.0849424, 0.0282549, 0.0570775, -0.885814, -0.0571088, 0.0570775, -0.0571088, 0.885814, -0.0571532, 0.885743, -0.0571043, -0.0571532, 0.885743, 0.0571043, 0.0570775, 0.0571088, -0.885814, -0.885806, -0.057097, -0.057097, 0.879446, 0.0849494, 0.0282572, 0.857335, -0.0571018, -0.0855632, -0.0571532, 0.0571043, 0.885743, -0.0571532, -0.885743, 0.0571043, -0.885806, 0.057097, -0.057097, -0.0571532, -0.0571043, -0.885743, 0.0570775, 0.0571088, 0.885814, -0.0571532, -0.885743, -0.0571043, -0.0571532, 0.0571043, -0.885743, 0.0570775, -0.885814, 0.0571088, 0.0570775, 0.885814, 0.0571088, -0.0571532, -0.0571043, 0.885743, -0.885806, 0.057097, 0.057097, 0.0570775, 0.885814, -0.0571088, 0.0570775, -0.0571088, -0.885814, 0.857335, -0.0571018, 0.0855632, -0.885806, -0.057097, 0.057097, 0.857489, 0.056933, 0.0855785, 0.929425, 0.0287513, -0.0289333, 0.929367, -0.0289314, -0.0289314, -0.0289784, 0.929338, -0.0289338, 0.0288993, 0.0289349, -0.929375, -0.929369, -0.028929, -0.028929, -0.0283039, -0.87942, -0.0849561, 0.084933, 0.0282608, 0.879461, -0.0289784, 0.929338, 0.0289338, -0.0289784, -0.0289338, -0.929338, -0.0289784, 0.0289338, 0.929338, 0.0288993, -0.0289349, 0.929375, 0.0288993, -0.929375, -0.0289349, -0.0289784, -0.929338, 0.0289338, -0.929369, 0.028929, -0.028929, -0.0283039, 0.0849561, -0.87942, -0.879454, -0.0282549, 0.0849424, 0.879512, 0.0280816, 0.0849558, 0.879446, -0.0849494, -0.0282572, -0.0282988, -0.822574, 0.141805, 0.17021, 0.0280745, -0.794261, -0.879454, 0.0849424, -0.0282549, -0.0283039, 0.87942, 0.0849561, 0.0282247, 0.87945, -0.084959, 0.0282247, -0.084959, -0.87945, -0.879454, -0.0282549, -0.0849424, -0.0850063, 0.0282584, 0.879389, -0.0850063, 0.879389, 0.0282584, 0.084933, -0.0282608, 0.879461 ) +[sub_resource type="SphereShape" id=4] + +[sub_resource type="SphereMesh" id=5] [node name="Die" type="RigidBody"] +collision_mask = 3 +physics_material_override = SubResource( 3 ) script = ExtResource( 1 ) -[node name="Cone" type="MeshInstance" parent="."] +[node name="CollisionShape" type="CollisionShape" parent="."] +shape = SubResource( 2 ) + +[node name="Cone" type="MeshInstance" parent="CollisionShape"] mesh = SubResource( 1 ) -skeleton = NodePath("../..") +skeleton = NodePath("../../..") material/0 = null -[node name="CollisionShape" type="CollisionShape" parent="."] -shape = SubResource( 2 ) +[node name="BallShape" type="CollisionShape" parent="."] +visible = false +shape = SubResource( 4 ) +disabled = true + +[node name="Ball" type="MeshInstance" parent="BallShape"] +mesh = SubResource( 5 ) +skeleton = NodePath("../..") +material/0 = null [node name="CamRoot" type="Spatial" parent="."] -- cgit From 8b932533e6d25a80f185bae299351426a4ca157e Mon Sep 17 00:00:00 2001 From: IcECreAm777 <31211782+IcECreAm777@users.noreply.github.com> Date: Sun, 17 Jul 2022 02:44:50 +0200 Subject: post game behaviour --- godot/scenes/Die.gd | 28 +++++----------------------- godot/scenes/Game.gd | 38 ++++++++++++++++++++++++-------------- godot/scripts/GoalTriggerBox.gd | 2 +- 3 files changed, 30 insertions(+), 38 deletions(-) (limited to 'godot') diff --git a/godot/scenes/Die.gd b/godot/scenes/Die.gd index 62d1d99..93d3bfa 100644 --- a/godot/scenes/Die.gd +++ b/godot/scenes/Die.gd @@ -28,11 +28,13 @@ func _ready(): _game = get_node("/root/Game") mat = get_physics_material_override() previous_bounciness = mat.get_bounce() - - ball() func _input(event): + if _game.is_post_game(): + _game.next_level() + return + if event is InputEventKey: if event.scancode == KEY_TAB: if event.is_pressed(): @@ -91,27 +93,7 @@ BUFFS """ func get_upwards_side(): - var forward = -global_transform.basis.z - - var up = forward.angle_to(Vector3.UP) - var down = forward.angle_to(Vector3.DOWN) - var left = forward.angle_to(Vector3.LEFT) - var right = forward.angle_to(Vector3.RIGHT) - var forw = forward.angle_to(Vector3.FORWARD) - var back = forward.angle_to(Vector3.BACK) - - # 0 = ball, 1 = phase, 2 = bounce - var dictionary = { - up: 0, - down: 1, - left: 2, - right: 0, - forw: 1, - back: 2 - } - - var smallest = dictionary.keys().min() - return dictionary[smallest] + return 0 func extra_stroke(): diff --git a/godot/scenes/Game.gd b/godot/scenes/Game.gd index 56acb04..f24219e 100644 --- a/godot/scenes/Game.gd +++ b/godot/scenes/Game.gd @@ -6,6 +6,7 @@ const PAR = [1,2,3,4,5,6,7,8,9] # level control var current_level_id = 0 var levels = [] +var post_game = false # stroke control var current_strokes = 0 @@ -39,25 +40,14 @@ func _on_ResumeButton_pressed(): Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) -func load_next_level(): - levels[current_level_id].hide() - current_level_id = current_level_id + 1 - +func end_level(): # save current strokes and reset strokes_per_level[current_level_id] = current_strokes current_strokes = 0 - if current_level_id >= NUM_LEVELS: - # TODO load main menu - return - - # load next level - levels[current_level_id].show() + post_game = true - $Scoreboard.update_values(strokes_per_level, PAR) - $Scoreboard.show() - - # TODO teleport player back + open_scoreboard() func add_stroke(): @@ -75,3 +65,23 @@ func open_scoreboard(): func close_scoreboard(): $Scoreboard.hide() + + +func is_post_game(): + return post_game + + +func next_level(): + post_game = false + + levels[current_level_id].hide() + current_level_id = current_level_id + 1 + + if current_level_id >= NUM_LEVELS: + # TODO load main menu + return + + # load next level + levels[current_level_id].show() + + close_scoreboard() diff --git a/godot/scripts/GoalTriggerBox.gd b/godot/scripts/GoalTriggerBox.gd index 42345d8..6e1034b 100644 --- a/godot/scripts/GoalTriggerBox.gd +++ b/godot/scripts/GoalTriggerBox.gd @@ -18,5 +18,5 @@ func _on_Area2_body_entered(body: RigidBody): if body == null: return - loader.load_next_level() + loader.end_level() -- cgit