PDA

View Full Version : Blitz Bomber...



savage
04-04-2006, 11:59 AM
I am hoping some of you can test this game on your phones, now that I have added the appropriate MIME types to my web server.

Point your WAP phones to either the JAD file...
www.savagesoftware.com.au/download/BlitzBomber.jad
or the JAR file..
www.savagesoftware.com.au/download/BlitzBomber.jar

It should then download and install itself on your phone. Then it will be ready to play.

The game is a simple bombing game where you have to clear all the buildings to create a path to be able to land your bi-plane safely. It's unfinished and I need to fix a few things, which I will do when I have some free time a couple of weeks.

All feedback welcome and please let me know if it works on your phone and what model phone it is.

Huehnerschaender
04-04-2006, 12:31 PM
Sony Ericsson K750i

Worked well... nice job ^^

Only one thing I realized. The very first building to the left doesn't seem to have collsion. I was able to fly through it several times without being destroyed.

And: It's a little hard to aim the first few buildings when the plane switches the screenside.

Very nice work! I wish I could prog something for mobile devices myself.

Please let us now about updates!

savage
04-04-2006, 01:14 PM
Thanks for the feedback Dirk. I am aware of the collision problems.
I am in the process of adding some particle explosions when the bombs hit the buildings, though I'm not sure how much it will slow down the game. I will need to add the winning game scenario, because at the moment, even if you destroy all he buildings you still lose the game.

Hopefully in a week or so I will finish it.

A game play question, do you think it would be better if the plane flew the other way ( right to left ) at the same level, thus giving the player an extra chance to destroy the building, before it the plane drops down another 16 pixels?


I wish I could prog something for mobile devices myself.

I'm sure you could if you did not have the competition to worry about :).

Huehnerschaender
04-04-2006, 01:46 PM
In my opinion it sounds good to let the plane fly left/right in turn. This has several advantages.
I find the game a little hard right in the beginning. Giving the player another chance of aiming is a good choice, plus, targeting the most left building is exactly as hard as targeting the most right one. I found myself always loosing because I had some buildings left on the left side.
You can let it get harder just by increasing planes speed in the levels, so the double hit chance would be balanced.

savage
19-04-2006, 02:03 PM
I finally added the small particle explosion ( 20 particles ) and nothing else just to get something working. I've uploaded it to the same location.

Next on the list is fixing the problems mentioned earlier.

cairnswm
20-04-2006, 05:46 AM
Any chance of releasing that Particles code?

savage
20-04-2006, 08:20 AM
It's very basic, but here it is...

unit particle;

interface

type
// a single particle
TParticle = record
state : integer; // state of the particle
typ : integer; // type of particle effect
x,y : integer; // world position of particle
xv,yv : real; // velocity of particle
curr_color_r : integer; // the current rendering color of particle
curr_color_g : integer; // the current rendering color of particle
curr_color_b : integer; // the current rendering color of particle
start_color_r : integer; // the start color or range effect
start_color_g : integer; // the start color or range effect
start_color_b : integer; // the start color or range effect
end_color_r : integer; // the ending color of range effect
end_color_g : integer; // the ending color of range effect
end_color_b : integer; // the ending color of range effect
counter : integer; // general state transition timer
max_count : integer; // max value for counter
end;

const
// defines for particle system
PARTICLE_STATE_DEAD = 0;
PARTICLE_STATE_ALIVE = 1;

// types of particles
PARTICLE_TYPE_FLICKER = 0;
PARTICLE_TYPE_FADE = 1;

// color of particle
PARTICLE_COLOR_RED = 0;
PARTICLE_COLOR_GREEN = 1;
PARTICLE_COLOR_BLUE = 2;
PARTICLE_COLOR_WHITE = 3;

MAX_PARTICLES = 20;

// color ranges
COLOR_RED_START = 32;
COLOR_RED_END = 47;

COLOR_GREEN_START = 96;
COLOR_GREEN_END = 111;

COLOR_BLUE_START = 144;
COLOR_BLUE_END = 159;

COLOR_WHITE_START = 16;
COLOR_WHITE_END = 31;

var
particles : array[0..MAX_PARTICLES] of TParticle;
particle_wind : integer;
particle_gravity : real;

procedure ResetExplosionParticles;

procedure Draw;

procedure Move;

procedure Explode( aX, aY : integer );

implementation

uses
common;

procedure ResetExplosionParticles;
var
index, angle, velocity : integer;
begin
Randomize;

// loop thru and reset all the particles to dead
for index := 0 to MAX_PARTICLES do
begin
// compute random trajectory angle
angle := random( 360 );
// compute random trajectory velocity
velocity := random( 4 ) + 2;
particles[ index ].state := PARTICLE_STATE_ALIVE;
particles[ index ].typ := PARTICLE_TYPE_FADE;
particles[ index ].x := 0;
particles[ index ].y := 0;
particles[ index ].xv := Trunc( cos(angle) * velocity );
particles[ index ].yv := Trunc( sin(angle) * velocity );
particles[ index ].start_color_r := COLOR_RED_START;
particles[ index ].end_color_r := COLOR_RED_END;
particles[ index ].curr_color_r := particles[ index ].start_color_r;
particles[ index ].counter := 0;
particles[ index ].max_count := random( 3 ) + 3;
end;
end;

procedure Move;
var
index : integer;
begin
for index := 0 to MAX_PARTICLES do
begin
// test if this particle is alive
if (particles[index].state = PARTICLE_STATE_ALIVE) then
begin
// translate particle
particles[index].x := Trunc(particles[index].x + particles[index].xv);
particles[index].y := Trunc(particles[index].y + particles[index].yv);

// update velocity based on gravity and wind
particles[index].xv := particles[index].xv + particle_wind;
particles[index].yv := particles[index].yv + particle_gravity;

// now based on type of particle perform proper animation
if (particles[index].typ = PARTICLE_TYPE_FLICKER ) then
begin
// simply choose a color in the color range and assign it to the current color
particles[index].curr_color_r := Random( particles[index].start_color_r ) + particles[index].end_color_r;
particles[index].curr_color_g := Random( particles[index].start_color_g ) + particles[index].end_color_g;
particles[index].curr_color_b := Random( particles[index].start_color_b ) + particles[index].end_color_b;

// now update counter
particles[index].counter := particles[index].counter + 1;
if (particles[index].counter >= particles[index].max_count) then
begin
// kill the particle
particles[index].state := PARTICLE_STATE_DEAD;
end; // end if
end // end if
else
begin
// must be a fade, be careful!
// test if it's time to update color
particles[index].counter := particles[index].counter + 1;
if (particles[index].counter >= particles[index].max_count) then
begin
// reset counter
particles[index].counter := 0;

// update color
particles[index].curr_color_r := particles[index].curr_color_r + 1;
if ( particles[ index ].curr_color_r > particles[index].end_color_r ) then
begin
// transition is complete, terminate particle
particles[index].state := PARTICLE_STATE_DEAD;

end; // end if

end; // end if

end; // end else

end; // end if

end; // end for index
end;

procedure Draw;
var
index, x, y : integer;
begin
for index := 0 to MAX_PARTICLES do
begin
// test if particle is alive
if (particles[index].state = PARTICLE_STATE_ALIVE) then
begin
// render the particle, perform world to screen transform
x := particles[ index ].x;
y := particles[ index ].y;

// test for clip
if ( x >= screenWidth )
or ( x < 0 )
or ( y >= screenHeight )
or ( y < 0 ) then
break;

// draw the pixel
SetColor(particles[index].curr_color_r, particles[index].curr_color_g, particles[index].curr_color_b);
Plot(x, y);
end; // end if

end; // end for index
end;

procedure Explode( aX, aY : integer );
var
index : integer;
begin
// loop thru and set start position of to dead
for index := 0 to MAX_PARTICLES do
begin
particles[ index ].x := aX + random( 2 );
particles[ index ].y := aY + random( 3 );
end;
end;

initialization
particle_wind := 0;
particle_gravity := 0.2;

end.


The only problem I noticed is that the colours don't seem to change, so I will need to sort that out. All the particles seem to appear as black at the moment.

I also want to change the sin/cos function calls to look-up tables which I will store in my "common" unit. Not sure if it will speed things up, as it seems fine at the moment, but I suppose it couldn't hurt.