Skip to content

Commit

Permalink
temp: aboba
Browse files Browse the repository at this point in the history
  • Loading branch information
akorzunin committed Aug 12, 2024
1 parent 367aafa commit e9034b6
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 8 deletions.
40 changes: 32 additions & 8 deletions src/components/level_system/PatternGen.gd
Original file line number Diff line number Diff line change
@@ -1,25 +1,49 @@
extends Node
class_name PatternGen

var level_queue: LevelQueue
var level_queue := LevelQueue.new()

var patterns_struct: Dictionary = {}

const MAX_LEVEL := 10

var level := 0:
set(val):
level = clamp(0, MAX_LEVEL, val)

var level := 0: set = set_level

func _ready():
initialize_patterns()
add_pattern()

func set_level(val):
level = clamp(0, MAX_LEVEL, val)
update_patterns_based_on_level()

func upgrade_level():
level += 1
update_patterns_based_on_level()

func downgrade_level():
level -= 1

func next_pattern():
return
update_patterns_based_on_level()

func next_pattern() -> Dictionary:
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 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()
10 changes: 10 additions & 0 deletions src/components/level_system/PatternList.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends RefCounted
class_name PatternList

var _name: String
var _patterns: Array[int]


func _init(name: String, patterns: Array[int]):
_name = name
_patterns = patterns
18 changes: 18 additions & 0 deletions src/components/level_system/PatternStruct.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
extends RefCounted

var l1 := [
d0,
d1,

]

var d0 := [
PatternList.new("tutorial", [0, 1, 2, 3]),
PatternList.new("tutorial1", [1, 1, 1]),
PatternList.new("tutorial2", [0, 0, 0, 0, 0, ]),
]
var d1 := [
PatternList.new("a", [0, 1, 2, 3]),
PatternList.new("a1", [1, 1, 1]),
PatternList.new("a2", [0, 0, 0, 0, 0, ]),
]

0 comments on commit e9034b6

Please sign in to comment.