123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|542|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> begginer needing help makeing a animated sprite from a sprite sheet

Posted : Saturday, 21 April 2012, 06:54
daniel11111112


i want to turn this into a animated sprite but have no idea ill be back later on today to see any responses but i gotta go for 30 mins or so thanks in advanced for helping.
Posted : Saturday, 21 April 2012, 07:59
steve_ancell
Are you doing this in Blitz3D?.
---
I will pop over at some point and show you a couple of ways how it can be done.

Simple way is to use LoadAnimImage(file$, cellWidth, cellHeight, firstIndex, frameCount) and use DrawImage imageHandle, x, y, frameIndex.

A bit more advanced but makes sense in the long run would be to use plain old LoadImage(file$) and use DrawImageRect imageHandle, x, y, rect_x, rect_y, rect_width, rect_height.

The DrawImageRect method will allow for sprites with different size frames as opposed to fixed sized frames that you get with LoadAnimImage.

|edit| Amost forgot... The way you would tell you program how big each frame in each sprite, you simply store it in a User Defined Type. Look up "Type" in the Blitz3D docs. |edit|

|edit| The latter method also includes the use of Object and Handle which are a bit alien at first but become clearer when you realise the potential of these commands |edit|
Posted : Saturday, 21 April 2012, 09:10
daniel11111112
thanks
Posted : Saturday, 21 April 2012, 09:20
shroom_monk
To make things slightly easier, you may also wish to consider putting all the sprites in a grid without the text. This will make it easier to use with LoadAnimImage as you won't have some cells containing text or not being aligned correctly - so long as you can remember which sprite represents what without the labels!

-=-=-
A mushroom a day keeps the doctor away...

Keep It Simple, Shroom!
Posted : Saturday, 21 April 2012, 09:42
JL235
It can also be useful to have all frames, such as movement and attack, the same size. Any unused space you keep as transparent.

That way when you switch from movement to attack, you just change your sheet, and it all works seamlessly. You don't have to worry about different frame sizes.

-=-=-
PlayMyCode.com - build and play in your browser, Blog, Twitter.
Posted : Saturday, 21 April 2012, 11:31
steve_ancell
To make things slightly easier, you may also wish to consider putting all the sprites in a grid without the text. This will make it easier to use with LoadAnimImage as you won't have some cells containing text or not being aligned correctly - so long as you can remember which sprite represents what without the labels!

Thanks for simplifying it shroomus.

|edit| I never was that good at explaining things. LOL |edit|
Posted : Saturday, 21 April 2012, 12:29
shroom_monk
Nah, your explanation was perfectly fine.
Posted : Saturday, 21 April 2012, 12:54
steve_ancell
Yeah but a bit long winded. LMAO!