Professional Documents
Culture Documents
YU JIANRONG
Zlong games
SPIL GAMES
10 HTML5 Tips
SPIL GAMES
Bubble Hit
Castle Solitaire
Blocker Mover
Tip 1
CSS
+ nice effects via CSS 3D, iphoneonly - Compatibility problems on CSS - Crash on iOS - Flickering on Android l
SPIL GAMES
Tip 2
Audio support is very limited Mobile: only one Music can be played at the same time
SPIL GAMES
Tip 3
Mobile
Mouse events works different on Mobile Desktop : Mouse events (e.g. onmouseup) Mobile : Touch events (e.g. ontouchstart) Note: multi-touch events supported by iOS only For more details: visit http://developer.apple.com/devcenter/safari/index.action
SPIL GAMES
Tip 4
Mobile
Use Dirty Rectangles for Canvas to improve framerate
Tip 5
Mobile
l
SPIL GAMES
Tip 6
Mobile
l l
SPIL GAMES
Tip 7
Mobile
10MB max for one browser tab Do not create large amounts of multiple Canvases. Canvas is more memory hungry than image. Remove the image from memory by resetting the attribute "src":
img.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAA AAfFcSJAAAAC0lEQVQIHWNgAAIAAAUAAY27m/MAAAAASUVORK5CYII=";
SPIL GAMES
Tip 8
LocalStorage is widely supported and better than cookies More details: http://dev.w3.org/html5/webstorage/
SPIL GAMES
Tip 9
YUI compressor for size reduction and basic obfuscation JSMin: only reduces size
SPIL GAMES
Tip 10
Mobile
Use aCatLog (android market app) or adb logcat (Android Debug Bridge) to read the browser log on Android Bookmarklet (javascript: URI) is useful
javascript:Game.PlayerSpeed=prompt("Player Speed:")
SPIL GAMES
Getting started
DIVE INTO HTML5: http://diveintohtml5.org/ Safari Reference Library: http://developer.apple.com/library/safari/navigation/ https://developer.mozilla.org/en/HTML/HTML5 http://m.agame.com/
SPIL GAMES