GMS 2 [SOLVED] Issue with lengthdir_y

cdgamedev

Member
Hello,
I'm trying to use lengthdir_y but when I enter
Code:
Speed = 16;
direction = 45;
vspeed = lengthdir_y(Speed, direction);
it returns 0.
However, when I enter
Code:
Speed = 16;
direction = 45;
vspeed = lengthdir_y(16, 45);
it returns -11.31 as expected.

Am I missing something or is it broken?

This only seems to happen when I assign lengthdir_y to a variable...

Code:
show_debug_message(lengthdir_y(Speed, direction) == lengthdir_y(16, 45));
Returns a value of 0...


Thanks,
Callum​
 

cdgamedev

Member
Ha! I feel stupid now. When I set the vspeed earlier on in the code, it resets the direction to 0 (as its moving in that direction)... Fixed the issue now
 
Top