SupaLidlGame/Items/Weapons/Railgun.cs

22 lines
684 B
C#
Raw Permalink Normal View History

2023-05-26 22:28:08 -07:00
using Godot;
2023-06-13 02:55:30 -07:00
using GodotUtilities;
2023-05-26 22:28:08 -07:00
2023-06-03 18:21:46 -07:00
namespace SupaLidlGame.Items.Weapons;
public partial class Railgun : Ranged
2023-05-26 22:28:08 -07:00
{
2023-06-03 18:21:46 -07:00
public override void Attack()
2023-05-26 22:28:08 -07:00
{
2023-06-03 18:21:46 -07:00
// create projectile
PackedScene scene = GD.Load<PackedScene>("res://Entities/RailBeam.tscn");
GD.Print("lol");
var projectile = scene.Instantiate<Entities.Projectile>();
projectile.Hitbox.Faction = Character.Faction;
projectile.Direction = Character.Target;
projectile.GlobalPosition = GlobalPosition;
projectile.GlobalRotation = projectile.Direction.Angle();
this.GetAncestor<SupaLidlGame.Scenes.Map>()
.Entities.AddChild(projectile);
2023-05-26 22:28:08 -07:00
}
}