Welcome to Phrogram Sign in | Join | Help
in Search


Sprite sheet strategy

Last post 07-08-2008, 9:59 AM by knubile. 3 replies.
Sort Posts: Previous Next
  •  07-08-2008, 8:13 AM 6865

    Sprite sheet strategy

    I have a character prepared as a sprite sheet. Is there a nice way to use it in this language? I see it handles animated gifs well. I would rather not have to convert the sprite sheet into an animated gif.

    I see the cropto method. One way would be to define frames of the animation as parameters to the crop to method. Then setting a frame "6" for example would call cropto with the proper parameters to show that section of the sprite sheet. 

     Would that perform slowly?

     My goal is to have a car driving(top down scroller). When certain things happen, such as crashing, I want to be able to play a 4 frame animation of the car exploding. This is no different than a character jumping or shooting a gun. I just don't know what the common strategies are for doing this.

    A pointer in the right direction would be great. 

    Filed under:
  •  07-08-2008, 8:37 AM 6866 in reply to 6865

    Re: Sprite sheet strategy

    The reason we avoided spritesheets for Phrogram is that they are harder to deal with for beginners. As you realise there is some metadata that comes along with a sprite sheet about where each sprite lives.

    There's no reason that using the cropto method wouldn't work. You need to keep track of all the sizes and positions yourself though - can't rely on .Width and .Height of the sprite since its the whole sheet. I've not tried it but I dont think there would be a perf issue however I've certainly not tested it in that scenario.

     


    Managed DirectX and XNA ? Check out http://www.thezbuffer.com
  •  07-08-2008, 9:32 AM 6867 in reply to 6865

    Re: Sprite sheet strategy

    Take a look at :  Class   Sprites.ImageSlicer , that could help.

    Here is an example by me http://phrogram.com/forums/thread/5571.aspx. But there is also one in the tutorial section of Phrogram I remember. 

  •  07-08-2008, 9:59 AM 6868 in reply to 6866

    Re: Sprite sheet strategy

    I figured it out. I'm working on an AnimatedSprite class that will automatically handle animations for different directions. Left,Right,up,down etc..

    I'll post it when its complete. 

View as RSS news feed in XML