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.


closed as not a real question by MichaelHouse, msell, Nate, Josh, aaaaaaaaaaaa May 6 '13 at 20:45

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. If this question can be reworded to fit the rules in the help center, please edit the question.

  • \$\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

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.

  • \$\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.