diff --git a/backgounds/Home.gd b/backgounds/Home.gd new file mode 100644 index 0000000..6687d18 --- /dev/null +++ b/backgounds/Home.gd @@ -0,0 +1,21 @@ +extends TextureButton + + +# Called when the node enters the scene tree for the first time. +func _ready(): + var button = Button.new() + button.text = "Home" + button.pressed.connect(self._button_pressed) + add_child(button) + +func _button_pressed(): + Global.live = 0 + #_title() + +func _title(): + # This is like autoloading the scene, only + # it happens after already loading the main scene. + get_tree().change_scene_to_file("res://title.tscn") + #get_tree().root.add_child(title) + #get_tree().root.remove_child(boot) + #boot.queue_free() diff --git a/backgounds/galaxy.gd b/backgounds/galaxy.gd index 6a05919..7c2c60f 100644 --- a/backgounds/galaxy.gd +++ b/backgounds/galaxy.gd @@ -16,6 +16,8 @@ func _process(delta): if (Time.get_ticks_msec() - wait) >= 1000 && (Input.is_key_pressed(KEY_R) || 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) _title() + if Global.live == 0: + _title() #pass func _title(): diff --git a/backgounds/galaxy.tscn b/backgounds/galaxy.tscn index b0b3ce6..f8a4219 100644 --- a/backgounds/galaxy.tscn +++ b/backgounds/galaxy.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=3 uid="uid://cnstwjy5mqdyo"] +[gd_scene load_steps=5 format=3 uid="uid://cnstwjy5mqdyo"] [ext_resource type="Texture2D" uid="uid://bona2ytn3y3a5" path="res://backgounds/galaxy.png" id="1_bmyxf"] [ext_resource type="Script" path="res://backgounds/galaxy.gd" id="1_h1j80"] [ext_resource type="Script" path="res://fps.gd" id="3_t81vx"] +[ext_resource type="Script" path="res://backgounds/Home.gd" id="4_hhu74"] [node name="galaxy" type="Node2D"] script = ExtResource("1_h1j80") @@ -16,3 +17,10 @@ texture = ExtResource("1_bmyxf") offset_right = 40.0 offset_bottom = 23.0 script = ExtResource("3_t81vx") + +[node name="Home" type="TextureButton" parent="."] +offset_left = 52.0 +offset_top = 39.0 +offset_right = 125.0 +offset_bottom = 110.0 +script = ExtResource("4_hhu74") diff --git a/backgounds/home.png b/backgounds/home.png new file mode 100644 index 0000000..08f1e09 Binary files /dev/null and b/backgounds/home.png differ diff --git a/backgounds/home.png.import b/backgounds/home.png.import new file mode 100644 index 0000000..836efc8 --- /dev/null +++ b/backgounds/home.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ddf85wtbxy6no" +path="res://.godot/imported/home.png-154cee737d467ac3381773af900fb5b7.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://backgounds/home.png" +dest_files=["res://.godot/imported/home.png-154cee737d467ac3381773af900fb5b7.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/backgounds/wormhole.gd b/backgounds/wormhole.gd index f69e312..16b4593 100644 --- a/backgounds/wormhole.gd +++ b/backgounds/wormhole.gd @@ -16,6 +16,8 @@ func _process(delta): if (Time.get_ticks_msec() - wait) >= 1000 && (Input.is_key_pressed(KEY_R) || 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) _title() + if Global.live == 0: + _title() #pass func _title(): diff --git a/backgounds/wormhole.tscn b/backgounds/wormhole.tscn index 2f46eab..c6b3368 100644 --- a/backgounds/wormhole.tscn +++ b/backgounds/wormhole.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=3 uid="uid://by7ktb1k5ml5y"] +[gd_scene load_steps=5 format=3 uid="uid://by7ktb1k5ml5y"] [ext_resource type="Script" path="res://backgounds/wormhole.gd" id="1_fibhv"] [ext_resource type="Texture2D" uid="uid://bcfmwk0ffy73n" path="res://backgounds/wormhole.png" id="2_6mic1"] [ext_resource type="Script" path="res://fps.gd" id="3_o2q0w"] +[ext_resource type="Script" path="res://backgounds/Home.gd" id="5_elxjd"] [node name="wormhole" type="Node2D"] script = ExtResource("1_fibhv") @@ -16,3 +17,10 @@ texture = ExtResource("2_6mic1") offset_right = 40.0 offset_bottom = 23.0 script = ExtResource("3_o2q0w") + +[node name="Home" type="TextureButton" parent="."] +offset_left = 52.0 +offset_top = 39.0 +offset_right = 125.0 +offset_bottom = 110.0 +script = ExtResource("5_elxjd") diff --git a/export_presets.cfg b/export_presets.cfg index 29400c0..d71bfeb 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -24,8 +24,8 @@ gradle_build/min_sdk="" gradle_build/target_sdk="" architectures/armeabi-v7a=true architectures/arm64-v8a=true -architectures/x86=true -architectures/x86_64=true +architectures/x86=false +architectures/x86_64=false version/code=1 version/name="0.0.0" package/unique_name="asgardius.page.r3game" diff --git a/global.gd b/global.gd new file mode 100644 index 0000000..d1a69e5 --- /dev/null +++ b/global.gd @@ -0,0 +1,14 @@ +extends Node + +var live +var time +var origmpos +var mousepos +# Called when the node enters the scene tree for the first time. +func _ready(): + pass # Replace with function body. + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta): + pass diff --git a/levels/antenna.gd b/levels/antenna.gd index a79a7cf..82a62fb 100644 --- a/levels/antenna.gd +++ b/levels/antenna.gd @@ -1,10 +1,13 @@ extends Sprite2D - +var origpos +#var origmpos # 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(): - pass # Replace with function body. + origpos = self.position + #origmpos = get_viewport().get_mouse_position() + #pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. @@ -14,6 +17,9 @@ func _process(delta): var velocity = Vector2.ZERO 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"): xm = -1 @@ -24,6 +30,8 @@ func _process(delta): if Input.is_action_pressed("ui_down"): 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() #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 diff --git a/levels/ast1.gd b/levels/ast1.gd index 7fa6738..785f795 100644 --- a/levels/ast1.gd +++ b/levels/ast1.gd @@ -1,10 +1,15 @@ extends Sprite2D - +var origpos +var ctime +#var origmpos # 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(): - pass # Replace with function body. + 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. @@ -14,6 +19,13 @@ func _process(delta): var velocity = Vector2.ZERO 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) else: if Input.is_action_pressed("ui_left"): xm = -1 @@ -24,6 +36,9 @@ func _process(delta): if Input.is_action_pressed("ui_down"): 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() #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 diff --git a/levels/ast2.gd b/levels/ast2.gd index 790612c..42be782 100644 --- a/levels/ast2.gd +++ b/levels/ast2.gd @@ -1,9 +1,12 @@ extends Sprite2D - +var origpos +#var origmpos # 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(): + origpos = self.position + #origmpos = get_viewport().get_mouse_position() pass # Replace with function body. @@ -14,6 +17,9 @@ func _process(delta): var velocity = Vector2.ZERO 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"): xm = -1 @@ -24,6 +30,8 @@ func _process(delta): if Input.is_action_pressed("ui_down"): 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() #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 diff --git a/levels/ast3.gd b/levels/ast3.gd index 7bd42d8..2700234 100644 --- a/levels/ast3.gd +++ b/levels/ast3.gd @@ -1,10 +1,13 @@ extends Sprite2D - +var origpos +#var origmpos # 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(): - pass # Replace with function body. + origpos = self.position + #origmpos = get_viewport().get_mouse_position() + #pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. @@ -14,6 +17,9 @@ func _process(delta): var velocity = Vector2.ZERO 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"): xm = -1 @@ -24,6 +30,8 @@ func _process(delta): if Input.is_action_pressed("ui_down"): 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() #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 diff --git a/levels/css1.gd b/levels/css1.gd index a79a7cf..82a62fb 100644 --- a/levels/css1.gd +++ b/levels/css1.gd @@ -1,10 +1,13 @@ extends Sprite2D - +var origpos +#var origmpos # 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(): - pass # Replace with function body. + origpos = self.position + #origmpos = get_viewport().get_mouse_position() + #pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. @@ -14,6 +17,9 @@ func _process(delta): var velocity = Vector2.ZERO 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"): xm = -1 @@ -24,6 +30,8 @@ func _process(delta): if Input.is_action_pressed("ui_down"): 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() #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 diff --git a/project.godot b/project.godot index deab950..581fd5b 100644 --- a/project.godot +++ b/project.godot @@ -15,6 +15,10 @@ run/main_scene="res://bootclick.tscn" config/features=PackedStringArray("4.1", "GL Compatibility") config/icon="res://icon.png" +[autoload] + +Global="*res://global.gd" + [display] window/size/viewport_width=1280 diff --git a/title.gd b/title.gd index cc620e5..6dbe90d 100644 --- a/title.gd +++ b/title.gd @@ -29,6 +29,7 @@ func _input(event): func _level(): # This is like autoloading the scene, only # it happens after already loading the main scene. + Global.live = 1 if randi() % 2 == 0: get_tree().change_scene_to_file("res://backgounds/galaxy.tscn") else: