Menu

#8 Add ImageSheet system

none
accepted
Reylak
2013-06-13
2013-06-12
Reylak
No

We plan to change the way Sprites are created (more than [#7]): instead of giving them an image, we give a table of frames called a SpriteSheet.

Quoting Lolman (Jacen.Guardian):

I think what follows:

  • Sprite should work with a SpriteSheet (or Anim, choose the name you want) object;
  • SpriteSheet would be in fact a table of Image which would have a
    2 ctor;
  • the first ctor takes one filename, the width and the height of one frame as its arguments;
  • the other ctor takes a list of files which are individually the frames (1 file = 1 frame);
  • then we can access the resulting table of Image using SpriteSheet[n];
  • finally, the sprite ctor becomes "Sprite.new(tableOfImage, delay)", so there are many possibilities: "Sprite.new(SpriteSheet1, 50)", "Sprite.new({ SprSheet2[1], SprSheet1[3], SpriteAnim3[1] }, 100)", etc.;
  • finally the Images are outside the Sprite, editable, and we can even draw them directly (this isn't a replacement of drawFrame but could be): "screen.blit(SCREEN_UP, 20, 20, SprSheet1[1])". We can also use the same frame of a spritesheet for many sprites.

Instead of making two constructors, we only make one that is able to handle both calls (by checking the types of its arguments).

Related

Issues: #7

Discussion

  • Reylak

    Reylak - 2013-06-13
    • summary: Add SpriteSheet system --> Add ImageSheet system
     
  • Reylak

    Reylak - 2013-06-13

    Modification: this system should be generic and could be used for Maps too.

    We would have a function to load and split the image file, then we can create a new Sprite or Map from it.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.