r3-next/levels/antenna.gd

29 lines
981 B
GDScript3
Raw Normal View History

2024-10-29 22:37:39 +01:00
extends Sprite
2023-08-14 04:54:27 +02:00
2023-09-08 21:50:34 +02:00
var origpos
#var origmpos
2023-08-14 04:54:27 +02:00
# 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():
2023-09-08 21:50:34 +02:00
origpos = self.position
#origmpos = get_viewport().get_mouse_position()
#pass # Replace with function body.
2023-08-14 04:54:27 +02:00
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var xm = 0
var ym = 0
var velocity = Vector2.ZERO
2023-10-24 22:23:46 +02:00
if Global.live == 1:
2023-12-02 21:44:54 +01:00
velocity = (Vector2.RIGHT.rotated(rotation) * -1000 * Global.xm * delta)-Vector2.UP.rotated(rotation) * -1000 * Global.ym * delta
origpos = self.position
2023-09-08 21:50:34 +02:00
#origmpos = get_viewport().get_mouse_position()
2023-08-14 04:54:27 +02:00
#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)
2023-12-02 21:44:54 +01:00
position += velocity
2023-10-24 22:23:46 +02:00
if position.x < 782 && position.x > 496:
if position.y < 468 && position.y > 270:
Global.live = 3
2023-08-14 04:54:27 +02:00
#pass