Skip to content

Commit

Permalink
temp: ...
Browse files Browse the repository at this point in the history
  • Loading branch information
akorzunin committed Sep 15, 2024
1 parent 6f1258b commit 48951ef
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/components/controls/LoopControls.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ func update_controlled_node():

func pass_next_node(node: Collider):
if controlledNode != null \
and game_state_manager.game_state != GameStateManager.GameState.GAME_END \
and not controlledNode.angle_good \
and node.mesh_icosahedron == controlledNode:
controlledNode.angle_good = true
game_progress.log_tts(controlledNode.icosahedron.spwan_time, controlledNode.currnt_type)
update_controlled_node()

func _input(event: InputEvent) -> void:
Expand Down Expand Up @@ -84,6 +86,8 @@ func game_over_rot(scene: StringName, t: Quaternion):
func handle_game_over_input(event: InputEvent, is_inverted: bool):
if event.is_action_pressed('ui_accept'):
Utils.set_scene(self, 'LoopScene')
elif event.is_action_pressed('ui_cancel'):
game_over_rot('MenuScene', Quats.menu_quat_left())
sfx_player.on_action_select.emit()
elif Op.xor(is_inverted, event.is_action_pressed('ui_left')):
game_over_rot('MenuScene', Quats.menu_quat_left())
Expand Down
1 change: 1 addition & 0 deletions src/components/controls/MenuControls.gd
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func call_menu_action():
if action == "menu_level_select":
menuSpawner.open_menu_section(
controlledNode,
# R:TODO check for actual levels avaliable
{items = LevelPatterns.get_menu_levels(G.settings.MAX_LEVEL)}
)
return
Expand Down
1 change: 1 addition & 0 deletions src/components/gui/DebugStatsContainer.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class_name DebugStatsContainer
@onready var nodes_passed: DebugLabel = $VBoxContainer/NodesPassed
@onready var time_passed: DebugLabel = $VBoxContainer/TimePassed
@onready var current_level: DebugLabel = $VBoxContainer/CurrentLevel
@onready var time_to_solve: DebugLabel = $VBoxContainer/TimeToSolve

var width_percent := 20

Expand Down
6 changes: 6 additions & 0 deletions src/components/gui/DebugStatsContainer.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ text = ": 0"
script = ExtResource("3_ows3h")
label_text = "0"

[node name="TimeToSolve" type="Label" parent="VBoxContainer"]
layout_mode = 2
text = ": 0"
script = ExtResource("3_ows3h")
label_text = "0"

[node name="DebugStatsTimer" type="Timer" parent="."]
unique_name_in_owner = true
autostart = true
11 changes: 10 additions & 1 deletion src/components/level_system/LevelPatterns.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const patterns: Dictionary = {
6: [15, 1, 2],
7: [12, 8],
8: [6, 16],
# level 3

}

const levels: Dictionary = {
Expand All @@ -23,19 +25,26 @@ const levels: Dictionary = {
1: {
level_patterns = [3, 4, 5],
random = true,
# game_speed = 20,
# game_speed_diff = 2,
},
2: {
level_patterns = [6, 7, 8],
random = true,
# game_speed = 10,
# game_speed_diff = 2,

},
3: {
level_patterns = [],
random = true,
}
}

static func is_level_up(nodes: int, level: int) -> bool:
match level:
0: return nodes > 10
1: return nodes > 20
2: return nodes > 40
_: return false

const tutorial_item := {
Expand Down
6 changes: 6 additions & 0 deletions src/components/level_system/PatternGen.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ func next_pattern() -> int:

func add_patterns():
var current_level: Dictionary = LevelPatterns.levels[level]
if not current_level.get("level_patterns"):
queue_item(randi_range(0, 19))
return
if current_level.get("random"):
var random_pattern: int = current_level.level_patterns.pick_random()
queue_pattern(random_pattern)
Expand All @@ -42,3 +45,6 @@ func add_patterns():
func queue_pattern(pattern: int):
for type in LevelPatterns.patterns[pattern]:
level_queue.add_item(type)

func queue_item(item: int):
level_queue.add_item(clampi(item, 0, 19))
2 changes: 2 additions & 0 deletions src/models/icosahedron/components/Icosahedron.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class_name Icosahedron
@export var scaling_enabled := true
@export var show_face_numbers := false
@export var shader_type: int
@export var spwan_time: float

var scale_timer: ScaleTimer

Expand All @@ -31,6 +32,7 @@ func _ready() -> void:
cut_plane.hide()
if scale_timer:
scale_timer.timeout.connect(_on_scale_tick)
spwan_time = Time.get_unix_time_from_system()

func _on_scale_tick() -> void:
if scaling_enabled:
Expand Down
2 changes: 1 addition & 1 deletion src/models/icosahedron/shaders/outline_v1.gdshader
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void vertex() {

void fragment() {
if (enable) {
//ALBEDO = color.rgb;
// ALBEDO = color.rgb;
ALBEDO = vec3(0.);
ALPHA = 0.9;
} else {
Expand Down
1 change: 0 additions & 1 deletion src/scenes/init/MenuScene.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var game_settings
func init(props: Dictionary):
if props.get("game_settings"):
game_settings = props.game_settings
G.reload_settings.emit()
return self

func deinit():
Expand Down

0 comments on commit 48951ef

Please sign in to comment.