Ok i have another query about arrays, since they are the bane of my existence but damned useful... i have created an array to contain things like notes that you pick up during the game, all good, i even have a way to display them on my screen and scroll through them using arrow keys, brilliant! however... say i pick up two items:-
Slot 0 = Notebook Image
Slot 1 = Item Image 1
Slot 2 = Item Image 2
Now when i bring up my Notebook it automatically shows Slot 0 image if i press the right key it displays item one and again it will display item 2 what i need is:- If i press the right key for a third time it will loop back to the beginning and display the 0 slot image... does that make sense?
This Routine is how I scroll through the items in the array:-
If Rightkey()=1 And ButtonTimer=0 and NFlag=1
If Sprite exist (NoteThing().NoteImg) then Delete sprite NoteThing().NoteImg
Next Array Index NoteThing()
Gosub UpdateNote
endif
And this is the subroutine that displays the items:-
UpdateNote:
Nx=Screen Width()/2 : Ny=Screen Height()/2
play Sound 7
BtnOn = 0 : NFlag=1
ButtonTimer = 20
if NoteThing().NoteImg>0
sprite NoteThing().NoteImg,Nx-image width(NoteThing().NoteImg)/2,Ny-Image Height(NoteThing().NoteImg)/2,NoteThing().NoteImg
EndIf
Return
So far if i press Right a third time it gives me an array out of bounds error message so i just need it to start over again, i've tried many things but none have worked. Cheers.
I can see from your smile, you're not here for the sunset
Windows 7 64 bit, AMD Phenom II x4 Black edition, 7 GB Ram, Radeon HD 4650, 3.6 TB HDD