mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-14 06:25:53 +00:00
steering bullets
This commit is contained in:
parent
766b04b2ff
commit
6125565d8c
6 changed files with 89 additions and 67 deletions
|
|
@ -35,14 +35,14 @@ public partial class Bullet : Area2D
|
|||
_gameManager = gameManager;
|
||||
|
||||
_elapsedTime = 0f;
|
||||
|
||||
|
||||
// Need to clone them here
|
||||
// _modifiers = _bulletInfo.TimeModifiers.Select(x => x.MakeClone()).ToList();
|
||||
|
||||
|
||||
// var clonedModifiers = _bulletInfo.TimeModifiers.Select(x => x.MakeClone());
|
||||
// _modifiers = clonedModifiers.ToList();
|
||||
|
||||
|
||||
// Ugly hack to make instances unique
|
||||
_modifiers = _bulletInfo.TimeModifiers.Select(x => x.Wrap()).ToList();
|
||||
}
|
||||
|
|
@ -151,9 +151,26 @@ public partial class Bullet : Area2D
|
|||
ApplyTimeModifiers(delta);
|
||||
}
|
||||
|
||||
|
||||
if (BulletInfo.Controllabe)
|
||||
{
|
||||
ControlBullet(delta);
|
||||
}
|
||||
|
||||
this.Position += ((float)(Speed * delta) * _direction);
|
||||
}
|
||||
|
||||
private void ControlBullet(double delta)
|
||||
{
|
||||
var axis = Input.GetAxis("left", "right");
|
||||
|
||||
if (axis != 0)
|
||||
{
|
||||
float rotationSpeed = 180f; // Degrees per second
|
||||
RotateBullet(axis * rotationSpeed * (float)delta);
|
||||
}
|
||||
}
|
||||
|
||||
private void _on_visible_on_screen_notifier_2d_screen_exited()
|
||||
{
|
||||
//Debug.WriteLine("Destroy bullet out of screen");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue