Java Reference
In-Depth Information
public boolean isVisible(int layerIndex) {
Layer layer = mLayerManager.getLayerAt(layerIndex);
return layer.isVisible();
}
private void setDirection(int newDirection) {
if (newDirection == mDirection) return;
if (mDirection == kLeft)
mQuatsch.setTransform(Sprite.TRANS_MIRROR);
else if (mDirection == kRight)
mQuatsch.setTransform(Sprite.TRANS_NONE);
mDirection = newDirection;
}
private void setState(int newState) {
if (newState == mState) return;
switch (newState) {
case kStanding:
mQuatsch.setFrameSequence(kStandingSequence);
mQuatsch.setFrame(0);
break;
case kRunning:
mQuatsch.setFrameSequence(kRunningSequence);
break;
default:
break;
}
mState = newState;
}
}
Special Effects
Although they are not strictly contained in the Game API, two other methods in the Display
class are closely related:
public boolean flashBacklight(int duration)
public boolean vibrate(int duration)
Both methods accept a duration in milliseconds that specifies how long the backlight
should be turned on or how long the device should vibrate. Both methods return true to indicate
success or false if the device does not support a backlight or vibration (or if your application is
not running in the foreground).
Search WWH ::




Custom Search