Documente Academic
Documente Profesional
Documente Cultură
html
Prerequisites
This tutorial assumes you have knowledge of, or programming experience with, the following technologies.
In the above image we can see the scene editor which offers several important features.
The Editor panel takes up most of the space. We can drag layers to change their positions in the scene using the mouse. By right-clicking the mouse in the editor panel a number of other options become available to add and remove layers as well as to change various layer attributes.
Source button switches to source editor and allows us to preview the generated Java code
Game Builder button switches back to graphical view Component combo box which contains all existing game components and allows navigation between them
Create new Scene button Create new TiledLayer button Create new Sprite button
In the left bottom part of the IDE is the Game Builder navigator. When the Scene Editor is open, the navigator lists all of the layers used in the scene as well as their attributes as they relate to the scene:
Z order also known as stacking order shows which layer is on top and which is on the bottom. Note that 0 denotes the top-most layer.
View determines is the layer is shown or hidden Lock determines if layer can be moved around the scene or if it must remain stationary
Name of the layer X position of the layer relative to the scene Y position of the layer relative to the scene
In the resulting dialog enter 'Sand' as TiledLayer name and select the '/topviewtiles.png' image. The tile size is 16x16 pixels so the preset tile width tile height should be fine. Press OK. The Tiled Layer editor appears. The editor contains several components:
Paint mode button Selection mode button Information about the currently displayed Tiled Layer
Editor panel in the center Animated tile list on the right, the list already contains a single animated tile which is used in the Forest scene in the Water tiled layer
Image resource panel on the bottom which allows us to select a tile either for painting or dropping onto the editor panel
Click the 'Paint mode' button on the toolbar and select the 'sand' tile (index 1) in the image resource panel. Then drag the mouse across the editor panel to 'paint' with the selected tile. Notice that the editor panel automatically expands if you paint past the edges. Then select another fitting tile (index 2 or 3) and paint some grassy or rocky patches. When you are done the tiled layer editor may look similar to the image below.
At this point we have created a new and very simple game level. To get the newly created level to activate during game play we need to do some coding. Luckily you can just download Media:DemoGameCanvas_CreatingJavaMEGamesWithGameBuilder.java and use it to replace the one in your project. The updated code will switch the game to the 'Desert' level when main sprite 'Karel' walks to the bottom-right corner of the 'Forest' level.
Finishing up
This tutorial is not designed to show you how to create a commercial quality game as walking a
sprite around with nothing much to do can get pretty boring. However, you now have a good starting place to get started with basic MIDP game development. More information about the technologies used in this tutorial are available on following pages:
Attachments
Media:DemoGameCanvas_CreatingJavaMEGamesWithGameBuilder.java