Game Development Community

odd device issue (setlinearvelocityx)

by Dave Young · in iTorque 2D · 01/24/2009 (7:59 pm) · 6 replies

In my TGB and simulation version of my simple game, I am using setLinearVelocityX on some animated sprites. Nothing crazy, values between 20 and 50.

I set 5 sprites' velocities this way, and update randomly every 10-12 seconds.

What I'm seeing is that out of 5 sprites, only 2 on the device actually will change their velocities. They're always the same 2 sprites (each is in its own unchanging row) none of the dynamically created sprites can have their velocities set either. They just don't move.

The sprites are also designed to change velocities when I touch them, and so I am positive they have non zero velocities.

Has anyone seen anything like this on device testing?

#1
01/24/2009 (8:25 pm)
Check your log/console output and see if you get any errors like "Cannot find function setLinearVelocityX" or "cannot find object ''".
#2
01/24/2009 (10:55 pm)
Make sure to run .setUsesPhysics(true) on all objects that have to move.
#3
01/25/2009 (9:13 am)
Mat:
No console errors (it's on the device) so I will need to figure out how to view its console. Only failing on the device itself, runs fine in simulator and standalone.

Conor:
The objects are created dynamically in a loop and are all the same except for the velocity. So what fails for one should fail or work for all. But good tip in general, I will try it.. it can't hurt.
#4
01/25/2009 (2:18 pm)
If you run "Debug"(even for release builds) in XCode, you can use the GDB debugger, or at least it's printouts.

Just make sure you call enableDebugOutput( true ) somewhere in your script
#5
01/25/2009 (9:31 pm)
I've found that if you call setUsesPhysics(true) on an object, then .clone(true) the clone will not move, you have to call setUsesPhysics(true) on the clones also.
#6
01/27/2009 (5:11 am)
Conor, I didn't want to believe that would work as I don't use clone(), but it did work! Thank you very much for the tip.