![]() |
|
API >> Tutorials >> Playfield Scrolling And Pre-Collision mode
What will we do here?Through an example, we will see how to use pre-collision mode and playfield scrolling.This tutorial is divided in 3 parts:
Description of the exampleThe example is composed of a simple labyrinth, and balls with their own behavior. It is a quite simple, but it will cover a large range of games.The labyrinthIt is composed with simple sprites called Tiles. We used the following image for them:
They are arranged in an array strored in the class Tiles.java, and then it is very easy to dispose them. Here is the playfield with only the labyrinth:
The Java code that disposes sprites in the playfield from the file DisplayTiles.java:
BallsA ball is an animated sprite with the right hand behavior (or the left hand to go to the other way). We will see in the next page how to the make the wrapper that moves a ball.The following image is the sequences pictures of the animation:
Now it is time to see what king of rules a ball use to move.
API >> Tutorials >> Playfield Scrolling And Pre-Collision mode
|