Oh yes ladies and gentlemen. I have now a playable version of my game, its not much. But it is the content of all I've been doing these past 2 weeks. You can browse the code here and download an executable from this page.
And I DID solve my Un-Escapable loop problem, I'm going to make a port on this one.
Milestone 2
After hitting more walls in my previous version of the program I decided to create another form where I would put only the code I need. To make it cleaner and more manageable. It is currently at its third iteration. But while I was looking at my code ( which was muuuch easier to read in a clean environment not chuck full of properties and classes anywhere) I though of the following logistic: I have two matrices, two arrays and 3 methods to help me put those on the form. If I followed my plan to make another matrix for the game hero, I'd have even more. So why not make it only 2 methods, one to fill the matrices, and one to show them. Simple since they do pretty much the same. And to that conclustion I said, why not have a single matrix ? Why would I need 2 layers when I could easily do it with one, and actually make this a lot more simpler and easy. The final result is that I have a single matrix of pictureboxes and two arrays with two methods to fill and stamp it.
This is the code I used. you can see this all the simpler.
The loop problem was caused by this: from the moment I decided to use an matrix of pictureboxes instead of images I changed from a type to an object. Do when typing
Dim tileMatrix(15, 15) as Picturebox
What it did was to create 256 pictureboxes that are actually the SAME picturebox. Because there is no New() I will create a subsequent post explaining this particular error but for now do understand that the problem was that every picturebox in my matrix was the same picturebox. It was a single one with 256 references through the matrix.

Actually, instead of having multiple Matrix(LIG, COL) = New Picturebox I can put a single one right before the first Select Case. Either way works and I changed my code to the shortest way.
ReplyDelete