Hello everybody,

I've been playing with the LunarLander example and tried to make my own
thing out of it...

On the right bottom screen, I've got a tank that is not moving and his
turret that's moving up and down. It's supposed to shoot missiles at
different angles.

I've got a tank, turret and a bullet and they are a Bitmap image.

private Bitmap tank;
private Bitmap turret;
private Bitmap bullet;

Turret only rotates from angle 0 to angle 75, and I did that with the
update...

I managed to get the turret moving but now I'm finding it hard to shoot
missiles.

*doDraw method*
*
*
private void doDraw(Canvas canvas) {

         canvas.drawBitmap(backgroundImage, 0, 0, null);

         canvas.drawBitmap(tank, x_tank, y_tank, new Paint());

//Rotating the turret
         canvas.rotate((float) mHeading, (float) x_turret + mTurretWidth,
y_turret);

         canvas.drawBitmap(turret, x_turret, y_turret, new Paint());


??? what should I write here for the bullet to be seen shooting out of that
turret

        }

*Update method*
*
*
private void updateGame() {

            long now = System.currentTimeMillis();

            if (mLastTime > now)
             return;
            double elapsed = (now - mLastTime) / 1000.0;


            if (dUp) // UP key
             mHeading += 1 * (PHYS_SLEW_SEC * elapsed);

            if (mHeading >= 75) mHeading = 75;

            if (dDown) // DOWN key
              mHeading += (-1) * (PHYS_SLEW_SEC * elapsed);
         if (mHeading < 0) mHeading = 0;

            i
f (dSpace){

         // Fire bullet SPACE key
                        ??? what should I write here for the bullet to be
seen shooting out of that turret
                         ??? When is the method doDraw being called??



            }

         m
LastTime = now;


        }


Thank you so much guys,

Nick


*
*
*
*

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to