Thanks for your answer, this is what the game has to do. Instead of the numbers i a have piano keys of course. My code works, but it?s completely different to your code, so i will work with it at the weekend.
To your answer (i'm struggling to follow what you're doing but it seems you're concerned with the # of sprites that you're creating):At first i started to make everything manually:
factor is the value of bpm for a sixteenth
if time >= factor*1 and sprite 1 <= 656
inc sprite 1,1
endif
if time >= factor*2 and sprite 2 <= 656
inc sprite 2,1
endif
if getspritecollision sprite 1 with line and key 1 = pressed
playsound 1
endif
if getspritecollision sprite 2 with line and key 1 = pressed
playsound 1
endifAfter that, i decided to use arrays and for loops to handel that:
dim rectw[13,10]
dim posyw[13,10]
for y = 0 to 9
for x = 0 to 12
rectw[x,y] = createsprite(201)
next x
next y
for y = 0 to 9
for x = 0 to 12
setspriteposition(rectw[x,y],40+(x*140),posyw[x,y]) // x for the 13 keys and the nine for the following sprites
next x
next yThis for 13 keys i need.
for y = 0 to 9
if time# >= (factor#)*(y+1) and time# <= (factor#*9)+(factor#)*(y+1) and array1[y] = 1 and posyw[1,y] < 656 // it?s the same idea but with loop to set the time factor, i have added the <= that the following rows don?t get true at the same time
setspritedepth(rectw[1,y],4)
inc posyw[1,y],1
endif
if posyw[1,y] >= 655 // to save sprites i set the sprites from the first array back to the start position
posyw[1,y] = -150
array1[y] = 0 // i set the array to 0 that the sprites belongs to array 1 do stop
flag1=2
endif
next y
After the timer has reached the 10, the code goes on with array2
for x = 0 to 9
if time# >= (factor#*10)+(factor#)*(x+1) and time# <= (factor#*19)+(factor#)*(x+1) and array2[x] = 1 and posyw[1,x] < 656
setspritedepth(rectw[1,x],3)
inc posyw[1,x],1
endif
if posyw[1,x] >= 655 and time#>= (factor#*10)+(factor#)*(x+1)
posyw[1,x] = -150
array2[x] = 0
flag2=2
endif
next xi work with 5 arrays with a dimension each of 100, but for this overview of 10
if flag1 = 1
dim array1[10] = [1,1,0,0,0,2,2,0,0,0] i am setting a flag to each array that the array only runs one time because every value of each array could be different
endif
dim array2[10] = [1,1,0,0,0,2,2,0,0,0]
dim array3[10] = [1,1,0,0,0,2,2,0,0,0]
dim array4[10] = [1,1,0,0,0,2,2,0,0,0]
dim array5[10] = [1,1,0,0,0,2,2,0,0,0]
That?s it. I don?t found my method bad, because i only have to change these 5 array for each song, The framerate is ok, but as i said i spend many sprites
Thanks for your posting.