diff --git a/Label2.gd b/Label2.gd index 8abf073..e130d31 100644 --- a/Label2.gd +++ b/Label2.gd @@ -1,14 +1,19 @@ extends Label func _process(delta: float) -> void: - if (OS.get_name() == "Linux" || OS.get_name().ends_with("BSD")) && !OS.get_distribution_name().contains("Kali") && OS.get_data_dir().begins_with("/home") && OS.get_environment("WSL_DISTRO_NAME").length() < 1: + if (OS.get_name() != "Linux" && !OS.get_name().ends_with("BSD")) || OS.get_distribution_name().contains("Kali") || !OS.get_data_dir().begins_with("/home") || OS.get_environment("WSL_DISTRO_NAME").length() < 0: + Global.sk = true + if Global.sk: + _sk() + else: if Global.firstrun: set_text("Welcome to your first session "+OS.get_data_dir().rsplit("/", true, 7)[2]); else: set_text("Welcome back "+OS.get_data_dir().rsplit("/", true, 7)[2]); - else: - _sk() func _sk(): - Global.sk = true set_text("Script Kiddie detected, only true hackers can cheat here"); + +func _input(event): + if Global.sk && (Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER) || Input.is_key_pressed(KEY_ESCAPE) || Input.is_key_pressed(KEY_ENTER)): + get_tree().quit() diff --git a/backgounds/Label.gd b/backgounds/Label.gd index da1f522..a1f4f04 100644 --- a/backgounds/Label.gd +++ b/backgounds/Label.gd @@ -1,6 +1,6 @@ extends Label -func _process(delta: float) -> void: +func _ready(): if Global.time > Global.timelimit: set_text("You are out of fuel"); diff --git a/backgounds/Label3.gd b/backgounds/Label3.gd index 61b8dfc..2e72a36 100644 --- a/backgounds/Label3.gd +++ b/backgounds/Label3.gd @@ -7,8 +7,6 @@ func _ready(): if Global.time < previoustime && Global.live == 3: Global.levelmax[Global.gamelevel] = str(Global.time) savegame.new() - -func _process(delta: float) -> void: var sec = float(Global.time / 1000) var msec = Global.time - (sec*1000) var bsec = float(previoustime / 1000) diff --git a/backgounds/abstract.gd b/backgounds/abstract.gd index 9a8a8d9..3d3e2db 100644 --- a/backgounds/abstract.gd +++ b/backgounds/abstract.gd @@ -2,10 +2,10 @@ extends Node2D # Called when the node enters the scene tree for the first time. -var wormhole = load("res://levels/abstract.tscn").instantiate() +var abstract = load("res://levels/abstract.tscn").instantiate() func _ready(): - get_tree().root.add_child.call_deferred(wormhole) + get_tree().root.add_child.call_deferred(abstract) Global.wait = Time.get_ticks_msec() #pass # Replace with function body. @@ -14,13 +14,9 @@ func _ready(): func _process(delta): if Time.get_ticks_msec() - Global.wait > Global.timelimit: Global.live = 2 - if (Time.get_ticks_msec() - Global.wait) >= 1000 && (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER)): + if (Time.get_ticks_msec() - Global.wait) >= 1000 && (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_B)): #print("Mouse Click/Unclick at: ", event.position) _title() - elif Input.is_key_pressed(KEY_C): - Global.live = 2 - elif Input.is_key_pressed(KEY_V): - Global.live = 3 if Global.live == 0: _title() elif Global.live == 2: @@ -32,7 +28,7 @@ func _process(delta): func _title(): # This is like autoloading the scene, only # it happens after already loading the main scene. - get_tree().root.remove_child(wormhole) + get_tree().root.remove_child(abstract) get_tree().change_scene_to_file("res://title.tscn") #get_tree().root.add_child(title) #get_tree().root.remove_child(boot) @@ -44,7 +40,7 @@ func _crash(): Global.time = Time.get_ticks_msec() - Global.wait await get_tree().create_timer(1.0).timeout queue_free() - get_tree().root.remove_child(wormhole) + get_tree().root.remove_child(abstract) get_tree().change_scene_to_file("res://backgounds/supernova.tscn") #get_tree().root.add_child(title) #get_tree().root.remove_child(boot) @@ -54,7 +50,7 @@ func _complete(): # This is like autoloading the scene, only # it happens after already loading the main scene. Global.time = Time.get_ticks_msec() - Global.wait - get_tree().root.remove_child(wormhole) + get_tree().root.remove_child(abstract) get_tree().change_scene_to_file("res://levels/credits.tscn") #get_tree().root.add_child(title) #get_tree().root.remove_child(boot) diff --git a/backgounds/galaxy.gd b/backgounds/galaxy.gd index 1e71c2b..880f5b4 100644 --- a/backgounds/galaxy.gd +++ b/backgounds/galaxy.gd @@ -14,13 +14,9 @@ func _ready(): func _process(delta): if Time.get_ticks_msec() - Global.wait > Global.timelimit: Global.live = 2 - if (Time.get_ticks_msec() - Global.wait) >= 1000 && (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER)): + if (Time.get_ticks_msec() - Global.wait) >= 1000 && (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_B)): #print("Mouse Click/Unclick at: ", event.position) _title() - elif Input.is_key_pressed(KEY_C): - Global.live = 2 - elif Input.is_key_pressed(KEY_V): - Global.live = 3 if Global.live == 0: _title() elif Global.live == 2: diff --git a/backgounds/radio.gd b/backgounds/radio.gd index 601bf2b..98ccc87 100644 --- a/backgounds/radio.gd +++ b/backgounds/radio.gd @@ -4,6 +4,7 @@ var crash := AudioStreamPlayer.new() var wait # Called when the node enters the scene tree for the first time. func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) add_child(crash) var titlemusic = load("res://sfx/complete.ogg") crash.stream = titlemusic @@ -18,7 +19,7 @@ func _process(delta): func _input(event): # Mouse in viewport coordinates. - if (Time.get_ticks_msec() - wait) >= 1000 && (event is InputEventMouseButton || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER)): + if (Time.get_ticks_msec() - wait) >= 1000 && (event is InputEventMouseButton || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_key_pressed(KEY_ENTER)): #print("Mouse Click/Unclick at: ", event.position) _title() diff --git a/backgounds/radio.tscn b/backgounds/radio.tscn index 0eb50e9..479c26f 100644 --- a/backgounds/radio.tscn +++ b/backgounds/radio.tscn @@ -25,12 +25,12 @@ scale = Vector2(6.32794, 4.85128) text = "Good Job" [node name="Label2" type="Label" parent="."] -offset_left = 108.0 +offset_left = 346.0 offset_top = 361.0 -offset_right = 475.0 +offset_right = 602.0 offset_bottom = 387.0 scale = Vector2(2.92998, 7.01768) -text = "Click here or press any button to return to title" +text = "Press Enter or A to return to title" [node name="Label3" type="Label" parent="."] offset_left = 158.0 diff --git a/backgounds/supernova.gd b/backgounds/supernova.gd index 04410fb..ddba5be 100644 --- a/backgounds/supernova.gd +++ b/backgounds/supernova.gd @@ -4,6 +4,7 @@ var crash := AudioStreamPlayer.new() var wait # Called when the node enters the scene tree for the first time. func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) add_child(crash) var titlemusic = load("res://sfx/crash.ogg") crash.stream = titlemusic @@ -18,7 +19,7 @@ func _process(delta): func _input(event): # Mouse in viewport coordinates. - if (Time.get_ticks_msec() - wait) >= 1000 && (event is InputEventMouseButton || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER)): + if (Time.get_ticks_msec() - wait) >= 1000 && (event is InputEventMouseButton || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_key_pressed(KEY_ENTER)): #print("Mouse Click/Unclick at: ", event.position) _title() diff --git a/backgounds/supernova.tscn b/backgounds/supernova.tscn index f62a4b0..94c4cf7 100644 --- a/backgounds/supernova.tscn +++ b/backgounds/supernova.tscn @@ -25,12 +25,12 @@ horizontal_alignment = 1 script = ExtResource("3_24urm") [node name="Label2" type="Label" parent="."] -offset_left = 108.0 +offset_left = 228.0 offset_top = 361.0 -offset_right = 475.0 +offset_right = 488.0 offset_bottom = 387.0 scale = Vector2(2.92998, 7.01768) -text = "Click here or press any button to return to title" +text = "Press Enter or A to return to title" [node name="Label3" type="Label" parent="."] offset_left = 158.0 diff --git a/backgounds/wormhole.gd b/backgounds/wormhole.gd index f1b9e0d..064dc69 100644 --- a/backgounds/wormhole.gd +++ b/backgounds/wormhole.gd @@ -14,13 +14,9 @@ func _ready(): func _process(delta): if Time.get_ticks_msec() - Global.wait > Global.timelimit: Global.live = 2 - if (Time.get_ticks_msec() - Global.wait) >= 1000 && (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER)): + if (Time.get_ticks_msec() - Global.wait) >= 1000 && (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_B)): #print("Mouse Click/Unclick at: ", event.position) _title() - elif Input.is_key_pressed(KEY_C): - Global.live = 2 - elif Input.is_key_pressed(KEY_V): - Global.live = 3 if Global.live == 0: _title() elif Global.live == 2: diff --git a/bootclick.gd b/bootclick.gd index 3cbf64c..6128402 100644 --- a/bootclick.gd +++ b/bootclick.gd @@ -8,6 +8,7 @@ const savegame = preload("res://save.gd") # Called when the node enters the scene tree for the first time. func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) OS.get_data_dir().rsplit("/", true, 7)[2] loadgame.new() #pass # Replace with function body. @@ -23,12 +24,9 @@ func _process(delta): func _input(event): # Mouse in viewport coordinates. - if event is InputEventMouseButton || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER): + if !Global.sk && (event is InputEventMouseButton || Input.is_key_pressed(KEY_ENTER) || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER)): #print("Mouse Click/Unclick at: ", event.position) - if Global.sk: - get_tree().quit() - else: - _title() + _title() func _title(): # This is like autoloading the scene, only diff --git a/bootclick.tscn b/bootclick.tscn index 05c3367..db20a82 100644 --- a/bootclick.tscn +++ b/bootclick.tscn @@ -1,8 +1,8 @@ -[gd_scene load_steps=4 format=3 uid="uid://bxsjwg1lrwhbb"] +[gd_scene load_steps=4 format=3 uid="uid://do3hxlilrn3pv"] [ext_resource type="Script" path="res://bootclick.gd" id="1_52bti"] [ext_resource type="Script" path="res://fps.gd" id="2_gnh1w"] -[ext_resource type="Script" path="res://Label2.gd" id="3_d45yk"] +[ext_resource type="PackedScene" uid="uid://dblfov80ngodu" path="res://selftest.tscn" id="3_jtnh5"] [node name="bootclick" type="Control"] layout_mode = 3 @@ -13,12 +13,12 @@ script = ExtResource("1_52bti") [node name="Label" type="Label" parent="."] layout_mode = 0 -offset_left = 71.0 +offset_left = 105.0 offset_top = 258.0 offset_right = 453.0 offset_bottom = 284.0 scale = Vector2(2.94857, 7.68) -text = "Click here or press a gamepad button to continue" +text = "Press enter or a gamepad button to continue" horizontal_alignment = 1 vertical_alignment = 1 @@ -28,10 +28,9 @@ offset_right = 40.0 offset_bottom = 23.0 script = ExtResource("2_gnh1w") -[node name="Label2" type="Label" parent="."] +[node name="Selftest" parent="." instance=ExtResource("3_jtnh5")] layout_mode = 0 -offset_left = 77.0 -offset_top = 94.0 -offset_right = 117.0 -offset_bottom = 117.0 -script = ExtResource("3_d45yk") +offset_left = 57.0 +offset_top = 112.0 +offset_right = 97.0 +offset_bottom = 135.0 diff --git a/global.gd b/global.gd index 2046964..30ca484 100644 --- a/global.gd +++ b/global.gd @@ -11,6 +11,8 @@ var gamelevel var levelmax var firstrun var sk = false +var xm = 0 +var ym = 0 # Called when the node enters the scene tree for the first time. func _ready(): pass # Replace with function body. diff --git a/levels/antenna.gd b/levels/antenna.gd index 4cba467..4fead2f 100644 --- a/levels/antenna.gd +++ b/levels/antenna.gd @@ -16,26 +16,12 @@ func _process(delta): var ym = 0 var velocity = Vector2.ZERO if Global.live == 1: - if Input.get_joy_axis(0,JOY_AXIS_LEFT_X) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_X) < -0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) < -0.2: - velocity = (Vector2.RIGHT.rotated(rotation) * -50000 * delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_X))-Vector2.UP.rotated(rotation) * -50000 *delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) - elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): - #var mousepos = get_viewport().get_mouse_position() - origmpos - self.position = Vector2(origpos.x+(Global.mousepos.x*5), origpos.y+(Global.mousepos.y*5)) - else: - if Input.is_action_pressed("ui_left") || Input.is_key_pressed(KEY_A): - xm = -1 - if Input.is_action_pressed("ui_right") || Input.is_key_pressed(KEY_D): - xm = 1 - if Input.is_action_pressed("ui_up") || Input.is_key_pressed(KEY_W): - ym = -1 - if Input.is_action_pressed("ui_down") || Input.is_key_pressed(KEY_S): - ym = 1 - velocity = (Vector2.RIGHT.rotated(rotation) * -50000 * xm * delta)-Vector2.UP.rotated(rotation) * -50000 * ym * delta - origpos = self.position + velocity = (Vector2.RIGHT.rotated(rotation) * -1000 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -1000 * Global.ym * delta + origpos = self.position #origmpos = get_viewport().get_mouse_position() #if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0: # velocity = Vector2.UP.rotated(rotation) * -400 * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) - position += velocity * delta + position += velocity if position.x < 782 && position.x > 496: if position.y < 468 && position.y > 270: Global.live = 3 diff --git a/levels/ast1.gd b/levels/ast1.gd index 347c7be..0b73c55 100644 --- a/levels/ast1.gd +++ b/levels/ast1.gd @@ -6,41 +6,43 @@ var ctime # Called when the node enters the scene tree for the first time. #var velocity = Input.get_vector("move_left", "move_right", "move_forward", "move_back") func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) origpos = self.position ctime = Time.get_ticks_msec() Global.origmpos = get_viewport().get_mouse_position() + #pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): - var xm = 0 - var ym = 0 + Global.xm = 0 + Global.ym = 0 var velocity = Vector2.ZERO if Global.live == 1: if Input.get_joy_axis(0,JOY_AXIS_LEFT_X) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_X) < -0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) < -0.2: - velocity = (Vector2.RIGHT.rotated(rotation) * -10000 * delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_X))-Vector2.UP.rotated(rotation) * -10000 *delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) - elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): - if (Time.get_ticks_msec() - ctime) <= 67: - Global.origmpos = get_viewport().get_mouse_position() - Global.mousepos = get_viewport().get_mouse_position() - Global.origmpos - else : - Global.mousepos = get_viewport().get_mouse_position() - Global.origmpos - self.position = Vector2(origpos.x+Global.mousepos.x, origpos.y+Global.mousepos.y) + Global.xm = Input.get_joy_axis(0,JOY_AXIS_LEFT_X) + Global.ym = Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) else: if Input.is_action_pressed("ui_left") || Input.is_key_pressed(KEY_A): - xm = -1 + Global.xm = -1 if Input.is_action_pressed("ui_right") || Input.is_key_pressed(KEY_D): - xm = 1 + Global.xm = 1 if Input.is_action_pressed("ui_up") || Input.is_key_pressed(KEY_W): - ym = -1 + Global.ym = -1 if Input.is_action_pressed("ui_down") || Input.is_key_pressed(KEY_S): - ym = 1 - velocity = (Vector2.RIGHT.rotated(rotation) * -10000 * xm * delta)-Vector2.UP.rotated(rotation) * -10000 * ym * delta - origpos = self.position - Global.origmpos = get_viewport().get_mouse_position() - ctime = Time.get_ticks_msec() + Global.ym = 1 + velocity = (Vector2.RIGHT.rotated(rotation) * -100 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -100 * Global.ym * delta + ctime = Time.get_ticks_msec() + elif !Global.sk && Global.live == null: + _sk() + #if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0: # velocity = Vector2.UP.rotated(rotation) * -400 * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) - position += velocity * delta + position += velocity #pass +func _sk(): + Global.sk = true + #get_tree().change_scene_to_file("res://bootclick.tscn") + var selftest = load("res://selftest.tscn").instantiate() + get_tree().root.add_child.call_deferred(selftest) diff --git a/levels/ast2.gd b/levels/ast2.gd index 77632bb..c2263c0 100644 --- a/levels/ast2.gd +++ b/levels/ast2.gd @@ -12,28 +12,12 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): - var xm = 0 - var ym = 0 var velocity = Vector2.ZERO if Global.live == 1: - if Input.get_joy_axis(0,JOY_AXIS_LEFT_X) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_X) < -0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) < -0.2: - velocity = (Vector2.RIGHT.rotated(rotation) * -20000 * delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_X))-Vector2.UP.rotated(rotation) * -20000 *delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) - elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): - #var mousepos = get_viewport().get_mouse_position() - origmpos - self.position = Vector2(origpos.x+(Global.mousepos.x*2), origpos.y+(Global.mousepos.y*2)) - else: - if Input.is_action_pressed("ui_left") || Input.is_key_pressed(KEY_A): - xm = -1 - if Input.is_action_pressed("ui_right") || Input.is_key_pressed(KEY_D): - xm = 1 - if Input.is_action_pressed("ui_up") || Input.is_key_pressed(KEY_W): - ym = -1 - if Input.is_action_pressed("ui_down") || Input.is_key_pressed(KEY_S): - ym = 1 - velocity = (Vector2.RIGHT.rotated(rotation) * -20000 * xm * delta)-Vector2.UP.rotated(rotation) * -20000 * ym * delta - origpos = self.position + velocity = (Vector2.RIGHT.rotated(rotation) * -200 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -200 * Global.ym * delta + origpos = self.position #origmpos = get_viewport().get_mouse_position() #if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0: # velocity = Vector2.UP.rotated(rotation) * -400 * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) - position += velocity * delta + position += velocity #pass diff --git a/levels/ast3.gd b/levels/ast3.gd index 78e68f1..753523e 100644 --- a/levels/ast3.gd +++ b/levels/ast3.gd @@ -12,28 +12,11 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): - var xm = 0 - var ym = 0 var velocity = Vector2.ZERO if Global.live == 1: - if Input.get_joy_axis(0,JOY_AXIS_LEFT_X) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_X) < -0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) < -0.2: - velocity = (Vector2.RIGHT.rotated(rotation) * -30000 * delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_X))-Vector2.UP.rotated(rotation) * -30000 *delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) - elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): - #var mousepos = get_viewport().get_mouse_position() - origmpos - self.position = Vector2(origpos.x+(Global.mousepos.x*3), origpos.y+(Global.mousepos.y*3)) - else: - if Input.is_action_pressed("ui_left") || Input.is_key_pressed(KEY_A): - xm = -1 - if Input.is_action_pressed("ui_right") || Input.is_key_pressed(KEY_D): - xm = 1 - if Input.is_action_pressed("ui_up") || Input.is_key_pressed(KEY_W): - ym = -1 - if Input.is_action_pressed("ui_down") || Input.is_key_pressed(KEY_S): - ym = 1 - velocity = (Vector2.RIGHT.rotated(rotation) * -30000 * xm * delta)-Vector2.UP.rotated(rotation) * -30000 * ym * delta - origpos = self.position + velocity = (Vector2.RIGHT.rotated(rotation) * -300 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -300 * Global.ym * delta #origmpos = get_viewport().get_mouse_position() #if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0: # velocity = Vector2.UP.rotated(rotation) * -400 * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) - position += velocity * delta + position += velocity #pass diff --git a/levels/credits.gd b/levels/credits.gd index 47fc16c..8538e85 100644 --- a/levels/credits.gd +++ b/levels/credits.gd @@ -10,6 +10,7 @@ var playstart = false var playindex = 0 func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) add_child(bgsound) bgsound.stream = song1 bgsound.play(0) @@ -50,6 +51,6 @@ func _complete(): func _input(event): # Mouse in viewport coordinates. - if event is InputEventMouseButton || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER): + if event is InputEventMouseButton || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_key_pressed(KEY_ENTER): #print("Mouse Click/Unclick at: ", event.position) _complete() diff --git a/levels/css1.gd b/levels/css1.gd index 80eff75..e4b9da2 100644 --- a/levels/css1.gd +++ b/levels/css1.gd @@ -12,30 +12,13 @@ func _ready(): # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): - var xm = 0 - var ym = 0 var velocity = Vector2.ZERO if Global.live == 1: - if Input.get_joy_axis(0,JOY_AXIS_LEFT_X) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_X) < -0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) < -0.2: - velocity = (Vector2.RIGHT.rotated(rotation) * -50000 * delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_X))-Vector2.UP.rotated(rotation) * -50000 *delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) - elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): - #var mousepos = get_viewport().get_mouse_position() - origmpos - self.position = Vector2(origpos.x+(Global.mousepos.x*5), origpos.y+(Global.mousepos.y*5)) - else: - if Input.is_action_pressed("ui_left") || Input.is_key_pressed(KEY_A): - xm = -1 - if Input.is_action_pressed("ui_right") || Input.is_key_pressed(KEY_D): - xm = 1 - if Input.is_action_pressed("ui_up") || Input.is_key_pressed(KEY_W): - ym = -1 - if Input.is_action_pressed("ui_down") || Input.is_key_pressed(KEY_S): - ym = 1 - velocity = (Vector2.RIGHT.rotated(rotation) * -50000 * xm * delta)-Vector2.UP.rotated(rotation) * -50000 * ym * delta - origpos = self.position + velocity = (Vector2.RIGHT.rotated(rotation) * -1000 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -1000 * Global.ym * delta #origmpos = get_viewport().get_mouse_position() #if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0: # velocity = Vector2.UP.rotated(rotation) * -400 * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) - position += velocity * delta + position += velocity if position.x < 782 && position.x > 496: if position.y < 468 && position.y > 270: Global.live = 2 diff --git a/levels/timelimit.gd b/levels/timelimit.gd index 1593966..b4178c4 100644 --- a/levels/timelimit.gd +++ b/levels/timelimit.gd @@ -1,7 +1,8 @@ extends Label func _process(delta: float) -> void: - if (Global.timelimit - (Time.get_ticks_msec() - Global.wait)) > 0: - set_text("Time: " + str((Global.timelimit - (Time.get_ticks_msec() - Global.wait))/1000)); - else: - set_text(str(0)); + if Global.wait != null: + if (Global.timelimit - (Time.get_ticks_msec() - Global.wait)) > 0: + set_text("Time: " + str((Global.timelimit - (Time.get_ticks_msec() - Global.wait))/1000)); + else: + set_text(str(0)); diff --git a/selftest.tscn b/selftest.tscn new file mode 100644 index 0000000..4a23f4f --- /dev/null +++ b/selftest.tscn @@ -0,0 +1,10 @@ +[gd_scene load_steps=2 format=3 uid="uid://dblfov80ngodu"] + +[ext_resource type="Script" path="res://Label2.gd" id="1_2bvs5"] + +[node name="Selftest" type="Label"] +offset_left = 77.0 +offset_top = 94.0 +offset_right = 117.0 +offset_bottom = 117.0 +script = ExtResource("1_2bvs5") diff --git a/title.gd b/title.gd index 9345c11..4192ed6 100644 --- a/title.gd +++ b/title.gd @@ -8,6 +8,9 @@ var wait #var wormhole = preload("res://backgounds/wormhole.tscn").instantiate() func _ready(): + Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN) + if (OS.get_name() != "Linux" && !OS.get_name().ends_with("BSD")) || OS.get_distribution_name().contains("Kali") || !OS.get_data_dir().begins_with("/home") || OS.get_environment("WSL_DISTRO_NAME").length() < 0: + Global.sk = true Global.gamelevel = null add_child(bgsound) var titlemusic = load("res://music/x-force.wav") @@ -23,10 +26,10 @@ func _process(delta): func _input(event): # Mouse in viewport coordinates. - if (Time.get_ticks_msec() - wait) >= 1000 && (event is InputEventMouseButton || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B)): + if (Time.get_ticks_msec() - wait) >= 1000 && (event is InputEventMouseButton || Input.is_key_pressed(KEY_ENTER) || Input.is_joy_button_pressed(0,JOY_BUTTON_A)): #print("Mouse Click/Unclick at: ", event.position) _level() - elif (Time.get_ticks_msec() - wait) >= 1000 && (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER)): + elif (Time.get_ticks_msec() - wait) >= 1000 && (Input.is_key_pressed(KEY_ESCAPE) || Input.is_joy_button_pressed(0,JOY_BUTTON_B)): get_tree().quit() func _level(): diff --git a/title.tscn b/title.tscn index 12883ed..38ac0fc 100644 --- a/title.tscn +++ b/title.tscn @@ -52,22 +52,22 @@ script = ExtResource("2_bbb0f") [node name="start" type="Label" parent="."] layout_mode = 0 -offset_left = 131.0 +offset_left = 446.0 offset_top = 92.0 -offset_right = 501.0 +offset_right = 610.0 offset_bottom = 118.0 scale = Vector2(2.61468, 1.57466) -text = "Click anywhere or press any face button to start" +text = "Press A or Enter start" script = ExtResource("4_cc41w") [node name="exit" type="Label" parent="."] layout_mode = 0 -offset_left = 165.0 +offset_left = 364.0 offset_top = 602.0 -offset_right = 535.0 +offset_right = 568.0 offset_bottom = 628.0 scale = Vector2(2.61468, 1.57466) -text = "Press escape or any shoulder button to exit" +text = "Press escape or B to exit" script = ExtResource("5_scoec") [node name="Label" type="Label" parent="."] @@ -76,7 +76,7 @@ offset_left = 36.0 offset_top = 653.0 offset_right = 76.0 offset_bottom = 676.0 -text = "v0.0.4 2020-2023 Page Asgardius GNU General Public License 3 +text = "R0.0.4-dev 2020-2023 Page Asgardius GNU General Public License 3 2016-2023 Asgardius Virtualx Project" [connection signal="finished" from="nebula" to="nebula" method="_on_finished"]