-2
\$\begingroup\$

I'm trying to create a 2d shooter for Android. How do I spawn enemies "above" the screen, so that they "enter" the game screen instead of spawning at the top of it?

I think I need to make a game screen that is bigger than the actual view. How would I do this? I know that negative y-values would work, however that's not really the same.

EDIT: I'm using canvas and bitmaps.

\$\endgroup\$
  • \$\begingroup\$ I edited the question for clarity and removed the other questions in the process. You can still ask them as separate questions - it's just easier for people to find information if each question is really one question. \$\endgroup\$ – Anko Apr 23 '13 at 11:10
  • 6
    \$\begingroup\$ Why aren't you using negative y values if they would work? \$\endgroup\$ – MichaelHouse Apr 23 '13 at 14:06
  • 3
    \$\begingroup\$ Don't overanalyze it! It's perfectly fine to use negative x y values. \$\endgroup\$ – bandrewk Apr 24 '13 at 5:03
  • \$\begingroup\$ What they said, in addition, your enemies won't need background and stuff while off screen, if that is what you worry about, they just don't care. \$\endgroup\$ – petervaz Apr 25 '13 at 13:31
3
\$\begingroup\$

As mentioned in the comments, you could spawn the enemies with negative y-coordinates. However, if for some reason you can't do that, you can instead have a "game screen" that is bigger than the size of the view screen. Just render the center part of this game screen, and spawn enemies on the non-rendered outer edges of the game screen.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ I'd be curious to know why the OP can't use negative x and y values - they've always worked fine for me! \$\endgroup\$ – BungleBonce May 3 '13 at 9:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.