Hello. I am not exactly new to Dark Basic, I have been dabbling with it for years, but mainly doing graphics for a fellow coder while he codes. I am currently trying to write a simple puzzle style game similar to mahjong in concept and am having difficulties quite early on
. My mind just seems blank at the mo! I cannot seem to think how I can get the program to remember which tile you have clicked on, and compare it with the next one you click on. So that I can reset the tile selections or move to the check for if they match and if the move is legal.
I can see I am going to struggle with this for a while, so would like some pointers if possible. I nknow I have to store the tiles clicked into another array so I can check on them, but am just tearing my hair out at the minute!
Here is the code I use to select the tiles.
for n=1 to 36
if mousex()>boxclick(n,1) and mousex()<boxclick(n,1)+64
if mousey()>boxclick(n,2) and mousey()<boxclick(n,2)+64
if mouseclick()=1
boxsave(n)=boxclick(n,4)
texture object n,boxclick(n,4)+18
if boxclick(n,5)=0
play sound 1
boxclick(n,5)=1
inc tilecount
endif
endif
endif
endif
next n
The boxclick array has the values 1:x co-ord, 2:y co-ord, 3: object number
4:object texture, 5: if object has been clicked on once. If that helps you understand what I have done so far.
At the moment I can click on any tile and it will change the picture. I need to only be able to click on 2 tiles before the picture reverts back to the original or deletes the tiles. How can I store the tiles? I will continue to work on it and hopefully someone can help me with an idea or little code snippet.
I don't want someone to write the game for me! Just give me an idea how I can store and check this either in the same loop or a new one.
Oh by the way the boxsave array was an attempt to save the tiledata to an array but I'm not sure i can do it like that. Well I am babbling now, can anyone help me?