Skip to content

Commit

Permalink
Merge branch 'main' into dev-cutekibry
Browse files Browse the repository at this point in the history
  • Loading branch information
cutekibry committed Jan 28, 2024
2 parents 7eda11b + ee03aa1 commit dc39198
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
13 changes: 10 additions & 3 deletions levels/base_level/base_level.gd
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var req_pos = [] # Array[int]
var chap_id : int
var lvl_id : int

const I_NUMBER = ["I","II","III","VI","V"]

const DATA := [
[
Expand Down Expand Up @@ -70,7 +71,7 @@ func init(_chap_id: int, _lvl_id: int) -> void:
var choices = count(DATA[chap_id][lvl_id][2].replace(" ", "").replace("X", "*"))


$HUDs/Title.set_text("%d-%d %s" % [chap_id + 1, lvl_id + 1, lvl_name])
$HUDs/Title.set_text("%s-%d %s" % [I_NUMBER[chap_id], lvl_id + 1, lvl_name])



Expand Down Expand Up @@ -208,5 +209,11 @@ func _on_next_level_button_pressed():
queue_free()

func _on_replay_button_pressed():
for card_base: CardBase in $CardBases.get_children():
card_base.reset_all_card_position()
var new_level = BaseLevel.instantiate()
new_level.init(chap_id, lvl_id)
get_tree().root.add_child(new_level)
queue_free()
#print(get_tree().current_scene)
#get_tree().reload_current_scene()
#for card_base: CardBase in $CardBases.get_children():
#card_base.reset_all_card_position()
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func init(chapter_id: int, level_id : int, pos : Vector2, type : int) -> void :

var txt
if type == 0:
txt = str(chapter_id + 1)
txt = "I" + str(chapter_id + 1)
else:
txt = str(level_id + 1)
set_word(txt)
Expand Down
4 changes: 2 additions & 2 deletions levels/chapter_menu/level_menu/level_menu.gd
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ extends Node2D

const CHAP_NAMES = ["=P", "Add", "Multiply", "()", "Equal?"]


const I_NUMBER = ["I","II","III","VI","V"]

const LevelButton := preload("res://levels/chapter_menu/level_menu/level_button/level_button.tscn")
const BaseLevel := preload("res://levels/base_level/base_level.tscn")
Expand All @@ -21,7 +21,7 @@ func init(chap_id : int, lvl_num : int) -> void:
if lvl_num == -1:
lvl_num = len(BaseLevel.instantiate().DATA[chap_id])

$Title.set_text("Ch." + str(chap_id + 1) + " " + CHAP_NAMES[chap_id])
$Title.set_text("Ch." + I_NUMBER[chap_id] + " " + CHAP_NAMES[chap_id])

chapter_id = chap_id
for level_id in range(0, lvl_num):
Expand Down
13 changes: 10 additions & 3 deletions objects/main_menu/main_menu.gd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
extends AnimatedSprite2D

var ChapterMenu = preload("res://levels/chapter_menu/chapter_menu.tscn")

const ChapterMenu = preload("res://levels/chapter_menu/chapter_menu.tscn")
const BaseLevel := preload("res://levels/base_level/base_level.tscn")
# Called when the node enters the scene tree for the first time.
func _ready():
$start_button/AnimatedSprite2D.play()
Expand All @@ -18,5 +18,12 @@ func _on_animation_finished():


func _on_start_button_pressed():
get_tree().root.add_child(ChapterMenu.instantiate())
var base_level := BaseLevel.instantiate()

# print(chap_id, lvl_id)

base_level.init(0, 0)
get_tree().root.add_child(base_level)
queue_free()
#get_tree().root.add_child(ChapterMenu.instantiate())
#queue_free()

0 comments on commit dc39198

Please sign in to comment.