Confused, need help.
Root / Programming Questions / [.]
KrondeloCreated:
I keep looking at the code, but it's not doing what I would expect. Am I missing something obvious?
T=30 P[T] FOR I%=0 TO T-1 SPSET P[I%],0,0 PX[I%]=RND(5)+185 PY[I%]=RND(2)+220 SPOFS P[I%],PX[I%],PY[I%] VSYNC NEXTSo I would expect to see each of these sprites be assigned their location and then they should stay there. However they don't, it looks like one sprite jumping around and then I am left with one sprite in one position.
I keep looking at the code, but it's not doing what I would expect. Am I missing something obvious?I think you can do it differently:T=30 P[T] FOR I%=0 TO T-1 SPSET P[I%],0,0 PX[I%]=RND(5)+185 PY[I%]=RND(2)+220 SPOFS P[I%],PX[I%],PY[I%] VSYNC NEXTSo I would expect to see each of these sprites be assigned their location and then they should stay there. However they don't, it looks like one sprite jumping around and then I am left with one sprite in one position.
FOR I=0 TO 5 SPSET I, I 'this sets the 5 sprites to be set and I happened to uses the same I variable to mean set sprite 0-5 SPOFS I,RND(300),RND(200) 'if you want them all to be set in specific places, I suggest you place them individually. NEXTHope that helped