array addition prob
Blitz3D Forums/Blitz3D Programming/array addition prob
| ||
I am having a problem in my array addition routines. Being slightly numerically dyslexic I cannot figure out where I went wrong. The whole game code is here minus check routines to change row/col... I took them out since they weren't working well... anyway... nothing else is needed to run this except I may have not taken out the music code... add an ogg of your own :] I suppose there are several better ways to write this. I kluged it together how I know how. Still a frightful noob to B3D etc. The idea is you put a colored piece on to the other piece and change the color. If you put a combination (caled tertiary color) like blue-green or red-orange on to another tertairy color it turns white. If you put ANY color on a white it turns to that color. The only thing you can put to clear a brown is a white (well it should be onlyy) If you put a color on its own color you should loose a strike. It all works SOME OF THE TIME!!! but not all of the time... What did I do wrong?? -Rook |
| ||
I assume the problem is the error 'entity does not exist' because thats the error I get when I run it. Anyway, to fix this just do a search and replace for 'entity#' and replace with just 'entity'. Entities should just be stored as integers. |
| ||
nope... I never had that problem. What version of B3D are you on??? I got the latest... my prob is that the color doesn't always change. |
| ||
oic, I think actually that is a win2000/xp issue with entities being assigned as floats. I think there a few issues with this code that are stopping tiles from changing: 1) where you have "Case dis >=0 And dis =< 4" to asign red it isn't actually working for some reason. Personally I never realised you could write case statements like this but it seems to be there in the manual. Neverless I replaced this with 'case 0,1,2,3,4' (in all functions where u use this) and from then on red could be selected. I think before it would only select red if the random number equalled 1. Pretty strange:) 2) The condition 'If qu > 45 Then qu = 0' would ignore if the piece is Yellow Orange, where dis=47, so if you have a clear tile and try to lay down a yellow orange piece it wouldn't change. (unless this is by design?) 3) Lastly, the main reason why tiles aren't sometimes changing is because when 'que+dis' adds up to a tile that doesn't exist, the tile is made clear but the array that stores what the tiles are remains invalid, so the next time u try and change the tile, it doesn't change. So I simply added boardarea(row,col)=0 to the default case in function 'setup_board' Anyway, heres the modified code: I left the debuglog commands in there that I used to figure out what was going on. |