0
\$\begingroup\$

Hello Im very new to this so I don't even know what this process is called exactly. Im posting image of flappy bird here in which it consist all the objects day, night, birds, font etc Here : enter image description here

So how to use them in 2D game? this is just example i have used. How to manipulate different objects at different coordinates ? Thanks.

\$\endgroup\$
1
\$\begingroup\$

"A texture atlas is a large image containing a collection, or "atlas", of sub-images" - So basicly since we have sub images we will need sub rectangles.

Depending on what you want to do, the engine you use you would use this in diferent sections.

For example, in my engine I do something like this

MyTexture.Draw(Position,SubRect,Texture ,(...));

SubRect is the section of the atlas I want , My Atlas is 100*100 I want the the piece that stays at (50,50) and is 10 Width and 10 Height, So my sub rect is equal to (50,50,10,10). this says to my engine to "slice" that part and render it a Position coordinate.

From the look of your answers you need to learn a few things before. You lack knowledge on game design.

Either way, adressing your second question,

To manipulate each sprite as independent object, you would have a abstraction class called GameObject in my case, which has a Sprite associated.

So when I loop through my objects and draw them I actually Draw the Inner Sprite at the Object position, this way I can do what i want with my Objects and they will be aligned to their sprites.

Hope this helps!

| improve this answer | |
\$\endgroup\$
1
\$\begingroup\$

That would be called a sprite sheet/texture atlas. Your game would have objects and might have textures that all reference the same image but specify different locations. So when you go to render them, you simply load the same image, while drawing a different portion of the image. This is done differently in different frameworks/engines/platforms/etc.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ How to use them? Using coordinates or something else? Im thinking to use them in android. \$\endgroup\$ – user3471174 Jun 9 '14 at 5:19
  • \$\begingroup\$ You would have to read more into general game design with sprites before trying to use a spritesheet. \$\endgroup\$ – CobaltHex Jun 9 '14 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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