For the next Tutorial I wrote a quick Minesweeper game. I’m trying out sharing the code via dropbox as the program is too long to type in by hand. The link to the code is below. I would appreciate it if someone could try downloading and running this to make sure that the public folder shares okay.
This App was developed totally on the iPad. The graphics were done using Spritely.
The Show / Flag button on the run screen toggles between reveal cell mode and place a flag mode. The rest should be self explanatory. I have used a number of classes contributed by folks on the forum so thanks for sharing.
I will write up the tutorial on this game over the next few days. It includes some interesting techniques like recursion, closure, 2D arrays and using images from Spritely. It doesn’t run particularly fast but this doesn’t impact the game play.
As always, comments, suggestions and improvements are welcome.
PS How do you post a screenshot on the forum?
EDIT: I couldn’t work out how to post a screenshot so here is a video instead. The text on the cells is much clearer when viewed on the iPad.
The link works but does anyone know how to copy the code and paste it into codea from the iPad?
nvm. I got it. The game looks awesome!!! Love how you can choose difficulty
@veeeralp - Thanks for checking it out. It would be great if there was a code export and import function, curse you Apple!
Thanks for the minesweeper package - really neat. I had problems transferring it to my Pad, largely due to the size of the code - could copy and paste into Codea fine (via Dropbox and Textastic), but I like to reduce large packages to tab sized files so I can read them to learn from them. You know, split off Classes().
That’s where I find the editor in Codea a little cumbersome. Do you know if there’s any shift select equivalent in Codea - so that you can highlight the start of a selection then shift click for the end?
It would save an awful lot of messing about with pasted graphics like the ones embedded in minesweeper.
Have you tried putting the png files into your FDropbox public folder then we can download them from there. I do the same for the pictures I’ve been posting for the forum contributed code section.
Could help when you are presenting your tutorial.
Or - a downloaded Zip with all files present from the public folder.
I’m sure you have your master in tabs, editing a single file would be a nightmare - after all 5169 lines of code is asking a lot of the Codea editor.
Glad you enjoyed it and thanks for the feedback. I enjoyed coding this while lying in bed at night.
Yes my original version is contained in 9 tabs (one for each class). I dont know of any easy way to skip to the start of a class for selection.
With this game I wanted to do the whole thing on the iPad. Spritely is good but you wouldn’t want to be doing a lot of graphics on it. Even for pixel art fanboys it is hard work. A cut and paste tool would be handy.
I also wanted to make the distribution self contained, which using images from Spritely achieves, but it does make for long files. I have moved the icon images to the last tab so at least all the code you would want to look at comes before that. I agree that Codea starts to struggle with long files particularly on my 1st gen iPad.
For the next game I will try png’s. This is all about learning so the more approaches taken, the better. Hopefully Apple will allow code export/import at some stage. That would make life a lot easier.
I will also do a tutorial on submitting MineSweeper to the App store for approval. I’m interested to see how that works. I probably need to add in high score functionality and make sure it works in full screen mode first.
Watch this space…
I have the same question asked already, but not explicitly answered. How do you copy such a large file on the iPad?
To copy it all into one tab, do as follows:
I assume you have tapped the link and can see the code in your browser? If you got that far then tap and hold to bring up the cut/copy/paste pop-up. Select the code and then Tap copy, open up a new project in Codea. Tap and hold, select all and then paste. You should then be good to go.
Let me know if you get stuck and I will provide some more detailed instructions.
I have also broken up the code into classes (links here: http://twolivesleft.com/Codea/Talk/discussion/1335/tutorial-6-building-a-minesweeper-game-part-1#Item_7).