Is there a faster way to loop through a Matrix? I'm trying to make an adventure game, but it takes forever to draw a new map.
ALSO: is there a way to get around Casio BASIC's string problem? Someone said you could encode getKey codes and then store them in a variable (I.E., HELLO would be 6536252554->A) but then how would you decode this with a program (and at at least a near-reasonable speed)?
PGRM .MGEN
---------------------------------------------------
Locate 1,1,"+----[ EXOGA ]----+"
Locate 1,5,"---------------------"
For 2 W To 4
Locate 1,W,"!"
Locate 21,W,"!"
Next
Locate 1,6,"GENERATING MAP..."
Locate 1,7,"(0 PERCENT)"
{G,H} Dim Mat A
For 1 A To G
For 1 B To H
Intg (Ran#x2)Mat A[A,B]
Mat A[A,B] C
If A>1 And B>1 And A<G And B<H
Then C=0=>Locate B,A," "
C=1=>Locate B,A,"#"
IfEnd
Next
Intg ((Ax100)/G) D
Locate 2,7,D
Next
Locate 1,6," "
Locate 1,7," "
Is There A Way To Loop Thru A Matrice Faster Than This?
Started by
Dragoneye_XP
, Feb 14 2006 01:44 AM
2 replies to this topic
#1
Posted 14 February 2006 - 01:44 AM
#2
Posted 23 February 2006 - 05:23 PM
I don't get what you want to do with this code ... at least not what you explained above.. do you? Could you tell us a little more?
#3
Posted 24 February 2006 - 10:02 AM
Looping through a matrix shouldn't be a problem. I've made a program that generates a random matrix and draws the map extremely fast, so just drawing the map should be even faster... If you really want it to be instantaneous, the way I did it in one of my games was to draw the whole map line by line, rather than reading the matrix one cell at a time. Though the map is stored twice, it doesn't take up that much more memory.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users