Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Discussion / Concatening an integer on end of variable

Author
Message
Jibbed
21
Years of Service
User Offline
Joined: 5th Mar 2004
Location:
Posted: 5th Mar 2004 23:43
Hi,
I am scrolling 5 sprites across the screen and at the moment am using the same code 5 times to do this. The variable names for the x positions are the same apart from the end number. ie xpos1, xpos2 ... xpos5.

how can I put this into a loop so that the looping variable will attach itself to the end of xpos?

Hope I made myself clear there

Thanks very much,
Jon
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 6th Mar 2004 00:24 Edited at: 6th Mar 2004 00:25
You don't want to do it like that, you want to do it like this!

Use an array...



BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
Jibbed
21
Years of Service
User Offline
Joined: 5th Mar 2004
Location:
Posted: 6th Mar 2004 04:43
Thanks BatVink,
It had crossed my mind that I could do it that way but I actually have 6 or so (sets of 5) variables to manipulate and so I would need 6 arrays. Isn't that inefficient?

If not then i'll do it your way. Unless anyone has any other suggestions.

Thanks again,
Jon
BearCDPOLD
21
Years of Service
User Offline
Joined: 16th Oct 2003
Location: AZ,USA
Posted: 6th Mar 2004 06:30
If you have 6 sets of 5 just dimension your array like

DIM TheArray(6,5)

Unless I've completely missed the target, then please tell me if I did.

Crazy Donut Productions
Current Project: KillZone
Jibbed
21
Years of Service
User Offline
Joined: 5th Mar 2004
Location:
Posted: 9th Mar 2004 20:15
No you're right, makes sense. I'll get on it. Thanks for all your help.

Cheers,
Jon

Login to post a reply

Server time is: 2025-05-23 11:54:13
Your offset time is: 2025-05-23 11:54:13