diff --git a/README.md b/README.md index 80b1986..e658866 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ Features * Creates multiple fruit flys which fly and walk around the browser window. * Creates multiple spiders which walk around the browser window. +* Creates multiple ladybugs which walk around the browser window. * Flys are responsive to mouse movements (optional) and mouse overs events. @@ -44,16 +45,22 @@ or ``` You can use SpiderController() as a shortcut for loading options and the sprite for the spiders. -``` +```js new SpiderController({'minBugs':2, 'maxBugs':6}); ``` +You also can use LadyBugController() as a shortcut for loading options and the sprite for the ladybugs. + +```js + new LadyBugController({'minBugs':2, 'maxBugs':6}); +``` + See example.html BugController constructor can optionally take an object of options. To make this js more async friendly, you can adjust the default options at the top of bug.js, and then instantiate at the bottom of the file as above. This will allow one to wrap the entire script in a closure to prevent any global window name space overlaps. Async code: -``` +```js var targethead = window.document.getElementsByTagName("head")[0], loadedSpiders = false, jst = window.document.createElement("script"); diff --git a/bug.js b/bug.js index f4b0a26..78989e0 100644 --- a/bug.js +++ b/bug.js @@ -358,6 +358,30 @@ var SpiderController = function() { } SpiderController.prototype = BugDispatch; +var LadyBugController = function() { + var ladyBugOptions = { + imageSprite: 'ladybug-sprite.png', + bugWidth: 69, + bugHeight: 90, + num_frames: 7, + canFly: false, + canDie: true, + numDeathTypes: 2, + zoom: 6, + minDelay: 200, + maxDelay: 3000, + minSpeed: 7, + maxSpeed: 14, + minBugs: 2, + maxBugs: 4 + }; + this.options = mergeOptions(this.options, ladyBugOptions); + this.initialize.apply(this, arguments); + +} + +LadyBugController.prototype = BugDispatch; + /***************/ /** Bug **/ /***************/ diff --git a/example.html b/example.html index f106200..cc3933f 100644 --- a/example.html +++ b/example.html @@ -3,7 +3,7 @@ - + diff --git a/ladybug-sprite.png b/ladybug-sprite.png new file mode 100644 index 0000000..e0176b0 Binary files /dev/null and b/ladybug-sprite.png differ diff --git a/originals/joaninha.psd b/originals/joaninha.psd new file mode 100644 index 0000000..18deebf Binary files /dev/null and b/originals/joaninha.psd differ