Create a game visually

Ever wanted to create a game easily without too much coding? Well you know it cannot be done without coding but things can certainly be simpler. PPL offers a nice solution to help you design the game levels and reduce coding to a minimum.

The Game Level Editor that ships with the PIDE is a unique tool that will allow you to design each levels of your game visually, just like designing a form. Each object is represented as a sprite, each sprite has it's own set of styles, properties and events.

The first step is to launch the Game Level Editor, press the Game Level Editor button on the toolbar:

Tutorial12.png

Once this is done you will be presented with an empty map. Since the GLE (Game Level Editor) is a multi-map editor you are now presented with map #1. We will use map from now on instead of level, they are the same. Now it's time to save the game to make sure that all images you will insert into the game will have a pathname that is relative to the game's current folder. If you don't save your game now, the images will be treated as static pathname and if you try to play the game on the PocketPC or from another target folder location the images won't be found. Save the game to C:\Program Files\PPL\Tutorials\MyGame.gam.

Tutorial13.png

By now you are probably thinking, "What kind of game are going to create?". I will tell right now. We will create a demo of two basketballs that will fall from the middle of screen and bounce from the screen edges acting like real balls in the real world using the GameAPI proprietary physic engine. We will assign each ball a mass, friction, shape and collision id's and let the physic engine do the rest.

Now it is time to add our first sprite. The first sprite we will add will be a basketball. Here is the important step, you will need to copy the ball.bmp image file from the C:\Program Files\PPL\Demos folder to C:\Program Files\PPL\Tutorials. This step will ensure that the image is always available to your game nomatter where the game is ran from.

Tutorial15.png

To add a new sprite to our game, click the sprite button in the toolbar on the left.

Tutorial14.png

Now, let's double-click on the sprite that was just created, it's the green empty screen on your map screen. Let's now select the ball.bmp image file from the C:\Program Files\PPL\Tutorials folder.

Tutorial16.png

The ball sprite will look like this:

Tutorial17.png

The fuschia color around the ball needs to be removed. In order to do this, we will need to change the sprite's TransparentColor property to the fuschia color. Scroll the properties list until you find the TransparentColor property then right click on it and select color fuschia. The ball sprite will now show without the borders.

Tutorial18.png

It is now time to set some properties to the sprite. We will first set the ball Mass to the value 0.5. Scroll the properties list until you find the Mass line. Change the value to 0.5. Let's apply some friction to make sure the ball slows down after a little while. Change the Friction property to 0.01. The ball needs to bounce from the screen edges, it needs to be elastic. Change the Elasticity property to 0.01. Now let's make sure the ball will not go too fast in case the rebound gets too great or too low. Change the VelLimitLow to 0 and VelLimitHigh to 10. This will make sure the ball's velocity will not go over a value of 10 pixels. The ball will need to collide with the other ball will insert later. In order to do this we need to define the ball's Id and with which Id it will collide with. Change the ball Id to BALL and the Collide value to BALL also. This will make sure two balls will collide with each other as long as their id's are both BALL.

Now that we are done with the changing the ball's properties, we need to set some of styles. We need to make sure the ball will check for collision, check the SO_CHECKCOLLIDE style. The ball will need to bounce off of screen edges (borders), check the SO_BORDER style. We also need to apply physics to the ball, check the SO_KINETIC to make sure the physic engine handles the properties we've set earlier. The collision detection needs to be done on a per-pixel basis so that only the pixels of ball will collide, check the SO_PIXELCHECK style. And lastly we need to define the ball as an oval shape for the physic engine to calculate the physical attributes accordingly, check the SO_OVAL style.

It's time to test our game, save your game and select the Run -> Run menu item.

Nice isn't it? What about we put two more balls in there and look at them bouncing off each others? Copy the first ball sprite by selecting it and selecting Edit -> Copy. Now paste the second ball, select Edit -> Paste. Do another Edit -> Paste command. Move the balls to position them in the same way the following picture shows.

Tutorial20.png

Run the program again, select Run -> Run.

Without a single line of code you have just created a nice demo with physics that you could not even imagine you could do. Image what you can do next...