-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
99 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
extends RefCounted | ||
class_name LevelPatterns | ||
|
||
const patterns: Dictionary = { | ||
0: [19, 18], | ||
1: [17, 18], | ||
2: [19, 17], | ||
3: [17, 17, 17], | ||
4: [19, 19], | ||
} | ||
|
||
const levels: Dictionary = { | ||
0: { | ||
level_patterns = [0, 1, 2], | ||
random = false, | ||
}, | ||
1: { | ||
level_patterns = [3, 4], | ||
random = true, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
extends Node | ||
class_name PatternGen | ||
|
||
var level_queue: LevelQueue | ||
|
||
var patterns_struct: Dictionary = {} | ||
var level_queue := LevelQueue.new() | ||
|
||
const MAX_LEVEL := 10 | ||
|
||
var level := 0: | ||
enum SpawnMode {TUTORIAL, DEBUG, QUEUE} | ||
|
||
@export var level := 0: | ||
set(val): | ||
level = clamp(0, MAX_LEVEL, val) | ||
|
||
|
||
func _ready(): | ||
add_pattern() | ||
add_patterns() | ||
|
||
func upgrade_level(): | ||
level += 1 | ||
|
||
func downgrade_level(): | ||
level -= 1 | ||
|
||
func next_pattern() -> Dictionary: | ||
func next_pattern() -> int: | ||
if level_queue.length <= 0: | ||
add_patterns() | ||
return level_queue.next_item() | ||
|
||
func initialize_patterns(): | ||
# Example initialization of patterns_struct | ||
patterns_struct = { | ||
1: [ {name = "Easy Pattern", difficulty = 1}], | ||
2: [ {name = "Medium Pattern", difficulty = 2}, {name = "Another Medium Pattern", difficulty = 2}], | ||
# Add more levels and patterns as needed | ||
} | ||
|
||
func add_pattern(): | ||
var current_level_patterns = patterns_struct[level] | ||
if current_level_patterns != null: | ||
for pattern in current_level_patterns: | ||
level_queue.add_item(pattern) | ||
func add_patterns(): | ||
var current_level: Dictionary = LevelPatterns.levels[level] | ||
if current_level.get("random"): | ||
var p: int = current_level.level_patterns.pick_random() | ||
for i in LevelPatterns.patterns[p]: | ||
level_queue.add_item(i) | ||
else: | ||
for pattern in current_level.level_patterns: | ||
for type in LevelPatterns.patterns[pattern]: | ||
level_queue.add_item(type) | ||
|
||
func update_patterns_based_on_level(): | ||
# Clear the queue to avoid mixing patterns from different levels | ||
level_queue.items_queue.clear() | ||
# Add patterns corresponding to the current level | ||
add_pattern() | ||
add_patterns() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters