* * * *

Adventure! Another new action game is out!


Adventure!

Exactly 2 weeks have passed since I published last game. How was I going? Well, in the beginning, I watched google I/O. (When was it? Well, That began on June 27) I stayed up late to watch key notes. At the end of key notes, there was sky diving show, which commands good view of San Francisco in sunny sky! (In japan, it was 3 o’clock midnight..) Before starting the next project, I learned how to use 3-D graphic tool “Blender”. (But it was merely practice. I hope I can create something with “Blender” later on..) You can download “Adventure” from Google play, here.

So, what can I improve on?

As always, I had a few plans. From there, I finally choose the one which looks available for my current ability. The one I gave up was skateboard, where the character skates on slopes. Another plan was pendulum, where the character hangs on and swings back and forth. I hope I can make them sometime later. Still, I don’t feel confident about handling background. So, I decided to focus on this issue.

So, What’s the difference?

For action games, in terms of background handling, I think, they are divided into 2 categories. 1) automatic scrolled background. 2) background follows character’s movement. My previous games(stomp, Runner) use (1) method. In this method, the character is fixed (It is fixed in x, but not fixed in y)at some position and backgrounds scrolled at constant speed. (Because of background scroll, it gives false feeling that a character moves.) As for (2) method, my previous game, “Jumpman” and “Stomp2” use this method. But in this project,what I wanted to create was a huge background, which consists of several stages. In my previous games, I always use randomized objects.(Such as, enemies are created at random place in random intervals.) But this time, I wanted to create all scenario beforehand. (Enemies information are all included in background map.)

Camera work

To use (2) method, I created a camera function as follows.

 public Camera() {         
   public void setMatrices(GL10 gl) {       
    	gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glLoadIdentity();
        gl.glOrthof(camera.x - DISPLAY_WIDTH/2, 
                    camera.x + DISPLAY_WIDTH/2, 
                    camera.y - DISPLAY_HEIGHT/2, 
                    camera.y + DISPLAY_HEIGHT/2, 
                    1, -1);
        gl.glMatrixMode(GL10.GL_MODELVIEW);
        gl.glLoadIdentity();
    }

    public void setPosition(){
    	if(mainchar.x > camera.x){
    		camera.x = mainchar.x;
    		return;
    	}    	
    }

Here, my DISPLAY_WIDTH =3f, DISPLAY_HEIGHT=2f and my WORLD_WIDTH=30f, WORLD_HEIGH=2f. “setMatrices” is called for every frame “rendering”. “setPosition” is called for every frame “update”. According to this code, when a character positions at left half of display, the camera doesn’t move. On the contrary, if a character positions at right half of display, the camera follows a character, which always position a character at center of display. For (1) method, because the character doesn’t move, the camera never moves. But for (2), you need to handle this kind of camera work.

Tiled map

Recently, to create background, I always use “tilemap editor“, which is freeware and very handy. It is saved as sequence of numbers, so you can edit with text editor. I copy these numbers in my code and store them in array. Each value is stored as “cell” class with row and col numbers. (which are used to calculate WORLD coordinates.) For every frame “rendering”, only cells which are visible (within display) are drawn. When creating background map, I put enemies, as well. But enemies are not drawn as part of this map. Because they merely indicate initial positions. They have their own velocities, separate from map.

Collision detection

Because using cells, I think, collision detection can be managed in very effective way. Usually, when you do collision detection, the main character has to be checked with all obstacles within display, which takes up time. But, because we use cell (which is 32 pixel = 0.2f by size) You know exactly in which cell, the main character is located as follows.

int row = (int)(char_x / cell_size);
int col = (int)(char_y / cell_size);

To do collision detection, at most you need to check the cells from row-1 to row + 1, col-1 to col + 1, in stead of checking entire display. I think this contributes to speed performance.

Create stages

I longed for creating games, which consists of several stages. In addition, I want to have checkpoints, where the character fails, it restarts from the saved point. To create sages, I use boats. You can’t ride on a boat, until you complete the mission. The boats are positioned at opposite side. When the player completes the mission, it starts moving toward player’s island. Checkpoints are created at initialization when the tiled map is converted into cells. Each checkpoint has starting point and ending point. When the player is within its range, it means that player locates at that stage. When the player fails, it is forced to go back to starting point of that stage.

How to play the game?

This is a kind of action game. The objective of this game is to complete all stages within minimum time. You are a fox. There are 6 stages to complete. At each stage, you need to correct 4 dollar bags. (You can’t go on next stage, without completing the mission.) if you collide an enemy, you lose your life. If your life is zero, you start over the stage.
KEYS)
Left arrow: walk left
Right arrow: walk right
UP arrow: jump up or climb up the vines
Down arrow: crouch, or climb down the vines
UP arrow + (Left arrow or Right arrow): Jump left or right

There are 2 kinds of enemies.
1. Monster
Avoid collision. If you stomp on it, you gain 10 score.
Crouch doesn’t work.

2. Bee
Avoid collision. If you stomp on it, you gain 10 score.
To avoid collision, Just crouch!

Complete all stages within minimum time. Good Luck!

You tube demo video

You tube demo video is here. It is easy game, so that you can understand how to play it, by just watching it. Thank you for reading! Have a nice day!

back to top