music no longer hard coded
This commit is contained in:
parent
3b52ec2cbf
commit
1e0202864f
16 changed files with 151 additions and 101 deletions
|
@ -1,84 +1,6 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[sub_resource type="GDScript" id=5]
|
||||
script/source = "extends CanvasLayer
|
||||
|
||||
#Console by hazel
|
||||
|
||||
export var max_lines: int = 10
|
||||
export var opacity: float = 0.5
|
||||
|
||||
onready var console: Label = $Console
|
||||
onready var line_edit = $LineEdit
|
||||
|
||||
var lines: int = 0
|
||||
|
||||
var time: float = 0.0
|
||||
var n: int = 0
|
||||
|
||||
var debug = false
|
||||
|
||||
func _ready():
|
||||
#Auto do debug when playtesting
|
||||
if not OS.is_debug_build():
|
||||
console.visible = false
|
||||
debug = false
|
||||
else:
|
||||
console.visible = false
|
||||
debug = true
|
||||
$Console/Panel.modulate.a = opacity
|
||||
console.modulate.a = opacity
|
||||
|
||||
func _physics_process(delta):
|
||||
#DEBUG
|
||||
if debug == true:
|
||||
#Show console
|
||||
if Input.is_action_just_pressed(\"debug_show\"):
|
||||
console.visible = !console.visible
|
||||
#Restart scene
|
||||
if Input.is_action_just_pressed(\"debug_restart\"):
|
||||
if Game.score > Game.high_score: Game.high_score = Game.score
|
||||
Game.score = 0
|
||||
Game.golds = 0
|
||||
Game.stars = [false,false,false,false,false]
|
||||
Game.shards = 0
|
||||
Game.arrows = 0
|
||||
Game.lives = 2
|
||||
Game.ac_climb.stop()
|
||||
get_tree().reload_current_scene()
|
||||
#Move player to mouse
|
||||
if Input.is_action_pressed(\"debug_move_player\"):
|
||||
Game.get_map().get_node(\"Player\").position = get_viewport().get_mouse_position()
|
||||
Debug.print(get_viewport().get_mouse_position())
|
||||
#Debug 1
|
||||
if Input.is_action_just_pressed(\"debug_1\"):
|
||||
Game.change_map(load(\"res://maps/level_select.tscn\"))
|
||||
#Debug 2
|
||||
if Input.is_action_just_pressed(\"debug_2\"):
|
||||
var save = ConfigFile.new()
|
||||
save.load(str(\"user://file\") + str(1) + str(\".pr\"))
|
||||
Game.score = save.get_value(str(Game.current_level),\"Score\",0)
|
||||
|
||||
func print(text):
|
||||
lines += 1
|
||||
if lines > 1:
|
||||
console.text += \"\\n\"
|
||||
if lines > 10:
|
||||
var n = console.text.find(\"\\n\")
|
||||
var t = console.text
|
||||
t.erase(0, n+1)
|
||||
lines -= 1
|
||||
console.text = t + str(text)
|
||||
else:
|
||||
console.text += str(text)
|
||||
|
||||
|
||||
func _on_visible_toggled(button_pressed):
|
||||
if button_pressed:
|
||||
console.visible = true
|
||||
else:
|
||||
console.visible = false
|
||||
"
|
||||
[ext_resource path="res://scripts/debug.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="InputEventAction" id=4]
|
||||
action = "toggle_console"
|
||||
|
@ -88,7 +10,7 @@ shortcut = SubResource( 4 )
|
|||
|
||||
[node name="Debug" type="CanvasLayer"]
|
||||
layer = 128
|
||||
script = SubResource( 5 )
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="Console" type="Label" parent="."]
|
||||
anchor_right = 1.0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue