We’ve finished a new round of updates for Play My Code including bug fixes, new API additions and some changes to the site and player.
Bug Fixes
Most of these were internal bugs, which rarely occurred or were quite minor. For example, missing titles on forum topics. Amongst notables ones are a bug fix for Safari when drawing a tinted image; for this we had to work around a WebKit issue. We have also improved fallback support for JavaScript AJAX errors, which makes the game player more robust.
A major bug some users might have noticed are the broken login sessions: on selection, the “remember me” checkbox on login now works as billed, keeping you logged in after closing the browser window.
Game Player Size Changes, and Full Screen Mode
We have altered the size of the game player slightly, to remove a shadow from the bottom of the player. It’s a minor yet necessary change, but those who have the player embedded somewhere might now notice a slight black border on the top and bottom of the game window. If you’d like to fix this on your embed, change the ‘height’ attribute of the player’s iframe to 438 in the embed code.
Sorry if this inconveniences anyone, there’s a couple of reasons behind this trivial yet important change: first, it’s to ensure the game player is just a menu and the game. Any styling around that should be left up to the site using it.
More excitingly, the other reason is we’ve enabled full screen mode on all games. In the embed code for a game, copy the ‘src’ attribute and paste it into your browser location bar to view said game in fullscreen. Play a full screen version of our RayCaster tech demo right here.
Auto Play
Another game player addition is the ability to auto play a game. Some of our users are starting to embed our games on their own sites, and want a visitor to be able to play straight away when the page loads. The auto play allows just this- it will enable the game to load and start playing automatically.
To enable this, you need to add ‘?auto_play=true’ to the end of the ‘src’ value in the ‘embed’ HTML code you have for each game.
You can find more information on auto play, as well as other game embed parameters, on the new Embedding page in the Docs section.
New Recommended Games Section
Regular users might notice we include a featured game on our front-page, hand-picked and recommended by ourselves. But when we update the front-page, what happens to our old recommendations?
You can now you can find all of our featured games in the new Recommended games section.
isKeyDown / isKeyPressed Improvements
You very often want to support both arrow keys, and the WASD keys, for movement. This usually ends up looking like:
c = getControls()
if c.isKeyDown( :a ) or c.isKeyDown( :left )
// move left
end
To improve on this, you can now pass in an array of keys to check. So the same code can be written as:
c = getControls()
if c.isKeyDown([ :a, :left ])
// move left
end
There are also times you want to detect any key input, for example to allow a user to skip a splash screen. To achieve this you can pass in ‘null’ to ‘isKeyDown’ or ‘isKeyPressed’, or call it with no parameters at all. For example:
if getControls().isKeyPressed()
// a key has been pressed, doesn't matter which
end
Check out isKeyDown and isKeyPressed in the API section of our documentation for full details.
array.flatten
We have also added the ‘flatten’ method to the Array class. It allows you to turn a multi-dimensional array into a single dimension. Not the most exciting new feature, but very useful. More details on the flatten method can be found in the docs, right here.
We will of course be adding more features, fixes and refinements as time goes on. Follow @playmycode on Twitter for the latest announcements, and meanwhile please keep your feedback and feature requests coming.
