Quote: "@Conjured Entertainment - according to the online help declaring arrays in AppGameKit V2 can be done using sprite_filenames as Integer[12] = etc.....
See here - "
lol WOW
That's a new one on me.
I thought it was backwards and was a typo.
Thanks for pointing that out!
Quote: "
Array Declaration and Resizing
To maintain backwards compatibility..."
I guess it is backwards after all.
Quote: "Now, a question for you..... How important is the naming of the subimages - "WhitePawn.png","BlackPawn.png", etc? The reason I ask is that if I were to rename the subimages to "1.png", "2.png" and so on I could generate the string names on the fly as I go through the loop with Str(x) + ".png" and do away with my use of the array entirely. It seems to be a neater solution, but is there any major drawbacks to that approach?
"
I never liked the caps in the file names, but I have done it on occasion.
I never liked having a file as just a number either, as I usually use the number as a suffix so I retain the name and know what the image is.
I do like your idea though of using that number, and you could put it in anywhere.
For instance, if you used "chess_piece_" + str(x) + ".png" , then you would still have to know that 1 is a pawn, 2 is a rook, 3 is a knight, and so on, but you would know at a glance that the image pertains to a chess piece.
I would probably use an array for the board, to keep track of what piece is where, but yeah, you probably don't need one for the pieces.
I am a master at chess (have won tournaments), but I have never tried to program the game.
So, I have never really given the logic much thought as far as code goes.
It sounds as if you were going to duplicate the pieces though, since your arrays is only 12 and not 32.
So, I think eliminating that array would not affect your original coding plans.
I probably would have started off with a multi-dimensional array for the pieces and over complicated things.
I think this is really your call and depends on how you plan to code the logic as there is more than one way to do this.
I see it as the board as an array holding the value of the piece.
Each move is targeting a square to move from, and selecting one of the valid options to move to.
So, depending on the value of the piece of the selected square, we could determine the valid moves available.
The tricky part is detecting invalid moves like that move opening up a file where the piece behind it would be checking the King.
When other pieces are affected by the move, you really have to be checking a lot of stuff all the time.
It is probably simpler than it sounds, but the complexities of this in general is why I never fooled with it.
I never wanted to open up that can of worms.
Since I have not thought this out, I would probably make a lot of mistakes along the way and would have to revise the code over and over.
So, instead of me even offering any advice on this, I will have to let you run with it and experience those logistical challenges on your own.
I am sure there is someone here in the forums who has made a chess game before though, so hopefully one of those guys can chime in.
Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1