Page 1 of 1

Posted: Wed Jan 29, 2003 11:51 pm
by BackupUser
Restored from previous forum. Originally posted by Kerfew.

Hey everyone else is far ahead of me. I haven't programmed since the ealry AMOS days, so I need a kick start. :)

I'm animating a sprite, and since I can't find a animation caller, I assume I'm doing it correctly. Well my way of correctly anyway. (quick and simple) My main problem is I can't recall how to use an array. Dim is the command I think, but I'm not following the examples out there.

Dim MyArray.l(41)
Dim MultiArray.b(NbColumns,NbLines)

Okay Dim is obvious, My/Multi is a name you assign, the content inside the brackets are the details given to the name, or amount of space allocated. But what does the .? part mean... Dim Blah.?(41) as an example.

I'm seeking to reduce or impove the LoadSprite() code shown below

LoadSprite(0, "paulosr1.bmp", 0)
LoadSprite(1, "paulosr2.bmp", 0)
LoadSprite(2, "paulosr3.bmp", 0)
LoadSprite(3, "paulosr4.bmp", 0)
LoadSprite(4, "paulosr5.bmp", 0)
LoadSprite(5, "paulosl1.bmp", 0)
LoadSprite(6, "paulosl2.bmp", 0)
LoadSprite(7, "paulosl3.bmp", 0)
LoadSprite(8, "paulosl4.bmp", 0)
LoadSprite(9, "paulosl5.bmp", 0)

Help!!!! :)


Kefrew
confused - dazed - but not dead

Posted: Thu Jan 30, 2003 12:07 am
by BackupUser
Restored from previous forum. Originally posted by Kerfew.

And while I've hopefully got your attention, is there any way to resize/stretch a sprite?

Kefrew
confused - dazed - but not dead

Posted: Thu Jan 30, 2003 12:33 am
by BackupUser
Restored from previous forum. Originally posted by DemonHell.
Originally posted by Kerfew
Okay Dim is obvious, My/Multi is a name you assign, the content inside the brackets are the details given to the name, or amount of space allocated. But what does the .? part mean... Dim Blah.?(41) as an example.
The part after the "." tells PureBasic what type of variable you want the array to be (See the manual for more info on types)

eg. Dim Blah.s(5) would declare an array of 6 strings..yup, 6!
(PB starts array lists at 0)

Posted: Thu Jan 30, 2003 1:25 am
by BackupUser
Restored from previous forum. Originally posted by PB.

> Dim Blah.s(5) would declare an array of 6 strings..yup, 6!
> (PB starts array lists at 0)

A lot of Basics start array index at 0 -- not just PureBasic.

Posted: Thu Jan 30, 2003 7:53 am
by BackupUser
Restored from previous forum. Originally posted by Danilo.

Kerfew:
I could probably make your life with Sprite Animations
a little bit easier.
Yesterday i prepared new help file for my AnimSprite
library, so if you want i can send it to you by eMail.
(including small examples)

cya,
...Danilo
(registered PureBasic user)

Posted: Thu Jan 30, 2003 11:52 pm
by BackupUser
Restored from previous forum. Originally posted by Kerfew.

Hi Danilo, thanks for the offer mailto:kerfew@neontokyo.com It's been such a long time since I did anything, it's like starting all over again. Though it does slowly trickle back in eventually. :)

Kefrew
confused - dazed - but not dead

Posted: Fri Jan 31, 2003 5:39 am
by BackupUser
Restored from previous forum. Originally posted by Starax.

For N=0 to 4
LoadSprite(N,"Paulosr"+Str(N+1)+".bmp",0)
LoadSprite(N+5,"Paulosl"+Str(N+1)+".bmp",0)
Next

I've not tested this but I think you'll get the idea.

If I was you I'd rename to sprite filenames to something like "Paulos1.bmp"
Then you could have:

For N=0 to 9
LoadSprite(N,"Paulos"+Str(N+1)+".bmp",0)
Next

But I guess an even better way would be to have all your sprite's frames in a single image file and then you could load the file and extract them from that.