Tuesday, 9 September 2014

Interactive Prototype I - Extra content for Statement of Delivery

The content in the previous blog post consisted of the Statement of Delivery I wrote for Interactive Prototype I. The content below is EXTRA content that was not included in the Statement of Delivery, detailing about my process in adding features of my prototype.

Addition of Dots Features

The code I obtained for connecting two dots was a good starting point. However there were some things that needed to be added manually as I modified and integrated the code:
1.       Creating the Grid of Dots: From the Connecting Two Dots sample.
2.       Adjacent Dots: I added in detecting whether two dots clicked were adjacent horizontally or vertically, and prevent the drawing of a line if not. (would originally connect any two dots clicked)
3.       Tracking Lines: Keeping track of which horizontal and vertical lines had been drawn, done using arrays.
4.       Detecting Boxes: Detecting when the lines formed a box, and recognising that a box had been claimed accordingly.
5.       Player Turns: Detecting player turns and changing player turns after a player had made a move.
6.       Visual Indication: Indication on the board for creation of coloured lines, boxes.
These steps required quite a bit of experimentation to get right.

Addition of Minesweeper Features

Up to this point, the prototype was functionally complete from a Dots game perspective. Implementing the Minesweeper functions was the next step. These steps included:
1.       Generating Random Mines: This function was in the Minesweeper Game I used as a reference and I modified it to integrate it into my prototype.
2.       Number of Neighbours: Calculating the number of neighbours for each square was a lengthy function that I modified from the Minesweeper game. Eg: corners have 3 neighbours, wdges 5 neighbours, and centre squares have 8 neighbours
3.       Generating Random Numbers: Using the getNeighbours() function, the number of mines in neighbouring squares was calculated and therefore the numbers could be generated indicating the number of mines in neighbouring squares.
4.       Displaying the numbers: This step I had to experiment with my own code, and create an array to hold the numbers to be drawn.
5.       Fine tuning of display: Added coloured numbers, a different graphic for mines, added score and player turn indicator.

Features Excluded

I made some decisions to exclude extra functions that would have been completed after the above features were working.
1.       Dots on hover or click: Adding in a hoveron and hoveroff states was something that I attempted to partially implement, however would have required rewriting several parts of my code.
2.       Flagging option: Adding in the option for players to flag their mines was secondary to ensuring the mine grid was actually working first.
3.       Reset option: For the purposes of this prototype, the .swf can simply be closed and reopened again. I however did add a dummy reset option to test positioning of the button on the screen.

Problems Faced

1.       Layering of objects: I had a problem with the text of the numbers covering/on top of the dots, resulting in being unable to click on these dots. This was because the TextField area that contained the text had significant padding added to all sides of the text. To combat this, I could either make the TextField smaller so that it wasn’t on top of any interactive elements, or send the Textfield to the back, below the dots.
a.       Previous Order (from top to bottom): Numbers, Squares, Dots, Lines.

b.      New Order: Dots, Lines, Numbers (send to back first), Squares (send to back second).

1 comment: