Game Development Reference
In-Depth Information
goldcoins.add((GoldCoin)obj);
}
// unknown object/pixel color
else {
...
}
lastPixel = currentPixel;
}
}
...
}
This code adds the actors to the level loading process in the init() method. Next,
make the following changes to the render() method:
public void render (SpriteBatch batch) {
// Draw Mountains
mountains.render(batch);
// Draw Rocks
for (Rock rock : rocks)
rock.render(batch);
// Draw Gold Coins
for (GoldCoin goldCoin : goldcoins)
goldCoin.render(batch);
// Draw Feathers
for (Feather feather : feathers)
feather.render(batch);
// Draw Player Character
bunnyHead.render(batch);
// Draw Water Overlay
waterOverlay.render(batch);
// Draw Clouds
clouds.render(batch);
}
Then, add the following lines to Level :
public void update (float deltaTime) {
bunnyHead.update(deltaTime);
for(Rock rock : rocks)
rock.update(deltaTime);
for(GoldCoin goldCoin : goldcoins)
goldCoin.update(deltaTime);
for(Feather feather : feathers)
 
Search WWH ::




Custom Search