Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Bug Reports / move sprite behavior if velocity is less than 1.5

Author
Message
Argon Knight
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Gastonia, NC, USA
Posted: 11th Aug 2010 04:25
Using darkbasic pro u75. Behavior also present in darknet 1.2, using the cdark object.

I've attached my test project.

If I use the "move sprite num,1" command, using a velocity of 1, on certain rotation angles (like 135 degrees), the sprite will not move. Plus, it never moves beyond the edge of the screen for a screen wrap test to work. The first velocity that made the sprite act "normal" was 1.5. The same bad behaviour occured with velocity values 1.1, 1.2, 1.3, and 1.4.

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 11th Aug 2010 21:06
I guess this is because you're rounding everything to integers.

If you move a distance of only one unit that will typically correspond to changes of less than one unit in the x and y directions considered separately, so the values can get truncated to zero.

The real question is why does it move at all for small values such as 0.01? So perhaps there's something else going on behind the scenes?

Looks like the rounding method needs some attention.
Argon Knight
21
Years of Service
User Offline
Joined: 29th Aug 2002
Location: Gastonia, NC, USA
Posted: 11th Aug 2010 21:45 Edited at: 11th Aug 2010 21:46
I matched the float's and int's in several tests in dbp and .net, and it didn't change the behavior. I looked at the dgdk c++ code from google to see if it was something like type casts. (havent been able to setup a debug enviro for that code base yet, so I just browsed) I was wondering if it's in the sin and cos function becuase it only seems to happen in certain quads. However, its using dx3d to convert to radians, then microsoft's standard sin/cos routines, and then the compilers type casts. so ... ehh, I changed my code to refelct a minimum velocity of 2.

From the google code base, under the CSpriteC Move() function:

Login to post a reply

Server time is: 2024-04-16 10:46:52
Your offset time is: 2024-04-16 10:46:52