> make sure the player is only 1 instance, and that the value is available at all times to be read, meaning the attackspeed variable of the player should be static not changing.
>
> it should work, but is not great practice to use direct instance varible of other objects as those other objects get destroyed etc and then all ur data is lost that u are based ur other items to depend on.
>
> better have the character stats like "attackspeed" saved as a array or global variable then use that on ur bullet behavior.
>
> and to use that u need to make sure the data is set on bullet creation. in a proper order
>
> u cant have
>
> bullet set speed to player.attackspeed above the line that creates the bullet.
>
> always needs to be after bullet is created. otherwise will change all bullets in screen, or give u weird glitches.
>
> FIY the setting of bullet speed can be done using events
>
> <condition> on bullet created /spawn etc < action > set bullet.speed to player.attackspeed
>
> hope it helps.
Thank you, this helps a lot. I notice that the global variable says 'static'. So if I have a playerHealth global variable and I set it to '100' and 'static', does that mean I cannot change it when the player gets hit by a bullet?
Static
Only applies to local variables. By default, local variables reset their value to the initial value every tick. However if Static is checked, the local variable's value will persist permanently, like a global variable. Static local variables differ from global variables in that they can still only be used within their scope. Global variables always hold their values permanently so the Static option does not apply to them. For more information about local variables, see Event Variables.
Constant
Make a variable read-only. You will be able to compare and retrieve the variable, but not change its value using any actions. This is useful for referring to a number like the maximum number of lives, without having to repeat the number in your events. If you want to change the value, there is only one place you need to change, which is a lot easier than having to hunt down the multiple places you entered a particular number in your events. According to programming convention, the names of constants are displayed in upper case, e.g. MAX_LIVES.