1945: The game
One of the things I have always liked is being able to play games (albeit simple) made by myself ... Well, I'm looking for intenet found this book: "Programming Games for phones with J2ME" Alberto García Serrano, who even explains how to make games for Java, is perfectly adaptable to Gambas3.
1945: Versión realizada en Gambas3 |
Our plane is controlled with the cursor keys, and the game takes included:
- Movement of the airplane and the enemies (different types of enemies)
- Scrolling the map background.
- Shooting and explosions
- Artificial Intelligence: Using a state machine controlled enemy aircraft.
- Calculate Collision (between enemies and flew between our enemies and bombs and bombs among the enemy with our plane)
We see a bit of the code:
The project outline is as follows:
As you can see we have the Sprite class, which is the father of several classes. This class is responsible to handle images (sprites or tiled). Then we have several that inherit from it, which are responsible for specifying concrete as they move or aircraft type (in the case of the enemies we have several types of movements)
The "game loop", the heart of the game is done by a Timer object, which updates the position of objects (airplanes, gunshots, explosions, collisions calculation)
-The "game loop", the heart of the game is done by a Timer object, which updates the position of objects (airplanes, gunshots, explosions, collisions calculation)
-
and then calls the event _draw DrawingArea to repaint all
-
-
Download the source code and installer book: alojado en https://drive.google.com
Hope you like it.
greetings
Julio