-1

How could I use this sprite sheet to implement the characters in my game

Sprite sheet - https://www.deviantart.com/gooperblooper22/art/Space-Invaders-Sprite-Sheet-135338373

Clickz
  • 75
  • 9
  • Welcome to Stack Overflow! Please take the [tour] and visit our [help] to learn what kinds of questions are appropriate for this site. If you can [edit] your question to fit the requirements of this site, please do so. – Joe C Nov 06 '18 at 06:20
  • Well, to be honest, it's no a "proper" sprite sheet. A sprite sheet should focus on a individual character, should be in a grid pattern when each sprite is the same size, so you can carve it up in memory. If you'd like to a better understand of how you might manager a (good) sprite sheet, you could have a look at [this example](https://stackoverflow.com/questions/35472233/load-a-sprites-image-in-java/35472418#35472418) – MadProgrammer Nov 06 '18 at 06:26

1 Answers1

0

As MadProgrammer mentioned the best solution would be to split the sprite sheet into several dedicated ones.

But if you want to go with it as it is (and assuming you are not using OpenGL):

Create a class like SpriteAnimation holding a reference to the loaded image (maybe BufferedImage) and an array for the definitions what the actuall relevent parts of the image are. This question seems like a great resource of how to draw the image.

You will need to extend the code for the animation part switching the "sprites" depending on the timesteps and your animation needs. This question shows how to define the parts and animate them.

monty
  • 7,888
  • 16
  • 63
  • 100