Game development on Play My Code is simple, yet flexible enough to allow any kind of game to be written. No additional tools or plugins are required, whilst there's no need to book web hosting either as your game and all assets will be hosted here, for free. Meanwhile, anyone can embed and share your games- just like a youtube video.
Play My Code's Quby implementation also provides a variety of API functions out of the box to provide easy-to-implement handling of the essentials of games: keyboard and mouse control, graphics drawing and collision detection to name but a few. The API couldn't be easier to use, and allows you to knock a basic game together in mere minutes! Please read the API reference to learn more about the many API functions.
Project Creation & Management
Once you've signed up, head to the Build section at www.playmycode.com/build. This is where your game projects are kept. A new user will have no projects: click New Project and enter your new game's title into the dialogue box which will appear.
Your newly-created project will appear, with a few corresponding buttons: Edit loads the game's code and assets into the online IDE (Integrated Development Environment), and this is where game development takes place. Delete obviously deletes the project, whilst Status determines whether the game is classed as Hidden, Public or Published:
- Hidden games are only visible to you, when you are logged in. We would strongly recommend you keep games hidden while they are in development, so no-one will play an unfinished version thinking it is the final product!
- Public games are visible to everyone, but will not appear in the Play section. If you write a demo or a test then set this to public so others can see it whilst no-one will be disappointed expecting a full and finished game. This is also useful to allow others to test a near-complete game without publishing it.
- Published games are those which are finished and ready for release! When a game is complete, set it to Published and it will feature in the Play section of the site alongside other published titles. Make sure you've fixed all the bugs and applied plenty of polish as your reputation on the site rests upon the quality of your games, how many times they get played and the amount of ratings you get from other users (TBI).
Project Development Using the IDE
Clicking a game's Edit button will load its code and assets into our cloud-based IDE. The IDE is simple and streamlined, yet powerful enough to make game development on Play My Code both blazing fast and extremely simple.
A game's code appears in the pane on the left. A newly-created project will, by default, display the code for a Hello World program, a very basic example- feel free to tinker with this, or just delete it and write your own code.
The window to the right of the code pane is the IDE Game Player, where the code you are writing executes. Clicking the Run button beneath the code pane will cause your project to run in this window- use it to execute the provided Hello World example if you want. When you're done, simply click Stop.
For advanced users there are also a number of keyboard shortcuts you can use in the editor. These are listed here
The other buttons beneath the code pane are as follows:
- Save saves your project to the database.
- Screenshot creates an image from the current state of the canvas. This can then be saved, and is subsequently used as the game's thumbnail on the site and also on your game's player before the game has been started.
- Images opens the Images Library. This is where your game's graphics are uploaded and stored.
Finally, beneath the game Game Player is the Error Console. This displays syntax errors and other problems with your code, and will tell you the line number where an error is occurring to aid you in solving the problem. Do not publish games containing errors!
Managing Game Graphics
Game graphics are managed through the aforementioned Images Library. Click the Images button beneath the code pane to open it. Clicking in the box beneath Upload New Images allows you to upload and add graphics to your game- choose the required assets from your computer's hard drive (in .png, .jpg or .gif format) and then click Upload. Once they have uploaded successfully they will appear in the library, and from here you can also delete unused assets by clicking the grey x beneath the thumbnail of the image you want to delete.
When you want to use an uploaded file in a game, you refer to it in the code as such:
$SHIP_IMG = new Image("ship.png")
where $SHIP_IMG can be any variable name so long as the filename (in the above example, "ship.png") matches that in the Image Library. You can see image filenames above their corresponding thumbnails in the Image Library.
At Play My Code, we very much hope that you find game development using Quby and our online IDE easy and fun.
As far as further reading about the Quby language is concerned, the Quby Syntax and Quby API documents are a great place to start. Also, the source code on any game on Play My Code is viewable: simply navigate to that game's page and click Code above the game player to view it. Learning from other users' code can be a great way to increase your own skills.
Very soon we hope to have more and better documentation, example demo games and tutorials available onsite. Watch this space, or follow @playmycode on Twitter for the latest updates.