Game Development Reference
In-Depth Information
* Set the update period
*
* @param period
*/
public void setUpdatePeriod(long period) {
mPeriod = period;
}
/**
* A timer is used to move the sprite around
*/
protected void startUpdateTimer() {
mUpdateTimer = new Timer();
mUpdateTimer.schedule(new UpdateTask(), 0, mPeriod);
}
protected void stopUpdateTimer() {
if (mUpdateTimer != null) {
mUpdateTimer.cancel();
}
}
public Context getContex() {
return mContex;
}
/**
* Load an image
*
* @param id
* @return
*/
protected Bitmap getImage(int id) {
return BitmapFactory.decodeResource(mContex.getResources(), id);
}
/**
* Get AudioClip
*
* @param id
* @return
*/
protected AudioClip getAudioClip(int id) {
return new AudioClip(mContex, id);
}
/**
* Overload this to update the sprites on the game
*/
abstract protected void updatePhysics();
Search WWH ::




Custom Search