touch controls
This commit is contained in:
parent
54afc74a16
commit
f661d7fa53
16 changed files with 154 additions and 13 deletions
21
backgounds/Home.gd
Normal file
21
backgounds/Home.gd
Normal file
|
@ -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()
|
|
@ -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)):
|
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)
|
#print("Mouse Click/Unclick at: ", event.position)
|
||||||
_title()
|
_title()
|
||||||
|
if Global.live == 0:
|
||||||
|
_title()
|
||||||
#pass
|
#pass
|
||||||
|
|
||||||
func _title():
|
func _title():
|
||||||
|
|
|
@ -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="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://backgounds/galaxy.gd" id="1_h1j80"]
|
||||||
[ext_resource type="Script" path="res://fps.gd" id="3_t81vx"]
|
[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"]
|
[node name="galaxy" type="Node2D"]
|
||||||
script = ExtResource("1_h1j80")
|
script = ExtResource("1_h1j80")
|
||||||
|
@ -16,3 +17,10 @@ texture = ExtResource("1_bmyxf")
|
||||||
offset_right = 40.0
|
offset_right = 40.0
|
||||||
offset_bottom = 23.0
|
offset_bottom = 23.0
|
||||||
script = ExtResource("3_t81vx")
|
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")
|
||||||
|
|
BIN
backgounds/home.png
Normal file
BIN
backgounds/home.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 183 KiB |
34
backgounds/home.png.import
Normal file
34
backgounds/home.png.import
Normal file
|
@ -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
|
|
@ -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)):
|
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)
|
#print("Mouse Click/Unclick at: ", event.position)
|
||||||
_title()
|
_title()
|
||||||
|
if Global.live == 0:
|
||||||
|
_title()
|
||||||
#pass
|
#pass
|
||||||
|
|
||||||
func _title():
|
func _title():
|
||||||
|
|
|
@ -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="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="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://fps.gd" id="3_o2q0w"]
|
||||||
|
[ext_resource type="Script" path="res://backgounds/Home.gd" id="5_elxjd"]
|
||||||
|
|
||||||
[node name="wormhole" type="Node2D"]
|
[node name="wormhole" type="Node2D"]
|
||||||
script = ExtResource("1_fibhv")
|
script = ExtResource("1_fibhv")
|
||||||
|
@ -16,3 +17,10 @@ texture = ExtResource("2_6mic1")
|
||||||
offset_right = 40.0
|
offset_right = 40.0
|
||||||
offset_bottom = 23.0
|
offset_bottom = 23.0
|
||||||
script = ExtResource("3_o2q0w")
|
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")
|
||||||
|
|
|
@ -24,8 +24,8 @@ gradle_build/min_sdk=""
|
||||||
gradle_build/target_sdk=""
|
gradle_build/target_sdk=""
|
||||||
architectures/armeabi-v7a=true
|
architectures/armeabi-v7a=true
|
||||||
architectures/arm64-v8a=true
|
architectures/arm64-v8a=true
|
||||||
architectures/x86=true
|
architectures/x86=false
|
||||||
architectures/x86_64=true
|
architectures/x86_64=false
|
||||||
version/code=1
|
version/code=1
|
||||||
version/name="0.0.0"
|
version/name="0.0.0"
|
||||||
package/unique_name="asgardius.page.r3game"
|
package/unique_name="asgardius.page.r3game"
|
||||||
|
|
14
global.gd
Normal file
14
global.gd
Normal file
|
@ -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
|
|
@ -1,10 +1,13 @@
|
||||||
extends Sprite2D
|
extends Sprite2D
|
||||||
|
|
||||||
|
var origpos
|
||||||
|
#var origmpos
|
||||||
# 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():
|
||||||
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.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
@ -14,6 +17,9 @@ func _process(delta):
|
||||||
var velocity = Vector2.ZERO
|
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:
|
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)
|
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:
|
else:
|
||||||
if Input.is_action_pressed("ui_left"):
|
if Input.is_action_pressed("ui_left"):
|
||||||
xm = -1
|
xm = -1
|
||||||
|
@ -24,6 +30,8 @@ func _process(delta):
|
||||||
if Input.is_action_pressed("ui_down"):
|
if Input.is_action_pressed("ui_down"):
|
||||||
ym = 1
|
ym = 1
|
||||||
velocity = (Vector2.RIGHT.rotated(rotation) * -50000 * xm * delta)-Vector2.UP.rotated(rotation) * -50000 * ym * delta
|
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:
|
#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 * delta
|
||||||
|
|
|
@ -1,10 +1,15 @@
|
||||||
extends Sprite2D
|
extends Sprite2D
|
||||||
|
|
||||||
|
var origpos
|
||||||
|
var ctime
|
||||||
|
#var origmpos
|
||||||
# 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():
|
||||||
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.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
@ -14,6 +19,13 @@ func _process(delta):
|
||||||
var velocity = Vector2.ZERO
|
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:
|
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)
|
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:
|
else:
|
||||||
if Input.is_action_pressed("ui_left"):
|
if Input.is_action_pressed("ui_left"):
|
||||||
xm = -1
|
xm = -1
|
||||||
|
@ -24,6 +36,9 @@ func _process(delta):
|
||||||
if Input.is_action_pressed("ui_down"):
|
if Input.is_action_pressed("ui_down"):
|
||||||
ym = 1
|
ym = 1
|
||||||
velocity = (Vector2.RIGHT.rotated(rotation) * -10000 * xm * delta)-Vector2.UP.rotated(rotation) * -10000 * ym * delta
|
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:
|
#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 * delta
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
extends Sprite2D
|
extends Sprite2D
|
||||||
|
|
||||||
|
var origpos
|
||||||
|
#var origmpos
|
||||||
# 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():
|
||||||
|
origpos = self.position
|
||||||
|
#origmpos = get_viewport().get_mouse_position()
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,6 +17,9 @@ func _process(delta):
|
||||||
var velocity = Vector2.ZERO
|
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:
|
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)
|
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:
|
else:
|
||||||
if Input.is_action_pressed("ui_left"):
|
if Input.is_action_pressed("ui_left"):
|
||||||
xm = -1
|
xm = -1
|
||||||
|
@ -24,6 +30,8 @@ func _process(delta):
|
||||||
if Input.is_action_pressed("ui_down"):
|
if Input.is_action_pressed("ui_down"):
|
||||||
ym = 1
|
ym = 1
|
||||||
velocity = (Vector2.RIGHT.rotated(rotation) * -20000 * xm * delta)-Vector2.UP.rotated(rotation) * -20000 * ym * delta
|
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:
|
#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 * delta
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
extends Sprite2D
|
extends Sprite2D
|
||||||
|
|
||||||
|
var origpos
|
||||||
|
#var origmpos
|
||||||
# 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():
|
||||||
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.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
@ -14,6 +17,9 @@ func _process(delta):
|
||||||
var velocity = Vector2.ZERO
|
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:
|
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)
|
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:
|
else:
|
||||||
if Input.is_action_pressed("ui_left"):
|
if Input.is_action_pressed("ui_left"):
|
||||||
xm = -1
|
xm = -1
|
||||||
|
@ -24,6 +30,8 @@ func _process(delta):
|
||||||
if Input.is_action_pressed("ui_down"):
|
if Input.is_action_pressed("ui_down"):
|
||||||
ym = 1
|
ym = 1
|
||||||
velocity = (Vector2.RIGHT.rotated(rotation) * -30000 * xm * delta)-Vector2.UP.rotated(rotation) * -30000 * ym * delta
|
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:
|
#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 * delta
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
extends Sprite2D
|
extends Sprite2D
|
||||||
|
|
||||||
|
var origpos
|
||||||
|
#var origmpos
|
||||||
# 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():
|
||||||
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.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
@ -14,6 +17,9 @@ func _process(delta):
|
||||||
var velocity = Vector2.ZERO
|
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:
|
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)
|
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:
|
else:
|
||||||
if Input.is_action_pressed("ui_left"):
|
if Input.is_action_pressed("ui_left"):
|
||||||
xm = -1
|
xm = -1
|
||||||
|
@ -24,6 +30,8 @@ func _process(delta):
|
||||||
if Input.is_action_pressed("ui_down"):
|
if Input.is_action_pressed("ui_down"):
|
||||||
ym = 1
|
ym = 1
|
||||||
velocity = (Vector2.RIGHT.rotated(rotation) * -50000 * xm * delta)-Vector2.UP.rotated(rotation) * -50000 * ym * delta
|
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:
|
#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 * delta
|
||||||
|
|
|
@ -15,6 +15,10 @@ run/main_scene="res://bootclick.tscn"
|
||||||
config/features=PackedStringArray("4.1", "GL Compatibility")
|
config/features=PackedStringArray("4.1", "GL Compatibility")
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
Global="*res://global.gd"
|
||||||
|
|
||||||
[display]
|
[display]
|
||||||
|
|
||||||
window/size/viewport_width=1280
|
window/size/viewport_width=1280
|
||||||
|
|
1
title.gd
1
title.gd
|
@ -29,6 +29,7 @@ func _input(event):
|
||||||
func _level():
|
func _level():
|
||||||
# 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.live = 1
|
||||||
if randi() % 2 == 0:
|
if randi() % 2 == 0:
|
||||||
get_tree().change_scene_to_file("res://backgounds/galaxy.tscn")
|
get_tree().change_scene_to_file("res://backgounds/galaxy.tscn")
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue