Recent

Author Topic: [SOLVED-WORKAROUND] SpriteAnimation Ctrl - Animate sheet w/multiple Rows  (Read 4936 times)

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Hi,

I can get a horizontal sprite (3 frames) anim to work fine.

But how do I animate a sprite sheet that is 4 columns (horz) by 3 rows (vert) - 12 frames???

I can't seem to make it work out of the box.

Is there any example/tutorial that demonstrates this behavior?

Thanks in Advanced.
« Last Edit: April 03, 2020, 07:58:25 pm by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #1 on: April 02, 2020, 11:15:59 pm »
Anyone have any info... documentation I can lookup?
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #2 on: April 02, 2020, 11:25:33 pm »
Hi

What method are you using to display sprites? What surface and what tools do you have at your disposal?
Conscience is the debugger of the mind

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #3 on: April 02, 2020, 11:38:13 pm »
Hi

What method are you using to display sprites? What surface and what tools do you have at your disposal?

I just used the small tutorial on the wiki. Works fine.
It uses the horizontal image.

Using SprintAnimation control.
No fancy code... the animation works out of the box with just basic speed wxh code.

But, how do i do a sprite with rows and columns image.

Tried to get it to work out of the box using just the control, but it shows the whole sprite each frame.
Have not tried any other code because I don't even know what methods to use.



« Last Edit: April 02, 2020, 11:41:36 pm by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #4 on: April 02, 2020, 11:47:43 pm »
This is a sample sprite I am trying to animate.

Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #5 on: April 03, 2020, 01:26:04 am »
just modify the image to fit the requirements of the control, in other words, resize the image canvas to fit all the rows horizontally, cut and paste the rows and resize the image canvas to fit one row

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #6 on: April 03, 2020, 01:57:58 am »
I don't want to do that.

Do a search on G images... most all sprites sheets have rows and columns.

I want the app I am making to account for sprite standards which is rows and columns.

I am not doing this just for myself.
If I were I would of already put all sprites on one row.

So, can the SpriteAnimation do that or not?
If not, that would be a major feature you have to have... its industry standard.
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

Roland57

  • Sr. Member
  • ****
  • Posts: 421
    • msegui.net
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #7 on: April 03, 2020, 03:30:31 am »
Hello!

@pixelink

By taking a look at bgraspriteanimation.pas, you can see that the component isn't made to do directly what you wish.

You could follow what lainz suggested, and write a little procedure to convert pictures.

You could also modify the component.
My projects are on Gitlab and on Codeberg.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #8 on: April 03, 2020, 04:03:18 am »
Hi!

If you don't like the instructions of Lainz, then there is a harder way:

Copy all your sprites to a GIF-file. That was discussed here some time ago.

And then you can place that GIF anywhere and at any time you like with BGRAspriteAnimation.

Works nice and fluent with animated GIFs.

Winni



lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #9 on: April 03, 2020, 04:44:17 am »
I don't want to do that.

Do a search on G images... most all sprites sheets have rows and columns.

I want the app I am making to account for sprite standards which is rows and columns.

I am not doing this just for myself.
If I were I would of already put all sprites on one row.

So, can the SpriteAnimation do that or not?
If not, that would be a major feature you have to have... its industry standard.

You need to do that only once before loading the image into the component.

Is easy to do, just a few lines of code to do the conversion.

Roland57

  • Sr. Member
  • ****
  • Posts: 421
    • msegui.net
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #10 on: April 03, 2020, 04:55:34 am »
Is easy to do, just a few lines of code to do the conversion.

As I was interested in the problem, I tried to do it. The result doesn't look perfect. I don't know if it comes from my method or from the original picture.  :-\
My projects are on Gitlab and on Codeberg.

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #11 on: April 03, 2020, 12:38:38 pm »
Well, seeing the control can't do this out of the box (which it should in a future release)

My second thought was to manually display on a canvas or something) using BGRABitmap.

Thanks, Roland57,
The only I see I need to add some spacing on your code
I will work on this some more.


Thanks all!!!
« Last Edit: April 03, 2020, 08:02:51 pm by pixelink »
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #12 on: April 03, 2020, 01:33:50 pm »
Did a test... something didn't look right.

The sprite output is out of order.
Should read 1st row, 2nd row, 3rdrow (from left to right in order 1-12

See screen.
@Roland57... good start.

Now, I need to figure out how to get them in the correct order.

Thanks buddy!!
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #13 on: April 03, 2020, 06:53:15 pm »
I can't imagine how you scrambled them unintentionally.
Conscience is the debugger of the mind

Roland57

  • Sr. Member
  • ****
  • Posts: 421
    • msegui.net
Re: SpriteAnimation Ctrl - Animate sheet w/multiple Rows
« Reply #14 on: April 03, 2020, 07:10:51 pm »
Yes, that's right. Pictures aren't in the good order. I have made a mistake somewhere.

https://opengameart.org/content/good-fruits-m484-games

« Last Edit: April 03, 2020, 07:25:08 pm by Roland57 »
My projects are on Gitlab and on Codeberg.

 

TinyPortal © 2005-2018