To float or not to float

27624612-blog8

From my code there you can see how I calculate the player movement by getting the distance to the destination from the current position as a percent.  I was going at it for a solid 2 hours and I couldn’t figure out why my movement wasn’t working so I tried absolute values and if statements but it turns out it was retriving the numbers as integers so intead of getting the .07656441 i needed it returned 0.  Stupid mistake that wasted my time, I should’ve used float instead of integers from the start.

Advertisements

Tags: , ,

About jjyap

I'm an undergraduate student at Simon Fraser University. A lot of the fun projects and research that I work on are Computer Vision and Machine Learning related.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: