This an example as usage uTetris game plugin:
var tetris = new uTetris($('container'), $('preview'),{ keypress: true }); var play = $("play"), score = $("score"), level = $("level"), lines = $("lines"); tetris.addEvents({ "start": function(e){ setInfo(e); setPause(); }, "lines": setInfo, "fixed": setInfo, "pause": setPause, "gameover": function(){ play.set("html", "Play"); } }); function setLabel(str) { play.set("html", str); } function setInfo(obj) { level.set("html", "Level: " + obj.level || 0); score.set("html", "Score: " + obj.score || 0); lines.set("html", "Lines: " + obj.lines || 0); } function setPause(pause) { setLabel(pause ? "Resume" : "Pause"); } play.addEvent("click",function() { if (this.isStop()) { this.restart(); } else { this.pause(); } }.bind(tetris));
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus