Drawsprite Function and the values it takes

Previous topic - Next topic

XanthorXIII

Ok, from my understanding Drawsprite takes Integer based values on the call for drawing on the Screen. However I have run into a situation where I need to choose a random X position at the top of the screen, choose a random x position at the bottom of the screen. Using Atan I calculate the Angle and then use COS and SIN to get the X/Y offset for drawing. However when I send those values to Drawsprite, my values get truncated after the . and I'm left with 0's. Has anyone run across this situation that they need to have a sprite move at an angle but calculate correct offsets that Drawsprite won't kill the values?
Owlcat has wise

MrTAToad

It sounds as though you are doing the calculations using integers.  If so, use floating-point variables and pass them to DRAWSPRITE

XanthorXIII

I'll double check to make sure that I am passing reals but I am fairly certain that drawsprite will truncate my values as Integers. Also I may need to clean up my code some. I'm not at my machine at the moment.
Owlcat has wise

MrTAToad

Oh yes, DRAWSPRITE will use integers, but that shouldn't make any difference...

Moru

I have been using floats just fine for coordinates for all sprite drawing. (That was the only way before we got integers :-)

XanthorXIII

Thanks for the clarification. Looks like I just had to go through and clean up my code. Decided to get fancy with TYPES and that helped me out a ton.
Owlcat has wise

MrTAToad

Types are very useful - you cant go wrong with them!