- Code: Select all
Vector v = getAccelerometer();
xvelocity = v.y * -70;
can anyone help?
Vector v = getAccelerometer();
xvelocity = v.y * -70;
if(xvelocity>0)
{
// ChangeAnimation to run right NO_CHANGE
}
else
{
// ChangeAnimation to run left NO_CHANGE
}
skydereign wrote:Oh, that is the problem you were having? You should have mentioned you were having problems with animations. Anyway, if the animations are in a certain order, than you can use that to your advantage, and avoid an if. Otherwise, you'll probably have to use an if.
- Code: Select all
if(xvelocity>0)
{
// ChangeAnimation to run right NO_CHANGE
}
else
{
// ChangeAnimation to run left NO_CHANGE
}
Also it depends on if the actor can use other animations, for example jump. If so then the above won't work with the jumping, but hopefully that is enough to get you going.
if(xvelocity>0)
{
// ChangeAnimation to run right NO_CHANGE
}
else if(xvelocity<0)
{
// ChangeAnimation to run left NO_CHANGE
}
else
{
//ChangeAnimation to standing still NO_CHANGE
}
Users browsing this forum: No registered users and 1 guest