Due to the limited duration and coding ability, I also decided not to have two grids. That way, i am able to lessen my workload and the game can still be competitive. The process of the game would now be: first, a person has to place a gold (players are not allow to look at it at that time). After that, the game may begin. Each player has to takes turn and click on the square and to guess where is the gold.
Wednesday, 30 September 2015
Mid sem break (Processing)
Ive been working on the code. I couldn't add mountains around the gold before. But now i know. Here is the logic, at first I created a grid and push every single square into a array list. Then i add event listeners for those squares which will trigger place gold function. In the place gold function, I check for if currently there isn't any gold on the grid then I add child on the specific square. Then I call the add mountains function after that. In the function, I tracks position of the selected square (the position of array list). The position number is like that, it starts from 0 from the top left hand corner and count it down vertically to the bottom right 24. For example, if i want to place a gold in position 12. I will need to place mountains on position (12-6, 12-5, 12-4, 12-1, 12+1, 12+4. 12+5, 12+6).
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment