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
Dim on Dim
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by DemonHell.
eg. Dim Blah.s(5) would declare an array of 6 strings..yup, 6!
(PB starts array lists at 0)
The part after the "." tells PureBasic what type of variable you want the array to be (See the manual for more info on types)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.
eg. Dim Blah.s(5) would declare an array of 6 strings..yup, 6!
(PB starts array lists at 0)
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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)
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)
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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
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
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
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.
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.