Skip to content

Commit

Permalink
Add exercise duration selector
Browse files Browse the repository at this point in the history
Add hold cue to pushups
Add VAL Winter Games workout
  • Loading branch information
mgschwan committed Feb 14, 2021
1 parent 4a7c248 commit 8e34958
Show file tree
Hide file tree
Showing 28 changed files with 472 additions and 42 deletions.
Binary file added 3d models/sidequest_logo.blend
Binary file not shown.
Binary file added 3d models/sidequest_logo.blend1
Binary file not shown.
24 changes: 23 additions & 1 deletion godot_project/SongSelector.gd
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ func update_song_list():
else:
element.is_set = false
element.set_song_info("empty",null)
get_node("NextPage").print_info("[b]\n Page %d/%d[b]"%[page+1,pages])

get_node("NextPage").print_info("[b]Next Page\n\n Current: %d/%d[b]"%[page+1,pages])





func get_song_infos(songs):
var infos = {}
Expand Down Expand Up @@ -133,6 +138,16 @@ func next_page():
print ("Next page: %d"%page)
update_song_list()

func previous_page():
print ("Page: %d, Songs: %d, Pages: %d"%[page, len(song_list), int(ceil(len(song_list)/6.0))])
page -= 1
if page < 0:
page = max(0,int(ceil(len(song_list)/6.0))-1)

print ("Previous page: %d"%page)
update_song_list()



var frame_idx = 0
# Called every frame. 'delta' is the elapsed time since the previous frame.
Expand All @@ -154,6 +169,11 @@ func _on_level_block_selected(filename, difficulty, level_number):
func _on_NextPage_touched():
next_page()

func _on_PreviousPage_touched():
previous_page()



var difficulties = {"easy":0,"medium": 1, "hard": 2, "ultra": 3, "auto": -1,}
func _on_DifficultyButtons_difficulty_selected(difficulty):
if difficulty in difficulties:
Expand Down Expand Up @@ -211,3 +231,5 @@ func _on_PauseButton_pressed():

func _on_RemoveButton_button_up():
print ("Remove Button UP")


12 changes: 12 additions & 0 deletions godot_project/SongSelector.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ script = ExtResource( 4 )
transform = Transform( 1, 5.68434e-14, 0, 0, 1, 0, 0, 2.84217e-14, 1, 0, -0.0374871, -8.19306e-09 )
shape = SubResource( 1 )

[node name="PreviousPage" parent="." instance=ExtResource( 3 )]
transform = Transform( -0.216506, -0.5, -5.4639e-09, 0, -4.37114e-08, 0.25, -0.125, 0.866025, 9.46375e-09, 1.7626, -0.563472, 0.123467 )
defaultext = "[b][i]Previous page[/i][/b]"

[node name="StaticBody" type="StaticBody" parent="PreviousPage"]
script = ExtResource( 4 )

[node name="CollisionShape" type="CollisionShape" parent="PreviousPage/StaticBody"]
transform = Transform( 1, 5.68434e-14, 0, 0, 1, 0, 0, 2.84217e-14, 1, 0, -0.0374871, -8.19306e-09 )
shape = SubResource( 1 )

[node name="DifficultyButtons" parent="." instance=ExtResource( 5 )]
transform = Transform( -8.40732e-08, 0, 1.92337, 0, 1.92337, 0, -1, 0, -4.37114e-08, -1.64334, -0.15069, 0.0439329 )

Expand Down Expand Up @@ -226,6 +237,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 0, 1 )
[connection signal="selected" from="SongBlocks/Element3" to="." method="_on_level_block_selected"]
[connection signal="selected" from="SongBlocks/Element5" to="." method="_on_level_block_selected"]
[connection signal="touched" from="NextPage/StaticBody" to="." method="_on_NextPage_touched"]
[connection signal="touched" from="PreviousPage/StaticBody" to="." method="_on_PreviousPage_touched"]
[connection signal="difficulty_selected" from="DifficultyButtons" to="." method="_on_DifficultyButtons_difficulty_selected"]
[connection signal="button_down" from="Viewport/CanvasLayer/StartButton" to="." method="_on_Button_pressed"]
[connection signal="button_down" from="Viewport/CanvasLayer/FreeplayButton" to="." method="_on_FreeplayButton_pressed"]
Expand Down
33 changes: 24 additions & 9 deletions godot_project/VRScene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,18 @@ func _on_level_finished_actual(valid_end):
GameVariables.override_beatmap = false

print ("Level is finished ... remove from scene")
GameVariables.game_result = level.get_points()
GameVariables.game_result["level_finished"] = valid_end

GameVariables.game_result = gu.build_workout_statistic(GameVariables.level_statistics_data)
GameVariables.game_result["level_finished"] = valid_end

#merge the data from the level
var tmp_points = level.get_points()
GameVariables.game_result["points"] = tmp_points["points"]
GameVariables.game_result["vrw_score"] = tmp_points["vrw_score"]
GameVariables.game_result["hits"] = tmp_points["hits"]
GameVariables.game_result["max_hits"] = tmp_points["max_hits"]
GameVariables.game_result["time"] = tmp_points["time"]

last_points = GameVariables.game_result["points"]
total_points += GameVariables.game_result["points"]
last_played = GameVariables.game_result["time"]
Expand Down Expand Up @@ -490,11 +499,15 @@ func _on_level_finished_actual(valid_end):
level = null

var evaluator = AchievementEvaluator.new(GameVariables.achievement_checks)
var achievements = evaluator.evaluate_achievements(GameVariables.game_result)
print ("Player achieved: %s"%str(achievements))
GameVariables.game_result["achievements"] = achievements

var achievement_list = evaluator.evaluate_achievements(GameVariables.game_result)
GameVariables.game_result["achievements"] = achievement_list
print ("Player achieved: %s"%str(achievement_list))
var achievements = gu.load_persistent_config(GameVariables.achievement_file_location)
for a in achievement_list:
achievements[a["achievement_identifier"]] = {}
gu.store_persistent_config(GameVariables.achievement_file_location, achievements)


levelselect = levelselect_blueprint.instance()

levelselect.translation = Vector3(0,0,0)
Expand Down Expand Up @@ -650,13 +663,15 @@ func get_persisting_parameters():
"game/override_beats": ProjectSettings.get("game/override_beats"),
"game/bpm": ProjectSettings.get("game/bpm"),
"game/exercise/stand/windmill" : ProjectSettings.get("game/exercise/stand/windmill"),
"game/default_playlist" : GameVariables.current_song
}

"game/default_playlist" : GameVariables.current_song,
"game/exercise_duration_avg" :ProjectSettings.get("game/exercise_duration_avg")
}

var game_statistics = {}
func _on_Area_level_selected(filename, diff, num):
if level == null:
GameVariables.current_song = filename
GameVariables.exercise_duration_avg = ProjectSettings.get("game/exercise_duration_avg")
#Store the parameters that should survive a restart
gu.store_persistent_config(GameVariables.config_file_location, get_persisting_parameters())

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion godot_project/default_env_red.tres
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ panorama = ExtResource( 1 )
background_mode = 3
background_sky = SubResource( 1 )
background_sky_orientation = Basis( -4.37114e-08, -0.970296, -0.24192, 0, 0.24192, -0.970296, 1, -4.2413e-08, -1.05747e-08 )
ambient_light_color = Color( 0.996078, 0.6, 0.6, 1 )
ambient_light_color = Color( 0.721569, 0.698039, 1, 1 )
ambient_light_energy = 1.3
ambient_light_sky_contribution = 0.0
fog_color = Color( 0, 0, 0, 1 )
Expand Down
8 changes: 8 additions & 0 deletions godot_project/scenes/AchievementDisplay.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[gd_scene load_steps=2 format=2]

[ext_resource path="res://scripts/AchievementDisplay.gd" type="Script" id=1]

[node name="AchievementDisplay" type="Spatial"]
script = ExtResource( 1 )

[node name="Anchor" type="Spatial" parent="."]
22 changes: 19 additions & 3 deletions godot_project/scenes/Levelselect.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=66 format=2]
[gd_scene load_steps=69 format=2]

[ext_resource path="res://fonts/droid-sans/DroidSans.ttf" type="DynamicFontData" id=1]
[ext_resource path="res://BlackTheme.theme" type="Theme" id=2]
Expand Down Expand Up @@ -38,6 +38,9 @@
[ext_resource path="res://scenes/ConnectPad.tscn" type="PackedScene" id=36]
[ext_resource path="res://scenes/SideQuestConnection.tscn" type="PackedScene" id=37]
[ext_resource path="res://scenes/SideQuestPanel.tscn" type="PackedScene" id=38]
[ext_resource path="res://scenes/AchievementDisplay.tscn" type="PackedScene" id=39]
[ext_resource path="res://scenes/NumberEntryWidget.tscn" type="PackedScene" id=40]
[ext_resource path="res://scenes/SimpleText.tscn" type="PackedScene" id=41]

[sub_resource type="CylinderShape" id=1]
radius = 0.2
Expand Down Expand Up @@ -284,6 +287,10 @@ transform = Transform( -1.54463e-07, -0.974043, 0.226362, -7.37582e-08, -0.22636
default_text = "VRWorkout"
bbtext = true

[node name="AchievementDisplay" parent="MainText" instance=ExtResource( 39 )]
transform = Transform( 1, -7.10543e-15, -2.22045e-16, -1.06581e-14, 1, 0, 1.77636e-15, 0, 1, -1.07779, -2.38419e-07, -1.08917 )
row_elements = 5

[node name="text_panel" parent="MainText" instance=ExtResource( 18 )]
transform = Transform( 1.1, 0, -9.32587e-16, 0, 1, 0, 1.70974e-15, 0, 0.6, 6.68336e-11, -0.00769687, 0.00178862 )

Expand All @@ -305,12 +312,12 @@ visible = false
transform = Transform( 1.2, 0, 0, 0, 1, 9.9729e-15, 0, -1.66215e-14, 0.6, 0, -0.0072, 0.00167334 )

[node name="Viewport" type="Viewport" parent="Stats"]
size = Vector2( 512, 256 )
size = Vector2( 512, 384 )
msaa = 6
render_target_v_flip = true

[node name="StatisticsPanel" parent="Stats/Viewport" instance=ExtResource( 22 )]
scale = Vector2( 0.75, 0.75 )
scale = Vector2( 0.8, 0.95 )

[node name="Display" type="MeshInstance" parent="Stats"]
transform = Transform( 1, -5.96046e-08, 0, 0, 1, 2.98023e-08, 0, 2.98023e-08, 1, -0.0226345, -0.0291336, 1.13608 )
Expand Down Expand Up @@ -505,6 +512,14 @@ transform = Transform( 1, 4.76837e-07, 0, -1.86265e-09, 1, -3.33067e-16, -5.3290
mesh = SubResource( 15 )
material/0 = SubResource( 17 )

[node name="ExerciseDuration" parent="SettingsCarousel/Switchboard" instance=ExtResource( 40 )]
transform = Transform( -4.37114e-09, 0.1, -4.37114e-09, 0, -4.37114e-09, -0.1, -0.1, -4.37114e-09, 1.91069e-16, -0.774999, 1.21161, 1.73877 )
min_v = 5

[node name="description" parent="SettingsCarousel/Switchboard/ExerciseDuration" instance=ExtResource( 41 )]
transform = Transform( 0.6, 7.10543e-14, 1.69407e-21, -7.10543e-14, 0.6, -3.58179e-21, -5.0822e-21, -3.58179e-21, 0.6, 0, 0, -2.78321 )
text = "[center]Average exercise duration in seconds[/center]"

[node name="Exercises" type="Spatial" parent="SettingsCarousel"]
transform = Transform( 1.19249e-08, 0, -1, 0, 1, 0, 1, 0, 1.19249e-08, -1.19209e-07, 0, -0.225055 )

Expand Down Expand Up @@ -838,6 +853,7 @@ transform = Transform( 2.84861e-14, 1, -1.62921e-07, -1, 1.91069e-15, -2.06632e-
[connection signal="toggled" from="SettingsCarousel/Switchboard/SprintSwitch" to="." method="_on_SprintSwitch_toggled"]
[connection signal="toggled" from="SettingsCarousel/Switchboard/KneesaverSwitch" to="." method="_on_KneesaverSwitch_toggled"]
[connection signal="toggled" from="SettingsCarousel/Switchboard/YogaSwitch" to="." method="_on_YogaSwitch_toggled"]
[connection signal="value_changed" from="SettingsCarousel/Switchboard/ExerciseDuration" to="." method="_on_ExerciseDuration_value_changed"]
[connection signal="selected" from="SettingsCarousel/Exercises/ExerciseCollection" to="." method="_on_ExerciseCollection_selected"]
[connection signal="selected" from="SettingsCarousel/Exercises/PresetCollector" to="." method="_on_PresetCollector_selected"]
[connection signal="selected" from="SettingsCarousel/Exercises/PresetCollector4" to="." method="_on_PresetCollector_selected"]
Expand Down
50 changes: 50 additions & 0 deletions godot_project/scenes/NumberEntry.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[gd_scene load_steps=3 format=2]

[ext_resource path="res://themes/vrworkout_theme.theme" type="Theme" id=1]
[ext_resource path="res://scripts/NumberEntry.gd" type="Script" id=2]

[node name="NumberEntry" type="Node2D"]
script = ExtResource( 2 )

[node name="ColorRect" type="ColorRect" parent="."]
margin_right = 168.0
margin_bottom = 315.0
color = Color( 0, 0, 0, 1 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Plus" type="Button" parent="."]
margin_right = 64.0
margin_bottom = 92.0
theme = ExtResource( 1 )
text = "+"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="Minus" type="Button" parent="."]
margin_top = 164.0
margin_right = 64.0
margin_bottom = 256.0
theme = ExtResource( 1 )
text = "-"
__meta__ = {
"_edit_use_anchors_": false
}

[node name="RichTextLabel" type="RichTextLabel" parent="."]
margin_left = 11.0
margin_top = 114.0
margin_right = 51.0
margin_bottom = 142.0
theme = ExtResource( 1 )
bbcode_enabled = true
bbcode_text = "[center]20[/center]"
text = "20"
__meta__ = {
"_edit_use_anchors_": false
}

[connection signal="pressed" from="Plus" to="." method="_on_Plus_pressed"]
[connection signal="pressed" from="Minus" to="." method="_on_Minus_pressed"]
58 changes: 58 additions & 0 deletions godot_project/scenes/NumberEntryWidget.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[gd_scene load_steps=9 format=2]

[ext_resource path="res://scenes/NumberEntry.tscn" type="PackedScene" id=1]
[ext_resource path="res://scripts/TouchableViewport.gd" type="Script" id=2]
[ext_resource path="res://scripts/NumberEntryWidget.gd" type="Script" id=3]
[ext_resource path="res://scripts/ConnectPadInput.gd" type="Script" id=4]

[sub_resource type="PlaneMesh" id=1]
size = Vector2( 1, 4 )

[sub_resource type="ViewportTexture" id=2]
flags = 12
viewport_path = NodePath("Viewport")

[sub_resource type="SpatialMaterial" id=3]
resource_local_to_scene = true
flags_unshaded = true
albedo_texture = SubResource( 2 )

[sub_resource type="BoxShape" id=4]
margin = 0.001
extents = Vector3( 0.5, 0.1, 2 )

[node name="Spatial" type="Spatial"]
script = ExtResource( 3 )

[node name="Viewport" type="Viewport" parent="."]
size = Vector2( 64, 256 )
msaa = 6
render_target_v_flip = true
script = ExtResource( 2 )

[node name="NumberEntry" parent="Viewport" instance=ExtResource( 1 )]

[node name="ConnectPadInput" type="StaticBody" parent="."]
script = ExtResource( 4 )

[node name="tl_marker" type="Spatial" parent="ConnectPadInput"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0, -2 )

[node name="bl_marker" type="Spatial" parent="ConnectPadInput"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0, 2 )

[node name="tr_marker" type="Spatial" parent="ConnectPadInput"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5, 0, -2 )

[node name="MeshInstance" type="MeshInstance" parent="ConnectPadInput"]
mesh = SubResource( 1 )
material/0 = SubResource( 3 )

[node name="CollisionShape" type="CollisionShape" parent="ConnectPadInput"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.096831, 0 )
shape = SubResource( 4 )

[connection signal="value_changed" from="Viewport/NumberEntry" to="." method="_on_NumberEntry_value_changed"]
[connection signal="view_changed" from="Viewport/NumberEntry" to="." method="_on_NumberEntry_view_changed"]
[connection signal="interface_release" from="ConnectPadInput" to="Viewport" method="_on_ConnectPadInput_interface_release"]
[connection signal="interface_touch" from="ConnectPadInput" to="Viewport" method="_on_ConnectPadInput_interface_touch"]
42 changes: 42 additions & 0 deletions godot_project/scenes/SimpleText.tscn
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[gd_scene load_steps=6 format=2]

[ext_resource path="res://themes/vrworkout_theme.theme" type="Theme" id=1]
[ext_resource path="res://scripts/SimpleText.gd" type="Script" id=2]

[sub_resource type="PlaneMesh" id=1]
size = Vector2( 4, 2 )

[sub_resource type="ViewportTexture" id=2]
flags = 12
viewport_path = NodePath("Viewport")

[sub_resource type="SpatialMaterial" id=3]
resource_local_to_scene = true
flags_unshaded = true
albedo_texture = SubResource( 2 )

[node name="Spatial" type="Spatial"]
script = ExtResource( 2 )

[node name="Viewport" type="Viewport" parent="."]
size = Vector2( 256, 128 )
msaa = 6
render_target_v_flip = true
render_target_update_mode = 3

[node name="ColorRect" type="ColorRect" parent="Viewport"]
margin_right = 256.0
margin_bottom = 128.0
color = Color( 0, 0, 0, 1 )

[node name="RichTextLabel" type="RichTextLabel" parent="Viewport"]
margin_right = 256.0
margin_bottom = 512.0
theme = ExtResource( 1 )
bbcode_enabled = true
bbcode_text = "Default Text"
text = "Default Text"

[node name="MeshInstance" type="MeshInstance" parent="."]
mesh = SubResource( 1 )
material/0 = SubResource( 3 )

0 comments on commit 8e34958

Please sign in to comment.