It's kind of like what I said.  You're at the point now where you need
to take a step back and look at the big picture before you can move
forward and make things more interesting.

If I were you, my end goal would be to have a design that lets me
write a bit of code that looks like this:

if (spacePressed) {
  bullets.add(new Bullet(turret.x, turret.y, turrent.rotation));
}

It all comes back to the modeling that I'm talking about.  Put the
bullet behavior in a Bullet class, and update all Bullet instances
from your main class.  Bullets are easy, they travel in a direction at
a speed from a given point.  Using code like this, you can have many
bullets in-play easily :)

On Jan 19, 3:50 am, Niksa Lovrinic <niksa.lovri...@gmail.com> wrote:
> Thank you guys and especially Robert,
>
> But the question would be, how do I make that the bullet is fired on a
> single SPACE key press from the turret to the end of the screen?
>
> That's my problem.
>
> Nick
>
>
>
>
>
>
>
> On Wed, Jan 19, 2011 at 7:16 AM, Kevin Duffey <andjar...@gmail.com> wrote:
> > Or read Robert's post.. follow his blog, follow the links. He has a ton of
> > good info on there. As I am finding out, game development is not for the
> > faint of heart. It takes years to become really good at it and understand
> > all the ins and outs. Thankfully we have people like Robert and some others
> > that are willing to share their processes, problems and even code to help us
> > out!
>
> > On Tue, Jan 18, 2011 at 7:00 PM, Zsolt Vasvari <zvasv...@gmail.com> wrote:
>
> >> If I recall correctly, LunarLander is not exactly the best example of
> >> game design for Android.
>
> >> If I were to create an Android game, I'd start with the source of
> >> Replica Island.
>
> >> On Jan 17, 12:37 am, Niksa Lovrinic <niksa.lovri...@gmail.com> wrote:
> >> > 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 android-developers@googlegroups.com
> >> To unsubscribe from this group, send email to
> >> android-developers+unsubscr...@googlegroups.com<android-developers%2Bunsubs
> >>  cr...@googlegroups.com>
> >> For more options, visit this group at
> >>http://groups.google.com/group/android-developers?hl=en
>
> >  --
> > You received this message because you are subscribed to the Google
> > Groups "Android Developers" group.
> > To post to this group, send email to android-developers@googlegroups.com
> > To unsubscribe from this group, send email to
> > android-developers+unsubscr...@googlegroups.com<android-developers%2Bunsubs 
> > cr...@googlegroups.com>
> > For more options, visit this group at
> >http://groups.google.com/group/android-developers?hl=en

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

Reply via email to