SupaLidlGame/Items/Weapons/Railgun.cs

22 lines
693 B
C#
Raw Normal View History

2023-05-26 22:28:08 -07:00
using Godot;
using SupaLidlGame.Extensions;
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
}
}