public class BackgroundImageScene extends Scene
If you want your game to have a background more interesting than a SolidColorScene
,
create a new instance of this class with your desired image and pass that to the
GameObjectManager.setScene(Scene)
method.
Constructor and Description |
---|
BackgroundImageScene(GameObjectManager manager,
int id)
Create a new BackgroundImageScene with the given image.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(android.graphics.Canvas c)
Used by the game engine to draw the image on the screen.
|
void |
setImage(int id)
Change the image associated with this scene.
|
public BackgroundImageScene(GameObjectManager manager, int id)
manager
- pointer to the current game object managerid
- resource ID of the image (eg R.raw.background_level1
)public void setImage(int id)
This can be used sparingly (for example, if you want the "lights" to turn off on a scene so it gets darker at some point) but probably isn't high-preformance enough to use it to make an animated background (ie, don't call setImage every single game update() loop!
id
- resource ID of the image (eg R.raw.background_level2
)