mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Strawberry Explosion
This commit is contained in:
parent
2b53936f8b
commit
b9d03efbb8
5 changed files with 42 additions and 6 deletions
|
|
@ -9,12 +9,24 @@ public partial class Bullet : Area2D
|
|||
|
||||
private Vector2 _direction = Vector2.Right;
|
||||
|
||||
//public delegate void BulletHitEventHandler(Node Body);
|
||||
//public event BulletHitEventHandler BulletHit;
|
||||
|
||||
// Called when the node enters the scene tree for the first time.
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
//this.Connect("body_entered", new Callable(this, nameof(OnBodyEntered)));
|
||||
}
|
||||
|
||||
//private void OnBodyEntered(Node body)
|
||||
//{
|
||||
// When a body is entered, invoke the event and pass the collided body
|
||||
// BulletHit?.Invoke(body);
|
||||
|
||||
// Then remove the bullet
|
||||
// QueueFree();
|
||||
//}
|
||||
|
||||
public void SetDirection(Vector2 direction)
|
||||
{
|
||||
var normalized = direction.Normalized();
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public partial class PlayerMovement : CharacterBody2D
|
|||
{
|
||||
if (Input.IsActionJustPressed("shoot"))
|
||||
{
|
||||
Debug.WriteLine("Shoot");
|
||||
//Debug.WriteLine("Shoot");
|
||||
Bullet bullet = BulletScene.Instantiate<Bullet>();
|
||||
Owner.AddChild(bullet);
|
||||
bullet.Transform = Muzzle.GlobalTransform;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue