Gameplay Rework (WIP)

This commit is contained in:
Page Asgardius 2023-12-02 13:44:54 -07:00
parent c06cf36683
commit 9ca9d42dbf
23 changed files with 102 additions and 157 deletions

View file

@ -1,14 +1,19 @@
extends Label extends Label
func _process(delta: float) -> void: 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: if Global.firstrun:
set_text("Welcome to your first session "+OS.get_data_dir().rsplit("/", true, 7)[2]); set_text("Welcome to your first session "+OS.get_data_dir().rsplit("/", true, 7)[2]);
else: else:
set_text("Welcome back "+OS.get_data_dir().rsplit("/", true, 7)[2]); set_text("Welcome back "+OS.get_data_dir().rsplit("/", true, 7)[2]);
else:
_sk()
func _sk(): func _sk():
Global.sk = true
set_text("Script Kiddie detected, only true hackers can cheat here"); 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()

View file

@ -1,6 +1,6 @@
extends Label extends Label
func _process(delta: float) -> void: func _ready():
if Global.time > Global.timelimit: if Global.time > Global.timelimit:
set_text("You are out of fuel"); set_text("You are out of fuel");

View file

@ -7,8 +7,6 @@ func _ready():
if Global.time < previoustime && Global.live == 3: if Global.time < previoustime && Global.live == 3:
Global.levelmax[Global.gamelevel] = str(Global.time) Global.levelmax[Global.gamelevel] = str(Global.time)
savegame.new() savegame.new()
func _process(delta: float) -> void:
var sec = float(Global.time / 1000) var sec = float(Global.time / 1000)
var msec = Global.time - (sec*1000) var msec = Global.time - (sec*1000)
var bsec = float(previoustime / 1000) var bsec = float(previoustime / 1000)

View file

@ -2,10 +2,10 @@ extends Node2D
# Called when the node enters the scene tree for the first time. # 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(): func _ready():
get_tree().root.add_child.call_deferred(wormhole) get_tree().root.add_child.call_deferred(abstract)
Global.wait = Time.get_ticks_msec() Global.wait = Time.get_ticks_msec()
#pass # Replace with function body. #pass # Replace with function body.
@ -14,13 +14,9 @@ func _ready():
func _process(delta): func _process(delta):
if Time.get_ticks_msec() - Global.wait > Global.timelimit: if Time.get_ticks_msec() - Global.wait > Global.timelimit:
Global.live = 2 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) #print("Mouse Click/Unclick at: ", event.position)
_title() _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: if Global.live == 0:
_title() _title()
elif Global.live == 2: elif Global.live == 2:
@ -32,7 +28,7 @@ func _process(delta):
func _title(): func _title():
# This is like autoloading the scene, only # This is like autoloading the scene, only
# it happens after already loading the main scene. # 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().change_scene_to_file("res://title.tscn")
#get_tree().root.add_child(title) #get_tree().root.add_child(title)
#get_tree().root.remove_child(boot) #get_tree().root.remove_child(boot)
@ -44,7 +40,7 @@ func _crash():
Global.time = Time.get_ticks_msec() - Global.wait Global.time = Time.get_ticks_msec() - Global.wait
await get_tree().create_timer(1.0).timeout await get_tree().create_timer(1.0).timeout
queue_free() 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().change_scene_to_file("res://backgounds/supernova.tscn")
#get_tree().root.add_child(title) #get_tree().root.add_child(title)
#get_tree().root.remove_child(boot) #get_tree().root.remove_child(boot)
@ -54,7 +50,7 @@ func _complete():
# This is like autoloading the scene, only # This is like autoloading the scene, only
# it happens after already loading the main scene. # it happens after already loading the main scene.
Global.time = Time.get_ticks_msec() - Global.wait 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().change_scene_to_file("res://levels/credits.tscn")
#get_tree().root.add_child(title) #get_tree().root.add_child(title)
#get_tree().root.remove_child(boot) #get_tree().root.remove_child(boot)

View file

@ -14,13 +14,9 @@ func _ready():
func _process(delta): func _process(delta):
if Time.get_ticks_msec() - Global.wait > Global.timelimit: if Time.get_ticks_msec() - Global.wait > Global.timelimit:
Global.live = 2 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) #print("Mouse Click/Unclick at: ", event.position)
_title() _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: if Global.live == 0:
_title() _title()
elif Global.live == 2: elif Global.live == 2:

View file

@ -4,6 +4,7 @@ var crash := AudioStreamPlayer.new()
var wait var wait
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
add_child(crash) add_child(crash)
var titlemusic = load("res://sfx/complete.ogg") var titlemusic = load("res://sfx/complete.ogg")
crash.stream = titlemusic crash.stream = titlemusic
@ -18,7 +19,7 @@ func _process(delta):
func _input(event): func _input(event):
# Mouse in viewport coordinates. # 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) #print("Mouse Click/Unclick at: ", event.position)
_title() _title()

View file

@ -25,12 +25,12 @@ scale = Vector2(6.32794, 4.85128)
text = "Good Job" text = "Good Job"
[node name="Label2" type="Label" parent="."] [node name="Label2" type="Label" parent="."]
offset_left = 108.0 offset_left = 346.0
offset_top = 361.0 offset_top = 361.0
offset_right = 475.0 offset_right = 602.0
offset_bottom = 387.0 offset_bottom = 387.0
scale = Vector2(2.92998, 7.01768) 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="."] [node name="Label3" type="Label" parent="."]
offset_left = 158.0 offset_left = 158.0

View file

@ -4,6 +4,7 @@ var crash := AudioStreamPlayer.new()
var wait var wait
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
add_child(crash) add_child(crash)
var titlemusic = load("res://sfx/crash.ogg") var titlemusic = load("res://sfx/crash.ogg")
crash.stream = titlemusic crash.stream = titlemusic
@ -18,7 +19,7 @@ func _process(delta):
func _input(event): func _input(event):
# Mouse in viewport coordinates. # 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) #print("Mouse Click/Unclick at: ", event.position)
_title() _title()

View file

@ -25,12 +25,12 @@ horizontal_alignment = 1
script = ExtResource("3_24urm") script = ExtResource("3_24urm")
[node name="Label2" type="Label" parent="."] [node name="Label2" type="Label" parent="."]
offset_left = 108.0 offset_left = 228.0
offset_top = 361.0 offset_top = 361.0
offset_right = 475.0 offset_right = 488.0
offset_bottom = 387.0 offset_bottom = 387.0
scale = Vector2(2.92998, 7.01768) 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="."] [node name="Label3" type="Label" parent="."]
offset_left = 158.0 offset_left = 158.0

View file

@ -14,13 +14,9 @@ func _ready():
func _process(delta): func _process(delta):
if Time.get_ticks_msec() - Global.wait > Global.timelimit: if Time.get_ticks_msec() - Global.wait > Global.timelimit:
Global.live = 2 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) #print("Mouse Click/Unclick at: ", event.position)
_title() _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: if Global.live == 0:
_title() _title()
elif Global.live == 2: elif Global.live == 2:

View file

@ -8,6 +8,7 @@ const savegame = preload("res://save.gd")
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
OS.get_data_dir().rsplit("/", true, 7)[2] OS.get_data_dir().rsplit("/", true, 7)[2]
loadgame.new() loadgame.new()
#pass # Replace with function body. #pass # Replace with function body.
@ -23,12 +24,9 @@ func _process(delta):
func _input(event): func _input(event):
# Mouse in viewport coordinates. # 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) #print("Mouse Click/Unclick at: ", event.position)
if Global.sk: _title()
get_tree().quit()
else:
_title()
func _title(): func _title():
# This is like autoloading the scene, only # This is like autoloading the scene, only

View file

@ -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://bootclick.gd" id="1_52bti"]
[ext_resource type="Script" path="res://fps.gd" id="2_gnh1w"] [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"] [node name="bootclick" type="Control"]
layout_mode = 3 layout_mode = 3
@ -13,12 +13,12 @@ script = ExtResource("1_52bti")
[node name="Label" type="Label" parent="."] [node name="Label" type="Label" parent="."]
layout_mode = 0 layout_mode = 0
offset_left = 71.0 offset_left = 105.0
offset_top = 258.0 offset_top = 258.0
offset_right = 453.0 offset_right = 453.0
offset_bottom = 284.0 offset_bottom = 284.0
scale = Vector2(2.94857, 7.68) 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 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
@ -28,10 +28,9 @@ offset_right = 40.0
offset_bottom = 23.0 offset_bottom = 23.0
script = ExtResource("2_gnh1w") script = ExtResource("2_gnh1w")
[node name="Label2" type="Label" parent="."] [node name="Selftest" parent="." instance=ExtResource("3_jtnh5")]
layout_mode = 0 layout_mode = 0
offset_left = 77.0 offset_left = 57.0
offset_top = 94.0 offset_top = 112.0
offset_right = 117.0 offset_right = 97.0
offset_bottom = 117.0 offset_bottom = 135.0
script = ExtResource("3_d45yk")

View file

@ -11,6 +11,8 @@ var gamelevel
var levelmax var levelmax
var firstrun var firstrun
var sk = false var sk = false
var xm = 0
var ym = 0
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
pass # Replace with function body. pass # Replace with function body.

View file

@ -16,26 +16,12 @@ func _process(delta):
var ym = 0 var ym = 0
var velocity = Vector2.ZERO var velocity = Vector2.ZERO
if Global.live == 1: 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) * -1000 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -1000 * Global.ym * delta
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) origpos = self.position
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
#origmpos = get_viewport().get_mouse_position() #origmpos = get_viewport().get_mouse_position()
#if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0: #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) # 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.x < 782 && position.x > 496:
if position.y < 468 && position.y > 270: if position.y < 468 && position.y > 270:
Global.live = 3 Global.live = 3

View file

@ -6,41 +6,43 @@ var ctime
# Called when the node enters the scene tree for the first time. # 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") #var velocity = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
func _ready(): func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
origpos = self.position origpos = self.position
ctime = Time.get_ticks_msec() ctime = Time.get_ticks_msec()
Global.origmpos = get_viewport().get_mouse_position() Global.origmpos = get_viewport().get_mouse_position()
#pass # Replace with function body. #pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
var xm = 0 Global.xm = 0
var ym = 0 Global.ym = 0
var velocity = Vector2.ZERO var velocity = Vector2.ZERO
if Global.live == 1: 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: 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) Global.xm = Input.get_joy_axis(0,JOY_AXIS_LEFT_X)
elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): Global.ym = Input.get_joy_axis(0,JOY_AXIS_LEFT_Y)
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)
else: else:
if Input.is_action_pressed("ui_left") || Input.is_key_pressed(KEY_A): 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): 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): 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): if Input.is_action_pressed("ui_down") || Input.is_key_pressed(KEY_S):
ym = 1 Global.ym = 1
velocity = (Vector2.RIGHT.rotated(rotation) * -10000 * xm * delta)-Vector2.UP.rotated(rotation) * -10000 * ym * delta velocity = (Vector2.RIGHT.rotated(rotation) * -100 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -100 * Global.ym * delta
origpos = self.position ctime = Time.get_ticks_msec()
Global.origmpos = get_viewport().get_mouse_position() elif !Global.sk && Global.live == null:
ctime = Time.get_ticks_msec() _sk()
#if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0: #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) # velocity = Vector2.UP.rotated(rotation) * -400 * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y)
position += velocity * delta position += velocity
#pass #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)

View file

@ -12,28 +12,12 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
var xm = 0
var ym = 0
var velocity = Vector2.ZERO var velocity = Vector2.ZERO
if Global.live == 1: 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) * -200 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -200 * Global.ym * delta
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) origpos = self.position
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
#origmpos = get_viewport().get_mouse_position() #origmpos = get_viewport().get_mouse_position()
#if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0: #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) # velocity = Vector2.UP.rotated(rotation) * -400 * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y)
position += velocity * delta position += velocity
#pass #pass

View file

@ -12,28 +12,11 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
var xm = 0
var ym = 0
var velocity = Vector2.ZERO var velocity = Vector2.ZERO
if Global.live == 1: 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) * -300 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -300 * Global.ym * delta
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
#origmpos = get_viewport().get_mouse_position() #origmpos = get_viewport().get_mouse_position()
#if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0: #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) # velocity = Vector2.UP.rotated(rotation) * -400 * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y)
position += velocity * delta position += velocity
#pass #pass

View file

@ -10,6 +10,7 @@ var playstart = false
var playindex = 0 var playindex = 0
func _ready(): func _ready():
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
add_child(bgsound) add_child(bgsound)
bgsound.stream = song1 bgsound.stream = song1
bgsound.play(0) bgsound.play(0)
@ -50,6 +51,6 @@ func _complete():
func _input(event): func _input(event):
# Mouse in viewport coordinates. # 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) #print("Mouse Click/Unclick at: ", event.position)
_complete() _complete()

View file

@ -12,30 +12,13 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta): func _process(delta):
var xm = 0
var ym = 0
var velocity = Vector2.ZERO var velocity = Vector2.ZERO
if Global.live == 1: 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) * -1000 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -1000 * Global.ym * delta
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
#origmpos = get_viewport().get_mouse_position() #origmpos = get_viewport().get_mouse_position()
#if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0: #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) # 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.x < 782 && position.x > 496:
if position.y < 468 && position.y > 270: if position.y < 468 && position.y > 270:
Global.live = 2 Global.live = 2

View file

@ -1,7 +1,8 @@
extends Label extends Label
func _process(delta: float) -> void: func _process(delta: float) -> void:
if (Global.timelimit - (Time.get_ticks_msec() - Global.wait)) > 0: if Global.wait != null:
set_text("Time: " + str((Global.timelimit - (Time.get_ticks_msec() - Global.wait))/1000)); if (Global.timelimit - (Time.get_ticks_msec() - Global.wait)) > 0:
else: set_text("Time: " + str((Global.timelimit - (Time.get_ticks_msec() - Global.wait))/1000));
set_text(str(0)); else:
set_text(str(0));

10
selftest.tscn Normal file
View file

@ -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")

View file

@ -8,6 +8,9 @@ var wait
#var wormhole = preload("res://backgounds/wormhole.tscn").instantiate() #var wormhole = preload("res://backgounds/wormhole.tscn").instantiate()
func _ready(): 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 Global.gamelevel = null
add_child(bgsound) add_child(bgsound)
var titlemusic = load("res://music/x-force.wav") var titlemusic = load("res://music/x-force.wav")
@ -23,10 +26,10 @@ func _process(delta):
func _input(event): func _input(event):
# Mouse in viewport coordinates. # 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) #print("Mouse Click/Unclick at: ", event.position)
_level() _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() get_tree().quit()
func _level(): func _level():

View file

@ -52,22 +52,22 @@ script = ExtResource("2_bbb0f")
[node name="start" type="Label" parent="."] [node name="start" type="Label" parent="."]
layout_mode = 0 layout_mode = 0
offset_left = 131.0 offset_left = 446.0
offset_top = 92.0 offset_top = 92.0
offset_right = 501.0 offset_right = 610.0
offset_bottom = 118.0 offset_bottom = 118.0
scale = Vector2(2.61468, 1.57466) 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") script = ExtResource("4_cc41w")
[node name="exit" type="Label" parent="."] [node name="exit" type="Label" parent="."]
layout_mode = 0 layout_mode = 0
offset_left = 165.0 offset_left = 364.0
offset_top = 602.0 offset_top = 602.0
offset_right = 535.0 offset_right = 568.0
offset_bottom = 628.0 offset_bottom = 628.0
scale = Vector2(2.61468, 1.57466) 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") script = ExtResource("5_scoec")
[node name="Label" type="Label" parent="."] [node name="Label" type="Label" parent="."]
@ -76,7 +76,7 @@ offset_left = 36.0
offset_top = 653.0 offset_top = 653.0
offset_right = 76.0 offset_right = 76.0
offset_bottom = 676.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" 2016-2023 Asgardius Virtualx Project"
[connection signal="finished" from="nebula" to="nebula" method="_on_finished"] [connection signal="finished" from="nebula" to="nebula" method="_on_finished"]