fix crash animation

This commit is contained in:
Page Asgardius 2023-10-09 09:37:22 -07:00
parent bedf297d92
commit e47d7fb999
8 changed files with 151 additions and 143 deletions

View file

@ -17,28 +17,29 @@ func _process(delta):
var xm = 0 var xm = 0
var ym = 0 var ym = 0
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 Global.live == 1:
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) 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:
elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): 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)
if (Time.get_ticks_msec() - ctime) <= 67: 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") || 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) * -10000 * xm * delta)-Vector2.UP.rotated(rotation) * -10000 * ym * delta
origpos = self.position
Global.origmpos = get_viewport().get_mouse_position() Global.origmpos = get_viewport().get_mouse_position()
Global.mousepos = get_viewport().get_mouse_position() - Global.origmpos ctime = Time.get_ticks_msec()
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") || 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) * -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

View file

@ -15,22 +15,23 @@ func _process(delta):
var xm = 0 var xm = 0
var ym = 0 var ym = 0
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 Global.live == 1:
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) 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:
elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): 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 #var mousepos = get_viewport().get_mouse_position() - origmpos
self.position = Vector2(origpos.x+(Global.mousepos.x*2), origpos.y+(Global.mousepos.y*2)) self.position = Vector2(origpos.x+(Global.mousepos.x*2), origpos.y+(Global.mousepos.y*2))
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 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 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 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 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 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)

View file

@ -15,23 +15,24 @@ func _process(delta):
var xm = 0 var xm = 0
var ym = 0 var ym = 0
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 Global.live == 1:
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) 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:
elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): 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 #var mousepos = get_viewport().get_mouse_position() - origmpos
self.position = Vector2(origpos.x+(Global.mousepos.x*3), origpos.y+(Global.mousepos.y*3)) self.position = Vector2(origpos.x+(Global.mousepos.x*3), origpos.y+(Global.mousepos.y*3))
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 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 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 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 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 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 * delta

View file

@ -15,27 +15,28 @@ func _process(delta):
var xm = 0 var xm = 0
var ym = 0 var ym = 0
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 Global.live == 1:
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) 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:
elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): 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 #var mousepos = get_viewport().get_mouse_position() - origmpos
self.position = Vector2(origpos.x+(Global.mousepos.x*5), origpos.y+(Global.mousepos.y*5)) self.position = Vector2(origpos.x+(Global.mousepos.x*5), origpos.y+(Global.mousepos.y*5))
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 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 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 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 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 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 * delta
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
#pass #pass

View file

@ -15,26 +15,27 @@ func _process(delta):
var xm = 0 var xm = 0
var ym = 0 var ym = 0
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 Global.live == 1:
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) 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:
elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): 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 #var mousepos = get_viewport().get_mouse_position() - origmpos
self.position = Vector2(origpos.x+(Global.mousepos.x*5), origpos.y+(Global.mousepos.y*5)) self.position = Vector2(origpos.x+(Global.mousepos.x*5), origpos.y+(Global.mousepos.y*5))
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 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 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 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 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 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 * delta
if position.x > 496: if position.x > 496:
Global.live = 2 Global.live = 2
#pass #pass

View file

@ -15,26 +15,27 @@ func _process(delta):
var xm = 0 var xm = 0
var ym = 0 var ym = 0
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 Global.live == 1:
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) 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:
elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): 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 #var mousepos = get_viewport().get_mouse_position() - origmpos
self.position = Vector2(origpos.x+(Global.mousepos.x*5), origpos.y+(Global.mousepos.y*5)) self.position = Vector2(origpos.x+(Global.mousepos.x*5), origpos.y+(Global.mousepos.y*5))
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 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 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 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 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 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 * delta
if position.x < 782: if position.x < 782:
Global.live = 2 Global.live = 2
#pass #pass

View file

@ -15,26 +15,27 @@ func _process(delta):
var xm = 0 var xm = 0
var ym = 0 var ym = 0
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 Global.live == 1:
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) 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:
elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): 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 #var mousepos = get_viewport().get_mouse_position() - origmpos
self.position = Vector2(origpos.x+(Global.mousepos.x*5), origpos.y+(Global.mousepos.y*5)) self.position = Vector2(origpos.x+(Global.mousepos.x*5), origpos.y+(Global.mousepos.y*5))
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 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 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 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 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 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 * delta
if position.y > 270: if position.y > 270:
Global.live = 2 Global.live = 2
#pass #pass

View file

@ -15,26 +15,27 @@ func _process(delta):
var xm = 0 var xm = 0
var ym = 0 var ym = 0
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 Global.live == 1:
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) 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:
elif Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): 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 #var mousepos = get_viewport().get_mouse_position() - origmpos
self.position = Vector2(origpos.x+(Global.mousepos.x*5), origpos.y+(Global.mousepos.y*5)) self.position = Vector2(origpos.x+(Global.mousepos.x*5), origpos.y+(Global.mousepos.y*5))
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 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 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 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 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 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 * delta
if position.y < 468: if position.y < 468:
Global.live = 2 Global.live = 2
#pass #pass