Game Development Community

I can't do that "SetLinearVelocity" work

by Jose M Pan · in iTorque 2D · 11/20/2011 (7:09 am) · 2 replies

Hi, I'm having this trouble, and I don't know what I'm doing wrong...

I have an image called "fondo01" with class FondoClass, and I have a script called FondoClass.cs, executed in game.cs file.
This FondoClass have the following function:

function FondoClass::onLevelLoaded(%this, %scenegraph)
{
%this.setLinearVelocity(0,10);
}

But nothing happens, the image doesn't move... what am i doing wrong?

Thanks!

#1
11/20/2011 (10:51 am)
You probably need to enable physics on the object. You can do this in the editor, or in code:

.
.
%this.setUsesPhysics(true);
%this.setLinearVelocity(0,10);
.
.
#2
11/21/2011 (10:09 am)
THANKS!!