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.

Newcomers DBPro Corner / X=1 and 2?

Author
Message
Yitzu
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location:
Posted: 13th Apr 2010 07:11
Can a variable have more than 1 value, for example: F1=1000 "and" 29

If yes, then, how?
If no, then, what should i do?

THX!
Van B
Moderator
22
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 13th Apr 2010 10:01
Maybe you need a dimensioned array. Like, make an array called F, and have as many indices as you like:

DIM F(10)

F(0)=0
F(1)=1000
F(2)=29

But also, you can reference that number with a variable:

For n=0 to 10
text 0,n*20,str$(F(n))
next n

It's vital stuff, you should learn arrays next if you haven't already, it's the only way to go.


Health, Ammo, and bacon and eggs!
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 13th Apr 2010 21:04
Yitzu
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location:
Posted: 14th Apr 2010 02:47
Mmm... its good to know those things, ill take them into account, but i dont think they could rly help me, or maybe the arrays could.
Idk, i think i didnt explained myself well, what i need is a variable or something that calls more than one number. What im doing its something like this:

Sprite F1, X, Y, F1

The sprite its in a subrutine which i dont want to touch because the point of it its that its not changed in all the game, the only thing that changes its the outside part, not the subrutine, i wanted to make that F1 was equal to 1000 and 29 so that 2 sprites could move with this only command. (now that i write it here i see how weird this sounds XD)

Or i could also make it with the arrays, in which i save 1000 and 29 into the arrays, and then call both in F1, like this:

Dim F1(100)
F1(0)=0
F1(1)=1000
F1(2)=29

and then make something like:

Sprite "Array F1", X, Y, "Array F1"


But the only problem is idk how i should call the whole array into F1.

So, idk if u guys have had this problem before, or not, but maybe someone know what could i do... so... thx guys
Xyus
15
Years of Service
User Offline
Joined: 5th Sep 2009
Location:
Posted: 14th Apr 2010 05:23 Edited at: 14th Apr 2010 05:36
Quote: "i wanted to make that F1 was equal to 1000 and 29 so that 2 sprites could move with this only command."


Quote: "But the only problem is idk how i should call the whole array into F1."


If I'm reading you correctly, sounds like what you want is "for...next" loops, combined with arrays, as Van B said.

Check here.

If, after reading that, :



Sounds like what you want, then there you go.

If not, I'll look again.
Yitzu
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location:
Posted: 15th Apr 2010 05:29
OMG, it worked, ty!!! I never used arrays in the past because my game is in 2d, so i didnt feel i had to use them, but now i see how usefull they r, ty, im rly learning more and more with this forum

Login to post a reply

Server time is: 2024-11-23 17:09:27
Your offset time is: 2024-11-23 17:09:27