[SOLVED]Strange behaviour of 8 Direction...

0 favourites
  • 3 posts
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • I saw someone recreate Gauntlet in Javascript earlier today and I decided to try to do the same. I started about 20 minutes ago, and I ran into this strange problem with the animations. The way they are set up is that instead of responding to user input I check for 8 Direction's VectorX and VectorY variables so I can reuse the same animation code for the player and for other stuff. Anyways, it didn't work... Thankfully, I've gotten into a habit of opening my project in debug mode first and I noticed that when I press the up arrow VectorY is set to 100, and the Player object's X variable is changing correctly, however I also noticed that VectorX variable was set to like -6.32482347( ) or something but it's not applying to the player position. I just want to know if I somehow screwed something up, or my Construct 2 version is just wierd(I haven't updated in a while). I'll try update to the newest version to see if it fixes my issue...

    Update: I've downloaded the latest version, and it didn't fix the problem. These 'fantom numbers' are added when I go down, left or up.

    I also forgot to upload to .capx file...

  • Isn't this just a case of computer precision that has been discussed many times before?

    I haven't looked at your capx yet but generally this is caused by assuming a value will be exactly = to a particular value, such 0,1,2....but computers don't always produce such values.

    Maybe try forcing the value to a rounded int will help, or don't check for exact values.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yup! Simply rounding the values fixed the problem. Thanks a lot!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)