J
JayV3D

Speed value doesn't appear to work

I've had a play around with the different properties of the Bullet, and it appears that changing the speed value doesn't actually do anything. I've tested this in both my own project and the complete version, and no matter how high or low I set the value it travels at the same speed.


EDIT: I've noticed that this is because the shoot() function in spell.gd automatically sets the bullet's speed to the max speed when firing, so you have to change this instead. Not sure if this is intentional, but it's a bit confusing.

  • Nathan Lovato replied

    Not sure if this is intentional, but it's a bit confusing.

    It is intentional.

    First, the bullet needs to store a speed variable to move at a certain speed. So we need that variable on the bullet, and that's why it exists there.

    But we may also want different weapons to shoot the same bullet at different speeds. So we also allow controlling the projectile speed from the weapon.

    Now you may be confused by why we the default speed of the bullet isn't 0 or some invalid value like -1. And this is mostly a personal choice. We decided to give the bullet a suitable default speed value in case we use it in a new place where we don't change the default speed (a trap firing bullets, a bullet firing bullets...).