I have my game set up like this:
dim shared character sprite arrays
then i set Char1Name$ = whoever i want to be the 1st character
and it will load their sprites as follows:
DEF SEG = VARSEG(Char1Right(0))
BLOAD path$ + "\Characters\" + CHAR1Name$ + "\rightTIL.til", Varprt(Char1Right(0))
DEF SEG = VARSEG(Char1RightMsk(0))
BLOAD path$ + "\Characters\" + CHAR1Name$ + "\rightMSK.msk", Varprt(Char1RightMsk(0))
the first character is the one i want walking around on the field map.
this all works fine.
when i want to switch out characters, i need to replace all the sprite arrays for char1 with different .til and .msk images so it will show someone else walking around on the map.
i thought i would be able to do this by changing Char1Name$ and then importing images again with the same def seg statements but it says "out of range" when i try and do this.
any help would be greatly appriciated.
Changing Sprite Arrays
- ThirtyNitesOfMX
- Coder
- Posts: 18
- Joined: Sun Nov 28, 2010 6:58 pm
- Location: seattle, wa
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
Did you use DEF SEG AFTER each PUT for the next BLOAD. You need to reset the pointer to the Default.
I assume each character folder has the same names and the array is big enough.
PS: I sent you an email...
I assume each character folder has the same names and the array is big enough.
PS: I sent you an email...
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
- ThirtyNitesOfMX
- Coder
- Posts: 18
- Joined: Sun Nov 28, 2010 6:58 pm
- Location: seattle, wa
- burger2227
- Veteran
- Posts: 2466
- Joined: Mon Aug 21, 2006 12:40 am
- Location: Pittsburgh, PA
This SUB uses one SHARED Image Integer Array. The sprite is indexed after the mask. Just enter the file names and PUT position. Continue PUTs from Image(0) and Image(10000).
Size the array for what you need.
Ted
Code: Select all
SUB LoadImage (Mask$, Sprite$, Col, Row)
DEF SEG = VARSEG(Image(0)
BLOAD Mask$, VARPTR(Image(0))
PUT (Col, Row), Image(0), AND
BLOAD Sprite$, VARPTR(Image(10000))
PUT (Col, Row), Image(10000)
DEF SEG ' Restore default BASIC segment.
END SUB
Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0