19 lines
403 B
C#
19 lines
403 B
C#
|
|
using Godot;
|
||
|
|
using System;
|
||
|
|
|
||
|
|
public partial class Laser : Area2D
|
||
|
|
{
|
||
|
|
[Export]
|
||
|
|
public int Speed { get; set;} = 500;
|
||
|
|
|
||
|
|
public Vector2 MovementVector { get; set; } = new Vector2(0, -1);
|
||
|
|
|
||
|
|
|
||
|
|
private void _on_visible_on_screen_notifier_2d_screen_exited(){
|
||
|
|
QueueFree();
|
||
|
|
}
|
||
|
|
public override void _PhysicsProcess(double delta){
|
||
|
|
GlobalPosition += MovementVector.Rotated(Rotation) * Speed * (float)delta;
|
||
|
|
}
|
||
|
|
}
|