Add debug mode

This commit is contained in:
Moe Poi ~ 2023-10-29 14:56:40 +07:00
parent 9834279628
commit 88b4495d9a
7 changed files with 47 additions and 5 deletions

View file

@ -4,6 +4,8 @@ extends Node2D
var config_path = "res://scripts/stages/1/config.gd"
var config = load(config_path).new()
var game_data = load("res://scripts/data/data.gd").new()
@onready var duration = $Duration
var data = {
@ -14,6 +16,10 @@ var data = {
}
func _ready():
# Debug Mode
if game_data.load_data()['debug']:
data['resource'] = 999999
# Set Duration & Start Timer
duration.wait_time = config.game['duration']
duration.start()

View file

@ -3,6 +3,8 @@ extends Node2D
var config_path = "res://scripts/stages/2/config.gd"
var config = load(config_path).new()
var game_data = load("res://scripts/data/data.gd").new()
@onready var duration = $Duration
var data = {
@ -13,6 +15,10 @@ var data = {
}
func _ready():
# Debug Mode
if game_data.load_data()['debug']:
data['resource'] = 999999
# Set Duration & Start Timer
duration.wait_time = config.game['duration']
duration.start()

View file

@ -3,6 +3,8 @@ extends Node2D
var config_path = "res://scripts/stages/3/config.gd"
var config = load(config_path).new()
var game_data = load("res://scripts/data/data.gd").new()
@onready var duration = $Duration
var data = {
@ -13,6 +15,10 @@ var data = {
}
func _ready():
# Debug Mode
if game_data.load_data()['debug']:
data['resource'] = 999999
# Set Duration & Start Timer
duration.wait_time = config.game['duration']
duration.start()

View file

@ -3,6 +3,8 @@ extends Node2D
var config_path = "res://scripts/stages/4/config.gd"
var config = load(config_path).new()
var game_data = load("res://scripts/data/data.gd").new()
@onready var duration = $Duration
var data = {
@ -13,6 +15,10 @@ var data = {
}
func _ready():
# Debug Mode
if game_data.load_data()['debug']:
data['resource'] = 999999
# Set Duration & Start Timer
duration.wait_time = config.game['duration']
duration.start()

View file

@ -3,6 +3,8 @@ extends Node2D
var config_path = "res://scripts/stages/5/config.gd"
var config = load(config_path).new()
var game_data = load("res://scripts/data/data.gd").new()
@onready var duration = $Duration
var data = {
@ -13,6 +15,10 @@ var data = {
}
func _ready():
# Debug Mode
if game_data.load_data()['debug']:
data['resource'] = 999999
# Set Duration & Start Timer
duration.wait_time = config.game['duration']
duration.start()

View file

@ -3,6 +3,8 @@ extends Node2D
var config_path = "res://scripts/stages/6/config.gd"
var config = load(config_path).new()
var game_data = load("res://scripts/data/data.gd").new()
@onready var duration = $Duration
var data = {
@ -13,6 +15,10 @@ var data = {
}
func _ready():
# Debug Mode
if game_data.load_data()['debug']:
data['resource'] = 999999
# Set Duration & Start Timer
duration.wait_time = config.game['duration']
duration.start()

View file

@ -2,13 +2,13 @@ extends Control
var game_data = load("res://scripts/data/data.gd").new()
var data = game_data.load_data()
@onready var timer = $Timer
var debug_state = 0
func _ready():
var data = game_data.load_data()
if data == null:
game_data.save_data({
"debug": false,
@ -22,10 +22,16 @@ func _on_logo_pressed():
debug_state += 1
if debug_state >= 6:
game_data.save_data({
"debug": true,
"unlocked_stage": 6
})
if data['debug']:
game_data.save_data({
"debug": false,
"unlocked_stage": 1
})
else:
game_data.save_data({
"debug": true,
"unlocked_stage": 6
})
func _on_timer_timeout():
debug_state = 0