Updated README, removed Examples, added Migration Guide.
100
README.md
|
@ -1,19 +1,20 @@
|
|||
![Phaser Logo](http://www.photonstorm.com/wp-content/uploads/2013/09/phaser_10_release.jpg)
|
||||
![Phaser 2.0](http://www.phaser.io/images/phaser2-github.png)
|
||||
|
||||
Phaser 2.0.0-dev
|
||||
================
|
||||
Phaser 2.0.0
|
||||
============
|
||||
|
||||
Phaser is a fast, free and fun open source game framework for making desktop and mobile browser HTML5 games. It uses [Pixi.js](https://github.com/GoodBoyDigital/pixi.js/) internally for fast 2D Canvas and WebGL rendering.
|
||||
|
||||
Version: 2.0.0 "Aes Sedai" - Released: -in development-
|
||||
Version: 2.0.0 "Aes Sedai" - Released: March 13th 2014
|
||||
|
||||
By Richard Davey, [Photon Storm](http://www.photonstorm.com)
|
||||
|
||||
* View the [Official Website](http://phaser.io)
|
||||
* Follow on [Twitter](https://twitter.com/photonstorm)
|
||||
* Join the [Forum](http://www.html5gamedevs.com/forum/14-phaser/)
|
||||
* Try out 220+ [Phaser Examples](http://examples.phaser.io)
|
||||
* Source code for 250+ [Phaser Examples](https://github.com/photonstorm/phaser-examples)
|
||||
* Read the [documentation online](http://docs.phaser.io)
|
||||
* Browse the [Examples online](http://examples.phaser.io)
|
||||
* Join our [#phaserio IRC channel](http://www.html5gamedevs.com/topic/4470-official-phaserio-irc-channel-phaserio-on-freenode/) on freenode
|
||||
|
||||
[Subscribe to our new Phaser Newsletter](https://confirmsubscription.com/h/r/369DE48E3E86AF1E). We'll email you when new versions are released as well as send you our regular Phaser game making magazine.
|
||||
|
@ -24,7 +25,17 @@ By Richard Davey, [Photon Storm](http://www.photonstorm.com)
|
|||
Welcome to Phaser
|
||||
-----------------
|
||||
|
||||
Phaser 2.0 "welcome" text to go here.
|
||||
Exactly 6 months ago we released Phaser 1.0 into the world. Suffice to say that since then we've been overwhelmed at the huge surge of developers taking to it! Our github repository is consistently in the top JavaScript lists, we've over 3200 stars at the time of writing, and a wonderful, vibrant and friendly community. Phaser 2 is a natural evolution of what we started. We've focused specifically on performance and expansion with this release. Lots of developers have already reported to us considerably speed increases just by swapping to Phaser 2 (reports of 200% faster speeds on mobile aren't unheard of!). There's also a full-body physics system available now, in the form of the excellent p2.js. The upgrade to Pixi 1.5 under the hood bought lots of new visual effects in, including blend modes and tints.
|
||||
|
||||
And we're also really pleased to have closed down over 550 issues reported on github. We literally went through every last bug reported to us, and fixed it. All kinds of little things that as a whole make the library that much more solid. With the 2.0 release we're now freezing the API. Before we have to admit that the API changed somewhat on a whim, and we moved things around and changed things without too much consideration for fellow developers. With 2.0 that stops - we've spent long enough on this release that we're now extremely happy with the organisation of classes and methods, and while we may still need to make small tweaks in the future, none of them will be API breaking without prior community approval first. This means if you're using Phaser to teach in classes, or writing a book / tutorials around it, this is the version to base off.
|
||||
|
||||
If you want to port a Phaser 1.x game over to 2 then please see our [Migration Guide]() for help.
|
||||
|
||||
So what's next? We do have a roadmap (which you can find at the bottom of this document), but we're going to sit back and take stock for a while, building up the tutorials and sample games. We will of course jump on bug fixes quickly, and we appreciate that our TypeScript definitions are now slightly out of date again (an eternal quest we appear to be on!), but this is definitely the best release of Phaser ever. The most features, the fastest, the most stable and just generally the most fun to use.
|
||||
|
||||
Happy coding everyone! See you on the forums.
|
||||
|
||||
![boogie](http://www.phaser.io/images/spacedancer.gif)
|
||||
|
||||
|
||||
Getting Started Guides
|
||||
|
@ -37,61 +48,14 @@ There is a comprehensive [How to Learn Phaser](http://gamedevelopment.tutsplus.c
|
|||
There is also an [un-official Getting Started Guide](http://www.antonoffplus.com/coding-an-html5-game-for-30-minutes-or-an-introduction-to-the-phaser-framework).
|
||||
|
||||
|
||||
![Phaser Logo](http://www.photonstorm.com/wp-content/uploads/2013/09/phaser_10_release.jpg)
|
||||
|
||||
Change Log
|
||||
----------
|
||||
|
||||
Version 2.0.0 - "Aes Sedai" - -in development-
|
||||
|
||||
Significant API changes:
|
||||
|
||||
* Upgraded to Pixi.js 1.5.5
|
||||
* Group now extends PIXI.DisplayObjectContainer, rather than owning a _container property, which makes life a whole lot easier re: nesting and child iteration.
|
||||
* Removed Sprite.group property. You can use Sprite.parent for all similar needs now.
|
||||
* PIXI.Point is now aliased to Phaser.Point - saves on code duplication and works exactly the same.
|
||||
* PIXI.Rectangle is now aliased to Phaser.Rectangle - saves on code duplication and works exactly the same.
|
||||
* PIXI.Circle is now aliased to Phaser.Circle - saves on code duplication and works exactly the same.
|
||||
* Sprite.deltaX and deltaY swapped to functions: Sprite.deltaX() and Sprite.deltaY()
|
||||
* Sprite.crop() now takes a Phaser.Rectangle instead of explicit parameters.
|
||||
* PixiPatch no longer needed, all features that it patched are now native in Pixi :)
|
||||
* Removed: Sprite.offset, center, topLeft, topRight, bottomRight, bottomLeft and bounds, as no longer needed internally. Use Sprite.getBounds() to derive them.
|
||||
* Button now extends Phaser.Image not Phaser.Sprite, all the same functionality as before remains, just no animations or physics body.
|
||||
* Text.content has been replaced with Text.text. The Text class has a lot of new methods, check the docs!
|
||||
* Loader won't set crossOrigin on Images unless it's set to something. The default is false, it used to be '' and can be any valid string.
|
||||
* Sprite.input.pixelPerfect has been split into two: Sprite.input.pixelPerfectClick and Sprite.input.pixelPerfectOver (see new features)
|
||||
* Phaser.Stage now extends PIXI.Stage, rather than containing a _stage object.
|
||||
* If you set Sprite.exists to false it will also set Sprite.visible to false and remove its body from the physics world (if it has one).
|
||||
* If you set Sprite.exists to true it will also set Sprite.visible to true and add its body back into the physics world (if it has one).
|
||||
* Stage.scale has been moved to Game.scale. The same game scaling properties exist as before, but now accessed via Game.scale instead.
|
||||
* Stage.aspectRatio has been moved to StageScaleMode.sourceAspectRatio (so now game.scale.sourceAspectRatio)
|
||||
* Stage.scaleMode has been moved to StageScaleMode.scaleMode (so now game.scale.scaleMode)
|
||||
* Stage.fullScreenScaleMode has been moved to StageScaleMode.fullScreenScaleMode (so now game.scale.fullScreenScaleMode)
|
||||
* Stage.canvas has been moved to Game.canvas (which used to be a reference to Stage.canvas, but is now the actual object).
|
||||
* BitmapData.addTo removed and enhanced BitmapData.add so it can accept either a single Sprite/Image or an Array of them.
|
||||
* BitmapData has had all of the EaselJS functions removed. It was just taking up space and you can do it all via BitmapData.context directly.
|
||||
* BitmapText has had a bit of an overhaul - the signature for adding a BitmapText has changed to: x, y, font, text, size. See the docs and examples for details.
|
||||
* World preUpdate, update and postUpdate have all been moved to Stage. So all children are updated regardless where on the display list they live.
|
||||
* Cache.getImageKeys and similar has been removed, please use Cache.getKeys(Phaser.Cache.IMAGE) instead, this now supports all 10 Cache data types.
|
||||
* After defining tiles that collide on a Tilemap, you need to call Tilemap.generateCollisionData(layer) to populate the physics world with the data required.
|
||||
* Phaser.QuadTree has been made more generic and works with any rectangle, not just physics bodies.
|
||||
* Phaser.Animation.frame now returns the frame of the current animation, rather than the global frame from the sprite sheet / atlas.
|
||||
* When adding a Group if the parent value is `null` the Group won't be added to the World, so you can add it when ready. If parent is `undefined` it's added by default.
|
||||
* The Keyboard class has had a complete overhaul. Phaser.Key objects are created automatically, there are fixes against duration and keys reset properly on visibility loss.
|
||||
* Keyboard.removeKey has been removed. The way the new keyboard manager works means it's no longer required.
|
||||
* When a game un-pauses (from a visibility loss) it resets all Input components.
|
||||
* Time.advancedTiming is a new boolean property. If true Time.fps, fpsMin, fpsMax, frames, msMin and msMax will be calculated, otherwise they remain at their defaults.
|
||||
* Phaser.StageScaleMode has been renamed to ScaleManager and moved from the system folder to the core folder. It's still available under game.scale.
|
||||
* If your game references the old Phaser.StageScaleMode consts like SHOW_ALL you need to update them to Phaser.ScaleManager, i.e. Phaser.ScaleManager.SHOW_ALL.
|
||||
* Time.physicsElapsed is no longer bound or clamped, be wary of this if you use the value anywhere in your code.
|
||||
* In Group.destroy the default for 'destroyChildren' was false. It's now `true` as this is a far more likely requirement when destroying a Group.
|
||||
* Game no longer pauses if you've forced orientation and change it, also doesn't resize a NO_SCALE game.
|
||||
* All the Debug methods have had the word 'render' removed from the start. So where you did `debug.renderSpriteInfo` before, it's now just `debug.spriteInfo`.
|
||||
* Debug methods that rendered geometry (Rectangle, Circle, Line, Point) have been merged into the single method: `Debug.geom`.
|
||||
* Animation.looped has been renamed to Animation.loop. It's a boolean you can toggle at run-time to turn on/off animation looping.
|
||||
* Sprite.damage will now kill the Sprite if health is less than or equal to 0 (before it would only kill if less than zero)
|
||||
* By default Sprites no longer check if they are within the world bounds. It's quite an expensive process (calling getBounds every frame), so you have to enable directly.
|
||||
* The main Game class has been modified so that the update methods no longer have any if/else checks in them. Now split into coreUpdate, etc.
|
||||
* RandomDataGenerator is now started on Game creation instead of boot. You can pass a seed array in the game config object (feature request #547)
|
||||
Version 2.0.0 - "Aes Sedai" - March 13th 2014
|
||||
|
||||
There is an extensive Migration Guide available. In the guide we detail the API breaking changes and approach to our new physics system. The following is a list of all the other new features, updates and bug fixes present in this release.
|
||||
|
||||
New features:
|
||||
|
||||
|
@ -239,12 +203,6 @@ Bug Fixes:
|
|||
* Cache.destroy fixed to clear up properly (thanks Dumtard, #537)
|
||||
|
||||
|
||||
TO DO:
|
||||
|
||||
* If you change the frame name of a pixel precise input Sprite, it will fail all clicks on it after the frame change.
|
||||
|
||||
|
||||
|
||||
You can view the Change Log for all previous versions at https://github.com/photonstorm/phaser/changelog.md
|
||||
|
||||
|
||||
|
@ -297,13 +255,19 @@ Games created with Phaser require a modern web browser that supports the canvas
|
|||
|
||||
For developing with Phaser you can use either a plain-vanilla JavaScript approach or [TypeScript](https://typescript.codeplex.com/) using the provided TypeScript definitions file. We made no assumptions about how you like to code your games, and were careful not to impose any form of class/inheritance/structure upon you.
|
||||
|
||||
Phaser is 321 KB minified and 72 KB gzipped.
|
||||
Phaser is 576 KB minified (including all 3 physics engines, 311KB without) and 128 KB gzipped (67KB without).
|
||||
|
||||
|
||||
Learn By Example
|
||||
----------------
|
||||
|
||||
Phaser comes with an ever growing suite of Examples. Personally I feel that we learn better by looking at small refined code examples, so we created over 200 of them and create new ones to test every new feature added. Inside the `examples` folder you'll find the current set. If you write a particularly good example then please send it to us.
|
||||
Ever since we started Phaser we've been growing and expanding our extensive set of Examples. Currently over 250 of them!
|
||||
|
||||
They used to be bundled in the main Phaser repo, but because they got so large and in order to help with versioning we've moved them to their own repo.
|
||||
|
||||
Please go and checkout https://github.com/photonstorm/phaser-examples
|
||||
|
||||
Phaser comes with an ever growing suite of Examples. Personally I feel that we learn better by looking at small refined code examples, so we created over 250 of them and create new ones to test every new feature added. Inside the `examples` repo you'll find the current set. If you write a particularly good example then please send it to us.
|
||||
|
||||
The examples need to be run through a local web server (in order to avoid file access permission errors from your browser). You can use your own web server, or start the included web server using grunt.
|
||||
|
||||
|
@ -315,7 +279,7 @@ Alternatively in order to start the included web server, after you've cloned the
|
|||
|
||||
There is a new 'Side View' example viewer as well. This loads all the examples into a left-hand frame for faster navigation.
|
||||
|
||||
You can also browse all [Phaser Examples](http://gametest.mobi/phaser/) online.
|
||||
You can also browse all [Phaser Examples](http://examples.phaser.io) online.
|
||||
|
||||
|
||||
Features
|
||||
|
@ -331,7 +295,7 @@ We've made the loading of assets as simple as one line of code. Images, Sounds,
|
|||
|
||||
**Physics**
|
||||
|
||||
Phaser ships with our Arcade Physics system. A SAT based collision and physics library perfect for low-powered devices and fast collision response. Control velocity, acceleration, bounce, damping and full collision and separation control. As of version 1.1.4 we now support rectangles, circles and polygon collision with full rotation.
|
||||
Phaser ships with our Arcade Physics system, Ninja Physics and P2.JS - a full body physics system. Arcade Physics is for high-speed AABB collision only. Ninja Physics allows for complex tiles and slopes, perfect for level scenery, and P2.JS is a full-body physics system, with constraints, springs, polygon support and more.
|
||||
|
||||
**Sprites**
|
||||
|
||||
|
@ -384,7 +348,7 @@ We use Phaser every day on our many client projects. As a result it's constantly
|
|||
|
||||
**Battle Tested**
|
||||
|
||||
Although Phaser 1.0 is a brand new release it is born from years of experience building some of the biggest mobile HTML5 games out there. We're not saying it is 100% bug free, but we use it for our client work every day, so issues get resolved <em>fast</em> and we stay on-top of the changing browser landscape.
|
||||
Phaser has been used to create hundreds of games, which receive millions of plays per month. We're not saying it is 100% bug free, but we use it for our client work every day, so issues get resolved <em>fast</em> and we stay on-top of the changing browser landscape.
|
||||
|
||||
![FruitParty](http://www.photonstorm.com/wp-content/uploads/2013/10/phaser_fruit_particles-640x480.png)
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/* desert scheme ported from vim to google prettify */
|
||||
pre.prettyprint { display: block; background-color: #333 }
|
||||
pre .nocode { background-color: none; color: #000 }
|
||||
pre .str { color: #ffa0a0 } /* string - pink */
|
||||
pre .kwd { color: #f0e68c; font-weight: bold }
|
||||
pre .com { color: #87ceeb } /* comment - skyblue */
|
||||
pre .typ { color: #98fb98 } /* type - lightgreen */
|
||||
pre .lit { color: #cd5c5c } /* literal - darkred */
|
||||
pre .pun { color: #fff } /* punctuation */
|
||||
pre .pln { color: #fff } /* plaintext */
|
||||
pre .tag { color: #f0e68c; font-weight: bold } /* html/xml tag - lightyellow */
|
||||
pre .atn { color: #bdb76b; font-weight: bold } /* attribute name - khaki */
|
||||
pre .atv { color: #ffa0a0 } /* attribute value - pink */
|
||||
pre .dec { color: #98fb98 } /* decimal - lightgreen */
|
||||
|
||||
/* Specify class=linenums on a pre to get line numbering */
|
||||
ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE } /* IE indents via margin-left */
|
||||
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
|
||||
/* Alternate shading for lines */
|
||||
li.L1,li.L3,li.L5,li.L7,li.L9 { }
|
||||
|
||||
@media print {
|
||||
pre.prettyprint { background-color: none }
|
||||
pre .str, code .str { color: #060 }
|
||||
pre .kwd, code .kwd { color: #006; font-weight: bold }
|
||||
pre .com, code .com { color: #600; font-style: italic }
|
||||
pre .typ, code .typ { color: #404; font-weight: bold }
|
||||
pre .lit, code .lit { color: #044 }
|
||||
pre .pun, code .pun { color: #440 }
|
||||
pre .pln, code .pln { color: #000 }
|
||||
pre .tag, code .tag { color: #006; font-weight: bold }
|
||||
pre .atn, code .atn { color: #404 }
|
||||
pre .atv, code .atv { color: #060 }
|
||||
}
|
|
@ -1,196 +0,0 @@
|
|||
/* reset css starts */
|
||||
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline;}
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {display: block;}
|
||||
body {line-height: 1;}
|
||||
ol, ul {list-style: none;}
|
||||
blockquote, q {quotes: none;}
|
||||
blockquote:before, blockquote:after, q:before, q:after {content: ''; content: none;}
|
||||
table {border-collapse: collapse; border-spacing: 0;}
|
||||
/* reset css ends */
|
||||
@font-face{font-family: 'HelveticaBd'; src: url('../../_site/fonts/HelveticaNeueLTStd-Bd.otf');}
|
||||
|
||||
body { margin:0; padding:0; overflow-x: hidden; font-family: Arial, Tahoma, Verdana !important; background: #e0e4f1;}
|
||||
|
||||
a{color:#fff; text-decoration: none;}
|
||||
a:hover{text-decoration: underline;}
|
||||
|
||||
.helvetica{font-family: Arial, Tahoma, Verdana !important;}
|
||||
.header{background: #e0e4f1 url('../../_site/images/header-bg2.jpg') no-repeat; width:100%; margin:0; padding:0; background-size: cover; height: 530px; display: block; clear:both; margin-bottom: -400px}
|
||||
.main-container{display: block; clear:both; width: 1125px; height: auto; margin:0 auto;}
|
||||
|
||||
ul.nav-links{ margin:0; padding:0; display: inline-block; float: right; list-style-type: none; color: #fff; font-size: 15px; line-height: 2em; margin-top: 50px; min-width: 180px;}
|
||||
ul.nav-links > li{margin:0; padding:0; list-style-type: none; padding-left: 55px;}
|
||||
ul.nav-links > li > a{color: #fff; text-decoration: none;}
|
||||
ul.nav-links > li > a:hover{text-decoration: underline;}
|
||||
.link-home, .link-latest, .link-forum, .link-docs, .link-twitter{background-image: url('../../_site/images/nav-icons.png'); background-repeat: no-repeat;}
|
||||
|
||||
.main-title{font-family: 'HelveticaBd', Helvetica, Arial;font-size:55px;color:#fff;text-shadow:0 0 15px #b643e6; text-align: center; display: block; margin: 40px auto 0 auto;}
|
||||
.link-home{background-position: 0 -9px;}
|
||||
.link-latest{background-position: 0 -37px;}
|
||||
.link-forum{background-position: 0 -67px;}
|
||||
.link-docs{background-position: 0 -97px;}
|
||||
.link-twitter{background-position: 0 -127px;}
|
||||
.phaser-examples{background: url('../../_site/images/phaser-examples.png') no-repeat; display: block; width: 485px; height: 205px; margin: 20px auto;}
|
||||
.phaser-version{float: right; background: url('../../_site/images/phaser-version.png') no-repeat; display: block; width: 345px; height: 30px; color: #fff; font-size: 11px; text-shadow: 1px 1px #000; right:0; top:0; }
|
||||
.phaser-version > span{margin-top: 10px; display: inline-block; margin-left: 60px; margin-right: 25px;}
|
||||
.phaser-version > a {color: #fff; text-decoration: none; background: url('../../_site/images/version-button.png') no-repeat; background-size: cover; display: inline-block; width: 123px; height: 10px; vertical-align: middle; text-align: center;padding-top:11px; padding-bottom: 11px}
|
||||
.phaser-version > a:hover{text-decoration: underline;}
|
||||
.phaser-logo{display: block; float: right; width: 168px;height: 144px; background: url('../../_site/images/phaser-logo.png') no-repeat; margin-top: 40px; margin-right: 40px;}
|
||||
|
||||
#upgrade {
|
||||
display: none;
|
||||
}
|
||||
|
||||
#welcome {
|
||||
position: absolute;
|
||||
top: 260px;
|
||||
left: 40%;
|
||||
width: 200px;
|
||||
line-height: 28px;
|
||||
}
|
||||
|
||||
#welcome p {
|
||||
text-align: center;
|
||||
text-shadow: 1px 1px 0 #fff;
|
||||
}
|
||||
|
||||
#welcome a {
|
||||
color: #7a50c4;
|
||||
}
|
||||
|
||||
.error { margin-left: 48px; width: 700px; background-color: rgb(150,25,25); color:#fff; text-shadow: 1px 1px 0 #000; line-height: 24px }
|
||||
|
||||
.error p {
|
||||
padding: 16px 24px;
|
||||
}
|
||||
|
||||
#title {
|
||||
text-transform: capitalize;
|
||||
}
|
||||
|
||||
.line{display:block;clear:both; width:100%; margin:0;padding:0; float:left; background-color: transparent;}
|
||||
.box5, .box10, .box15 .box20, .box25, .box30, .box35, .box40, .box45, .box50, .box55, .box60, .box65, .box70, .box75, .box80, .box85, .box90, .box95, .box100{position: relative;display: inline-block; box-sizing: border-box; padding: 5px 10px; -moz-box-sizing: border-box; vertical-align: top; margin:0;}
|
||||
.float-right{float:right !important;}
|
||||
|
||||
.box5{width:4%; min-width: 100px; float:left;}
|
||||
.box10{width:9%; min-width: 100px; float:left;}
|
||||
.box15{width:14%; min-width: 150px;float:left;}
|
||||
.box20{width:19%; min-width: 200px;float:left;}
|
||||
.box25{width:24%; min-width: 250px;float:left;}
|
||||
.box30{width:29%; min-width: 300px;float:left;}
|
||||
.box35{width:34%; min-width: 350px;float:left;}
|
||||
.box40{width:39%; min-width: 400px;float:left;}
|
||||
.box45{width:44%; min-width: 450px;float:left;}
|
||||
.box50{width:49%; min-width: 500px;float:left;}
|
||||
.box55{width:54%; min-width: 550px;float:left;}
|
||||
.box60{width:59%; min-width: 600px;float:left;}
|
||||
.box65{width:64%; min-width: 650px;float:left;}
|
||||
.box70{width:69%; min-width: 700px;float:left;}
|
||||
.box75{width:74%; min-width: 750px;float:left;}
|
||||
.box80{width:79%; min-width: 800px;float:left;}
|
||||
.box85{width:84%; min-width: 850px;float:left;}
|
||||
.box90{width:89%; min-width: 900px;float:left;}
|
||||
.box95{width:94%; min-width: 950px;float:left;}
|
||||
.box100, .clear, .clear5, .clear10, .clear15, .clear20, .clear25{width:100%; clear: both;}
|
||||
.clear{display: block;}
|
||||
.clear5{height: 10px;}
|
||||
.clear10{height: 20px;}
|
||||
.clear15{height: 30px;}
|
||||
.clear20{height: 40px;}
|
||||
.clear25{height: 50px;}
|
||||
.strong{text-transform: uppercase !important;}
|
||||
.no-margin{margin:0 !important;}
|
||||
.no-padding{padding:0 !important;}
|
||||
.box-center{float: none !important; margin-left: auto !important; margin-right: auto !important;}
|
||||
.txt-center{text-align: center !important;}
|
||||
|
||||
p.title{font-family: 'HelveticaBd', Helvetica, Arial; font-size: 30px; color: #fff; text-shadow: 0 1px 3px #9e6ce8; text-align: right;}
|
||||
p.count-examples{font-size: 12px; color: #676773; text-align: right;}
|
||||
|
||||
ul.group-items{background-image: url('../../_site/images/laser1.png'); background-repeat: no-repeat; background-position: left top 5px; padding-left: 125px; width: 875px !important;}
|
||||
ul.group-items > li{width: 213px; padding-top: 15px; height: 35px; background: url('../../_site/images/group-item.png') no-repeat; text-align: center; display: inline-block; margin-bottom: 15px}
|
||||
ul.group-items > li a{display:block; width:100%; height: 100%; padding: 20px 0; margin-top: -20px; color:#333;}
|
||||
ul.group-items > li a:hover{cursor: pointer; text-decoration: underline;}
|
||||
ul.group-items > li a span.mark{display:inline-block;width: 1px; height: 25px; vertical-align: middle;}
|
||||
ul.group-items > li a:visited span.mark{background: url('../../_site/images/group-item-hover.png') no-repeat; background-position: center center;width:25px; padding-left:4px;}
|
||||
|
||||
.laser2{background-image: url('../../_site/images/laser2.png') !important; background-repeat: no-repeat; background-position: center 20px;}
|
||||
.laser3{background-image: url('../../_site/images/laser3.png') !important; background-repeat: no-repeat; background-position: center 20px;}
|
||||
.laser4{background-image: url('../../_site/images/laser4.png') !important; background-repeat: no-repeat; background-position: center 20px;}
|
||||
.laser5{background-image: url('../../_site/images/laser5.png') !important; background-repeat: no-repeat; background-position: center 20px;}
|
||||
.laser6{background-image: url('../../_site/images/laser6.png') !important; background-repeat: no-repeat; background-position: center 20px;}
|
||||
.laser7{background-image: url('../../_site/images/laser7.png') !important; background-repeat: no-repeat; background-position: center 20px;}
|
||||
.laser8{background-image: url('../../_site/images/laser8.png') !important; background-repeat: no-repeat; background-position: center 20px;}
|
||||
.laser9{background-image: url('../../_site/images/laser9.png') !important; background-repeat: no-repeat; background-position: center 20px;}
|
||||
.laser10{background-image: url('../../_site/images/laser10.png') !important; background-repeat: no-repeat; background-position: center 20px;}
|
||||
|
||||
.bright-bg, .dark-bg{border-bottom: 1px solid #d1d1d1; padding:25px 0;}
|
||||
|
||||
.border-bottom{border-bottom: 1px solid #d1d1d1;}
|
||||
|
||||
.prize-bg{background: url('../../_site/images/prize-bg.png') no-repeat; background-size: cover; background-position: center center; height: 326px; width: 100%;}
|
||||
.prize-button{text-transform: uppercase; color: #000; text-shadow: 1px 0 #fff; float:right; background: url('../../_site/images/prize-button.png') no-repeat; width: 300px; height: 70px; padding-top:135px; font-size: 16px; padding-left: 75px; margin-top: 25px; margin-right: 145px;}
|
||||
|
||||
.footer{ background: #e0e4f1 url('../../_site/images/footer-bg2.jpg') no-repeat; background-size: cover; width:100%; height: 592px; bottom:0; }
|
||||
.photonstorm-logo{background: url('../../_site/images/photonstorm-logo.png') no-repeat; background-size: cover; display: block;clear:both; width:113px;height:15px; margin-bottom: 6px;}
|
||||
.flixel-logo{display:block; clear:both; width:26px; height:50px; background: url('../../_site/images/flixel-logo.png') no-repeat;}
|
||||
.forums-icon, .twitter-icon, .github-icon{background: url('../../_site/images/forums-icon.png') no-repeat; vertical-align: middle; padding-left: 68px; height: 35px; display: inline-block; padding-top: 25px;}
|
||||
.twitter-icon{background: url('../../_site/images/twitter-icon.png') no-repeat;}
|
||||
.github-icon{background: url('../../_site/images/github-icon.png') no-repeat;}
|
||||
|
||||
#footer .main-container .line {
|
||||
margin-top: 130px;
|
||||
color:#fff; text-shadow: 1px 1px 0 #000; line-height: 1.25em; font-size: 15px;
|
||||
}
|
||||
|
||||
ul.footer-links{list-style-type: none; width:100%; clear:both; padding:0; margin:0; float:right; margin-top: -20px;}
|
||||
ul.footer-links > li{display: inline-block; padding:0; margin:0; float:right;}
|
||||
|
||||
.game-panel{width:800px; height: 680px; overflow: hidden; display:block; clear:both;box-shadow: 0 0 15px #6ac8f8; margin:-150px auto 0 auto; border-radius: 10px; position: relative; z-index: 10;}
|
||||
.game-screen{display:block; clear:both; width:800px;height:600px;margin:0;}
|
||||
.game-controls{display:block; width:100%; height:80px; margin:0; padding:0;background: url('../../_site/images/game-controls-bg.jpg') repeat-x;}
|
||||
ul.left-controls{float:left; list-style-type: none; margin:30px 0 0 25px;padding:0; display: inline-block;}
|
||||
ul.left-controls > li{margin:0;padding:0; display: inline-block; vertical-align: middle;}
|
||||
.controls-label{display:inline-block; width:80px; height:9px; background: url('../../_site/images/controls-label.png') no-repeat;}
|
||||
.up-label{display: inline-block; width:11px; height: 11px; background: url('../../_site/images/up-label.png') no-repeat;}
|
||||
.down-label{display: inline-block; width:11px; height: 11px; background: url('../../_site/images/down-label.png') no-repeat;}
|
||||
.left-label{display: inline-block; width:13px; height: 11px; background: url('../../_site/images/left-label.png') no-repeat;}
|
||||
.right-label{display: inline-block; width:12px; height: 11px; background: url('../../_site/images/right-label.png') no-repeat;}
|
||||
.space-label{display: inline-block; width:64px; height: 18px; background: url('../../_site/images/space-label.png') no-repeat;}
|
||||
|
||||
ul.right-controls{float:right;list-style-type: none; padding:0; display: inline-block; margin: 15px 25px 0 0;}
|
||||
ul.right-controls > li{margin:0;padding:0; display: inline-block; vertical-align: middle;}
|
||||
.pause-button{width: 121px; height:52px; display:inline-block; background: url('../../_site/images/pause-button.png') no-repeat;}
|
||||
.mute-button{width: 121px; height:52px; display:inline-block; background: url('../../_site/images/mute-button.png') no-repeat;}
|
||||
.reset-button{width: 121px; height:52px; display:inline-block; background: url('../../_site/images/reset-button.png') no-repeat;}
|
||||
.pause-button:hover, .mute-button:hover, .reset-button:hover{cursor: pointer;}
|
||||
.filler{height: 720px;}
|
||||
.code-block{font-family: Courier; font-size: 12px; color: #fff; width:750px; height:auto; overflow: scroll; margin:0 auto; border-radius: 10px; background:#fdfdfd; border:0 !important; box-shadow: inset 0 5px 15px rgba(0,0,0,0.15), 0 0 10px rgba(106,200,248,0.5); padding: 25px !important;display: block; margin-bottom: 20px; margin-top: 30px;}
|
||||
.px800{width:800px; clear:both; display: block; margin:0 auto; line-height: 1.5em;}
|
||||
.gradient p{color:#333;}
|
||||
|
||||
@media only screen and (max-width: 1235px), only screen and (max-device-width: 1235px){
|
||||
ul.nav-links{min-width:100% !important;}
|
||||
ul.nav-links > li{display: inline-block;}
|
||||
}
|
||||
@media only screen and (max-width: 1120px), only screen and (max-device-width: 1120px){
|
||||
.footer .box20, .footer .box55, .footer .box15{display: block; clear:both; margin:10px auto; text-align: center; float:none;}
|
||||
.footer .box5{display:none;}
|
||||
.photonstorm-logo{margin:10px auto;}
|
||||
.footer .box55{width:100%; float:none; margin:10px auto;}
|
||||
.footer ul.footer-links{width:100%;}
|
||||
.footer ul.footer-links > li{float:none;}
|
||||
.footer > .main-container > .line{margin-top: 125px;}
|
||||
}
|
||||
@media only screen and (max-width: 1020px), only screen and (max-device-width: 1020px){
|
||||
.phaser-logo{display:none;}
|
||||
.header{margin-bottom: -350px;}
|
||||
p.title, p.count-examples{text-align: center;}
|
||||
.box20, .box60{min-width:100% !important; clear:both; width: 100% !important; max-width: 100% !important; text-align: center;}
|
||||
a.prize-button{margin:0 auto; float:none;display:block;}
|
||||
.prize-bg{background: transparent;}
|
||||
}
|
||||
@media only screen and (max-width: 810px), only screen and (max-device-width: 810px){
|
||||
.main-container{width:100%;}
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
@font-face {
|
||||
|
||||
font-family: 'inconsolata';
|
||||
src: url('../../_site/fonts/inconsolata.woff') format('woff');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
|
||||
}
|
||||
|
||||
body {
|
||||
|
||||
background: #e0e4f1;
|
||||
margin: 0px;
|
||||
font-family: 'inconsolata';
|
||||
font-size: 15px;
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: #1c99bb;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
background-color: #e69b0b;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
h1 {
|
||||
|
||||
font-size: 25px;
|
||||
font-weight: normal;
|
||||
|
||||
}
|
||||
|
||||
h2 {
|
||||
|
||||
font-size: 20px;
|
||||
font-weight: normal;
|
||||
|
||||
}
|
||||
|
||||
#header {
|
||||
background: url(../../_site/images/lite_header.jpg) no-repeat left top;
|
||||
width: 300px;
|
||||
height: 100px;
|
||||
}
|
||||
|
||||
#panel {
|
||||
|
||||
background: url(../../_site/images/lite_header_2.jpg) no-repeat left top;
|
||||
width: 300px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
|
||||
}
|
||||
|
||||
#panel #examples-list {
|
||||
|
||||
padding: 10px 20px;
|
||||
line-height: 18px;
|
||||
|
||||
}
|
||||
|
||||
#footer {
|
||||
background: url(../../_site/images/lite_footer.jpg) no-repeat left top;
|
||||
width: 300px;
|
||||
height: 170px;
|
||||
color: #000;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#viewer {
|
||||
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 300px;
|
||||
width: -webkit-calc(100% - 300px); /* Safari */
|
||||
width: calc(100% - 300px);
|
||||
height: 100%;
|
||||
border: 0px;
|
||||
|
||||
}
|
Before Width: | Height: | Size: 212 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 192 KiB |
Before Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 228 KiB |
Before Width: | Height: | Size: 105 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 111 KiB |
Before Width: | Height: | Size: 27 KiB |
Before Width: | Height: | Size: 33 KiB |
Before Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 86 KiB |
Before Width: | Height: | Size: 99 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 106 KiB |
Before Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 124 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 19 KiB |
6
examples/_site/js/jquery-2.0.3.min.js
vendored
|
@ -1,106 +0,0 @@
|
|||
$(document).ready(function(){
|
||||
|
||||
$.getJSON("_site/examples.json")
|
||||
|
||||
.done(function(data) {
|
||||
|
||||
var i = 0;
|
||||
var t = 0;
|
||||
var len = 0;
|
||||
var node = '';
|
||||
var laser = '';
|
||||
|
||||
var directories = Object.keys(data);
|
||||
|
||||
directories.splice(directories.indexOf('basics'), 1);
|
||||
directories.splice(directories.indexOf('games'), 1);
|
||||
directories.sort();
|
||||
directories.unshift('basics', 'games');
|
||||
|
||||
directories.forEach(function(dir)
|
||||
{
|
||||
var files = data[dir];
|
||||
len = Math.floor(files.length / 4) + 1;
|
||||
|
||||
if ((files.length / 4) % 1 == 0)
|
||||
{
|
||||
len--;
|
||||
}
|
||||
|
||||
if (len > 9)
|
||||
{
|
||||
laser = 'laser10';
|
||||
}
|
||||
else
|
||||
{
|
||||
laser = 'laser' + len;
|
||||
}
|
||||
|
||||
if (i == 1)
|
||||
{
|
||||
node = '<div class="clear5"></div><div class="line dark-bg">';
|
||||
}
|
||||
else if (i == 2)
|
||||
{
|
||||
node = '<div class="clear5"></div><div class="line bright-bg">';
|
||||
}
|
||||
|
||||
node += '<div class="box20"><p class="title strong">' + dir + '</p>';
|
||||
node += '<p class="count-examples strong">' + files.length + ' examples</p></div><div class="box80">';
|
||||
node += '<ul class="group-items ' + laser + '">';
|
||||
|
||||
for (var e = 0; e < files.length; e++)
|
||||
{
|
||||
node += '<li><a href="_site/view_full.html?d=' + dir + '&f=' + files[e].file + '&t=' + files[e].title + '">' + files[e].title + '</a></li>';
|
||||
t++;
|
||||
}
|
||||
|
||||
node += '</ul></div>';
|
||||
|
||||
$("#examples-list").append(node);
|
||||
|
||||
i++;
|
||||
|
||||
if (i == 3)
|
||||
{
|
||||
i = 1;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$("#total").append(t);
|
||||
|
||||
})
|
||||
|
||||
.fail(function() {
|
||||
|
||||
var node = '<div class="clear5"></div><div class="line dark-bg">';
|
||||
|
||||
node += '<div class="box20"><p class="title strong">Error!</p>';
|
||||
node += '<p class="count-examples strong">:(</p></div><div class="box80"><div class="error">';
|
||||
|
||||
node += '<p>Unable to load <u>examples.json</u> data file</p>';
|
||||
node += '<p>Did you open this html file locally?</p>';
|
||||
node += '<p>It needs to be opened via a web server, or due to browser security permissions<br />it will be unable to load local resources such as images and json data.</p>';
|
||||
node += '<p>Please see our <a href="#">Getting Started guide</a> for details.</p>';
|
||||
|
||||
node += '</div>';
|
||||
node += '</div>';
|
||||
|
||||
$("#examples-list").append(node);
|
||||
|
||||
});
|
||||
|
||||
$.getJSON("http://phaser.io/version.json")
|
||||
|
||||
.done(function(data) {
|
||||
|
||||
if (data.version !== '1.1.4')
|
||||
{
|
||||
$("#upgrade").append(data.version);
|
||||
$("#upgrade").css('display', 'inline-block');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
|
@ -1,57 +0,0 @@
|
|||
$(document).ready(function(){
|
||||
|
||||
$.getJSON("_site/examples.json")
|
||||
|
||||
.done(function(data) {
|
||||
|
||||
var i = 0;
|
||||
var node = '';
|
||||
|
||||
var directories = Object.keys(data);
|
||||
|
||||
directories.splice(directories.indexOf('basics'), 1);
|
||||
directories.splice(directories.indexOf('games'), 1);
|
||||
directories.sort();
|
||||
directories.unshift('basics', 'games');
|
||||
|
||||
directories.forEach(function(dir)
|
||||
{
|
||||
var files = data[dir];
|
||||
node = '<h2>' + dir + '</h2>';
|
||||
|
||||
for (var e = 0; e < files.length; e++)
|
||||
{
|
||||
node += '<a href="_site/view_lite.html?d=' + dir + '&f=' + files[e].file + '&t=' + files[e].title + '" target="viewer">' + files[e].title + '</a><br />';
|
||||
}
|
||||
|
||||
$("#examples-list").append(node);
|
||||
|
||||
i += files.length;
|
||||
|
||||
});
|
||||
|
||||
$("#total").append(i);
|
||||
|
||||
// Re-calc the viewer height
|
||||
var height = $(window).height() - 270;
|
||||
$("#panel").css('height', height + 'px');
|
||||
|
||||
// iFrame focus
|
||||
$('a').click(function(e) { $('#viewer').focus(); });
|
||||
|
||||
})
|
||||
|
||||
.fail(function() {
|
||||
|
||||
var node = '<h1>Error!</h1>';
|
||||
|
||||
node += '<p>Unable to load <u>examples.json</u> data file</p>';
|
||||
node += '<p>Did you open this html file locally?</p>';
|
||||
node += '<p>It needs to be opened via a web server, or due to browser security permissions<br />it will be unable to load local resources such as images and json data.</p>';
|
||||
node += '<p>Please see our <a href="#">Getting Started guide</a> for details.</p>';
|
||||
|
||||
$("#viewer").contents().find('body').append(node);
|
||||
|
||||
});
|
||||
|
||||
});
|
|
@ -1,69 +0,0 @@
|
|||
$(document).ready(function(){
|
||||
|
||||
var dir = $.url().param('d');
|
||||
var file = $.url().param('f');
|
||||
var title = $.url().param('t');
|
||||
|
||||
document.title = 'phaser - ' + title;
|
||||
|
||||
$("#title").append(title);
|
||||
|
||||
$.getScript(dir + "/" + file)
|
||||
|
||||
.done(function(script, textStatus) {
|
||||
|
||||
$.ajax({ url: dir + "/" + file, dataType: "text" }).done(function(data) { $("#sourcecode").text(data); });
|
||||
|
||||
// Hook up the control panel
|
||||
|
||||
$(".pause-button").click(function() {
|
||||
if (game.paused)
|
||||
{
|
||||
game.paused = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
game.paused = true;
|
||||
}
|
||||
});
|
||||
|
||||
$(".mute-button").click(function() {
|
||||
if (game.sound.mute)
|
||||
{
|
||||
game.sound.mute = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
game.sound.mute = true;
|
||||
}
|
||||
});
|
||||
|
||||
$(".reset-button").click(function() {
|
||||
document.location.reload(true);
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
.fail(function(jqxhr, settings, exception) {
|
||||
|
||||
$("#title").text("Error");
|
||||
|
||||
var node = '<p>Unable to load <u>' + dir + '/' + file + '</u></p>';
|
||||
|
||||
$('#phaser-example').append(node);
|
||||
|
||||
});
|
||||
|
||||
$.getJSON("http://phaser.io/version.json")
|
||||
|
||||
.done(function(data) {
|
||||
|
||||
if (data.version !== '2.0.0')
|
||||
{
|
||||
$("#upgrade").append(data.version);
|
||||
$("#upgrade").css('display', 'inline-block');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
|
@ -1 +0,0 @@
|
|||
.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee}
|
|
@ -1,30 +0,0 @@
|
|||
!function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
|
||||
(function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=
|
||||
b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a<f;++a){var h=b[a];if(/\\[bdsw]/i.test(h))c.push(h);else{var h=d(h),l;a+2<f&&"-"===b[a+1]?(l=d(b[a+2]),a+=2):l=h;e.push([h,l]);l<65||h>122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;a<e.length;++a)h=e[a],h[0]<=f[1]+1?f[1]=Math.max(f[1],h[1]):b.push(f=h);for(a=0;a<b.length;++a)h=b[a],c.push(g(h[0])),
|
||||
h[1]>h[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f<c;++f){var l=a[f];l==="("?++h:"\\"===l.charAt(0)&&(l=+l.substring(1))&&(l<=h?d[l]=-1:a[f]=g(l))}for(f=1;f<d.length;++f)-1===d[f]&&(d[f]=++x);for(h=f=0;f<c;++f)l=a[f],l==="("?(++h,d[h]||(a[f]="(?:")):"\\"===l.charAt(0)&&(l=+l.substring(1))&&l<=h&&
|
||||
(a[f]="\\"+d[l]);for(f=0;f<c;++f)"^"===a[f]&&"^"!==a[f+1]&&(a[f]="");if(e.ignoreCase&&m)for(f=0;f<c;++f)l=a[f],e=l.charAt(0),l.length>=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k<c;++k){var i=a[k];if(i.ignoreCase)j=!0;else if(/[a-z]/i.test(i.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){m=!0;j=!1;break}}for(var r={b:8,t:9,n:10,v:11,
|
||||
f:12,r:13},n=[],k=0,c=a.length;k<c;++k){i=a[k];if(i.global||i.multiline)throw Error(""+i);n.push("(?:"+s(i)+")")}return RegExp(n.join("|"),j?"gi":"g")}function T(a,d){function g(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)g(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)s[j]="\n",m[j<<1]=x++,m[j++<<1|1]=a}}else if(c==3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),s[j]=c,m[j<<1]=x,x+=c.length,m[j++<<1|1]=
|
||||
a)}var b=/(?:^|\s)nocode(?:\s|$)/,s=[],x=0,m=[],j=0;g(a);return{a:s.join("").replace(/\n$/,""),d:m}}function H(a,d,g,b){d&&(a={a:d,e:a},g(a),b.push.apply(b,a.g))}function U(a){for(var d=void 0,g=a.firstChild;g;g=g.nextSibling)var b=g.nodeType,d=b===1?d?a:g:b===3?V.test(g.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function g(a){for(var j=a.e,k=[j,"pln"],c=0,i=a.a.match(s)||[],r={},n=0,e=i.length;n<e;++n){var z=i[n],w=r[z],t=void 0,f;if(typeof w==="string")f=!1;else{var h=b[z.charAt(0)];
|
||||
if(h)t=z.match(h[1]),w=h[0];else{for(f=0;f<x;++f)if(h=d[f],t=z.match(h[1])){w=h[0];break}t||(w="pln")}if((f=w.length>=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c<i;++c){var r=
|
||||
g[c],n=r[3];if(n)for(var e=n.length;--e>=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
|
||||
q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com",
|
||||
/^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+
|
||||
s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,
|
||||
q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d=
|
||||
c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i<c.length;++i)b(c[i]);d===(d|0)&&c[0].setAttribute("value",d);var r=j.createElement("ol");
|
||||
r.className="linenums";for(var d=Math.max(0,d-1|0)||0,i=0,n=c.length;i<n;++i)k=c[i],k.className="L"+(i+d)%10,k.firstChild||k.appendChild(j.createTextNode("\u00a0")),r.appendChild(k);a.appendChild(r)}function p(a,d){for(var g=d.length;--g>=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return F[a]}function K(a){var d=a.h;try{var g=T(a.c,a.i),b=g.a;
|
||||
a.a=b;a.d=g.d;a.e=0;I(d,b)(a);var s=/\bMSIE\s(\d+)/.exec(navigator.userAgent),s=s&&+s[1]<=8,d=/\n/g,x=a.a,m=x.length,g=0,j=a.d,k=j.length,b=0,c=a.g,i=c.length,r=0;c[i]=m;var n,e;for(e=n=0;e<i;)c[e]!==c[e+2]?(c[n++]=c[e++],c[n++]=c[e++]):e+=2;i=n;for(e=n=0;e<i;){for(var p=c[e],w=c[e+1],t=e+2;t+2<=i&&c[t+1]===w;)t+=2;c[n++]=p;c[n++]=w;e=t}c.length=n;var f=a.c,h;if(f)h=f.style.display,f.style.display="none";try{for(;b<k;){var l=j[b+2]||m,B=c[r+2]||m,t=Math.min(l,B),A=j[b+1],G;if(A.nodeType!==1&&(G=x.substring(g,
|
||||
t))){s&&(G=G.replace(d,"\r"));A.nodeValue=G;var L=A.ownerDocument,o=L.createElement("span");o.className=c[r+1];var v=A.parentNode;v.replaceChild(o,A);o.appendChild(A);g<l&&(j[b+1]=A=L.createTextNode(x.substring(t,l)),v.insertBefore(A,o.nextSibling))}g=t;g>=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
|
||||
V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
|
||||
/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);p(C([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],
|
||||
["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);p(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);p(v({keywords:M,hashComments:!0,cStyleComments:!0,types:R}),["c","cc","cpp","cxx","cyc","m"]);p(v({keywords:"null,true,false"}),["json"]);p(v({keywords:O,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:R}),
|
||||
["cs"]);p(v({keywords:N,cStyleComments:!0}),["java"]);p(v({keywords:y,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);p(v({keywords:P,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);p(v({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);p(v({keywords:Q,
|
||||
hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);p(v({keywords:E,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);p(v({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);p(v({keywords:W,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]);
|
||||
p(C([],[["str",/^[\S\s]+/]]),["regex"]);var Y=D.PR={createSimpleLexer:C,registerLangHandler:p,sourceDecorator:v,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:D.prettyPrintOne=function(a,d,g){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;g&&J(b,g,!0);K({h:d,j:g,c:b,i:1});
|
||||
return b.innerHTML},prettyPrint:D.prettyPrint=function(a,d){function g(){for(var b=D.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;i<p.length&&c.now()<b;i++){for(var d=p[i],j=h,k=d;k=k.previousSibling;){var m=k.nodeType,o=(m===7||m===8)&&k.nodeValue;if(o?!/^\??prettify\b/.test(o):m!==3||/\S/.test(k.nodeValue))break;if(o){j={};o.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){j[b]=c});break}}k=d.className;if((j!==h||e.test(k))&&!v.test(k)){m=!1;for(o=d.parentNode;o;o=o.parentNode)if(f.test(o.tagName)&&
|
||||
o.className&&e.test(o.className)){m=!0;break}if(!m){d.className+=" prettyprinted";m=j.lang;if(!m){var m=k.match(n),y;if(!m&&(y=U(d))&&t.test(y.tagName))m=y.className.match(n);m&&(m=m[1])}if(w.test(d.tagName))o=1;else var o=d.currentStyle,u=s.defaultView,o=(o=o?o.whiteSpace:u&&u.getComputedStyle?u.getComputedStyle(d,q).getPropertyValue("white-space"):0)&&"pre"===o.substring(0,3);u=j.linenums;if(!(u=u==="true"||+u))u=(u=k.match(/\blinenums\b(?::(\d+))?/))?u[1]&&u[1].length?+u[1]:!0:!1;u&&J(d,u,o);r=
|
||||
{h:m,c:d,j:u,i:o};K(r)}}}i<p.length?setTimeout(g,250):"function"===typeof a&&a()}for(var b=d||document.body,s=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],p=[],m=0;m<b.length;++m)for(var j=0,k=b[m].length;j<k;++j)p.push(b[m][j]);var b=q,c=Date;c.now||(c={now:function(){return+new Date}});var i=0,r,n=/\blang(?:uage)?-([\w.]+)(?!\S)/,e=/\bprettyprint\b/,v=/\bprettyprinted\b/,w=/pre|xmp/i,t=/^code$/i,f=/^(?:pre|code|xmp)$/i,
|
||||
h={};g()}};typeof define==="function"&&define.amd&&define("google-code-prettify",[],function(){return Y})})();}()
|
|
@ -1,276 +0,0 @@
|
|||
/*
|
||||
* Purl (A JavaScript URL parser) v2.3.1
|
||||
* Developed and maintanined by Mark Perkins, mark@allmarkedup.com
|
||||
* Source repository: https://github.com/allmarkedup/jQuery-URL-Parser
|
||||
* Licensed under an MIT-style license. See https://github.com/allmarkedup/jQuery-URL-Parser/blob/master/LICENSE for details.
|
||||
*/
|
||||
|
||||
;
|
||||
(function(factory) {
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(factory);
|
||||
} else {
|
||||
window.purl = factory();
|
||||
}
|
||||
})(function() {
|
||||
|
||||
var tag2attr = {
|
||||
a: 'href',
|
||||
img: 'src',
|
||||
form: 'action',
|
||||
base: 'href',
|
||||
script: 'src',
|
||||
iframe: 'src',
|
||||
link: 'href',
|
||||
embed: 'src',
|
||||
object: 'data'
|
||||
},
|
||||
|
||||
key = ['source', 'protocol', 'authority', 'userInfo', 'user', 'password', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'fragment'], // keys available to query
|
||||
|
||||
aliases = {
|
||||
'anchor': 'fragment'
|
||||
}, // aliases for backwards compatability
|
||||
|
||||
parser = {
|
||||
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, //less intuitive, more accurate to the specs
|
||||
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs
|
||||
},
|
||||
|
||||
isint = /^[0-9]+$/;
|
||||
|
||||
function parseUri(url, strictMode) {
|
||||
var str = decodeURI(url),
|
||||
res = parser[strictMode || false ? 'strict' : 'loose'].exec(str),
|
||||
uri = {
|
||||
attr: {},
|
||||
param: {},
|
||||
seg: {}
|
||||
},
|
||||
i = 14;
|
||||
|
||||
while (i--) {
|
||||
uri.attr[key[i]] = res[i] || '';
|
||||
}
|
||||
|
||||
// build query and fragment parameters
|
||||
uri.param['query'] = parseString(uri.attr['query']);
|
||||
uri.param['fragment'] = parseString(uri.attr['fragment']);
|
||||
|
||||
// split path and fragement into segments
|
||||
uri.seg['path'] = uri.attr.path.replace(/^\/+|\/+$/g, '').split('/');
|
||||
uri.seg['fragment'] = uri.attr.fragment.replace(/^\/+|\/+$/g, '').split('/');
|
||||
|
||||
// compile a 'base' domain attribute
|
||||
uri.attr['base'] = uri.attr.host ? (uri.attr.protocol ? uri.attr.protocol + '://' + uri.attr.host : uri.attr.host) + (uri.attr.port ? ':' + uri.attr.port : '') : '';
|
||||
|
||||
return uri;
|
||||
}
|
||||
|
||||
function getAttrName(elm) {
|
||||
var tn = elm.tagName;
|
||||
if (typeof tn !== 'undefined') return tag2attr[tn.toLowerCase()];
|
||||
return tn;
|
||||
}
|
||||
|
||||
function promote(parent, key) {
|
||||
if (parent[key].length === 0) return parent[key] = {};
|
||||
var t = {};
|
||||
for (var i in parent[key]) t[i] = parent[key][i];
|
||||
parent[key] = t;
|
||||
return t;
|
||||
}
|
||||
|
||||
function parse(parts, parent, key, val) {
|
||||
var part = parts.shift();
|
||||
if (!part) {
|
||||
if (isArray(parent[key])) {
|
||||
parent[key].push(val);
|
||||
} else if ('object' == typeof parent[key]) {
|
||||
parent[key] = val;
|
||||
} else if ('undefined' == typeof parent[key]) {
|
||||
parent[key] = val;
|
||||
} else {
|
||||
parent[key] = [parent[key], val];
|
||||
}
|
||||
} else {
|
||||
var obj = parent[key] = parent[key] || [];
|
||||
if (']' == part) {
|
||||
if (isArray(obj)) {
|
||||
if ('' !== val) obj.push(val);
|
||||
} else if ('object' == typeof obj) {
|
||||
obj[keys(obj).length] = val;
|
||||
} else {
|
||||
obj = parent[key] = [parent[key], val];
|
||||
}
|
||||
} else if (~part.indexOf(']')) {
|
||||
part = part.substr(0, part.length - 1);
|
||||
if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
|
||||
parse(parts, obj, part, val);
|
||||
// key
|
||||
} else {
|
||||
if (!isint.test(part) && isArray(obj)) obj = promote(parent, key);
|
||||
parse(parts, obj, part, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function merge(parent, key, val) {
|
||||
if (~key.indexOf(']')) {
|
||||
var parts = key.split('[');
|
||||
parse(parts, parent, 'base', val);
|
||||
} else {
|
||||
if (!isint.test(key) && isArray(parent.base)) {
|
||||
var t = {};
|
||||
for (var k in parent.base) t[k] = parent.base[k];
|
||||
parent.base = t;
|
||||
}
|
||||
if (key !== '') {
|
||||
set(parent.base, key, val);
|
||||
}
|
||||
}
|
||||
return parent;
|
||||
}
|
||||
|
||||
function parseString(str) {
|
||||
return reduce(String(str).split(/&|;/), function(ret, pair) {
|
||||
try {
|
||||
pair = decodeURIComponent(pair.replace(/\+/g, ' '));
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
var eql = pair.indexOf('='),
|
||||
brace = lastBraceInKey(pair),
|
||||
key = pair.substr(0, brace || eql),
|
||||
val = pair.substr(brace || eql, pair.length);
|
||||
|
||||
val = val.substr(val.indexOf('=') + 1, val.length);
|
||||
|
||||
if (key === '') {
|
||||
key = pair;
|
||||
val = '';
|
||||
}
|
||||
|
||||
return merge(ret, key, val);
|
||||
}, {
|
||||
base: {}
|
||||
}).base;
|
||||
}
|
||||
|
||||
function set(obj, key, val) {
|
||||
var v = obj[key];
|
||||
if (typeof v === 'undefined') {
|
||||
obj[key] = val;
|
||||
} else if (isArray(v)) {
|
||||
v.push(val);
|
||||
} else {
|
||||
obj[key] = [v, val];
|
||||
}
|
||||
}
|
||||
|
||||
function lastBraceInKey(str) {
|
||||
var len = str.length,
|
||||
brace,
|
||||
c;
|
||||
for (var i = 0; i < len; ++i) {
|
||||
c = str[i];
|
||||
if (']' == c) brace = false;
|
||||
if ('[' == c) brace = true;
|
||||
if ('=' == c && !brace) return i;
|
||||
}
|
||||
}
|
||||
|
||||
function reduce(obj, accumulator) {
|
||||
var i = 0,
|
||||
l = obj.length >> 0,
|
||||
curr = arguments[2];
|
||||
while (i < l) {
|
||||
if (i in obj) curr = accumulator.call(undefined, curr, obj[i], i, obj);
|
||||
++i;
|
||||
}
|
||||
return curr;
|
||||
}
|
||||
|
||||
function isArray(vArg) {
|
||||
return Object.prototype.toString.call(vArg) === "[object Array]";
|
||||
}
|
||||
|
||||
function keys(obj) {
|
||||
var key_array = [];
|
||||
for (var prop in obj) {
|
||||
if (obj.hasOwnProperty(prop)) key_array.push(prop);
|
||||
}
|
||||
return key_array;
|
||||
}
|
||||
|
||||
function purl(url, strictMode) {
|
||||
if (arguments.length === 1 && url === true) {
|
||||
strictMode = true;
|
||||
url = undefined;
|
||||
}
|
||||
strictMode = strictMode || false;
|
||||
url = url || window.location.toString();
|
||||
|
||||
return {
|
||||
|
||||
data: parseUri(url, strictMode),
|
||||
|
||||
// get various attributes from the URI
|
||||
attr: function(attr) {
|
||||
attr = aliases[attr] || attr;
|
||||
return typeof attr !== 'undefined' ? this.data.attr[attr] : this.data.attr;
|
||||
},
|
||||
|
||||
// return query string parameters
|
||||
param: function(param) {
|
||||
return typeof param !== 'undefined' ? this.data.param.query[param] : this.data.param.query;
|
||||
},
|
||||
|
||||
// return fragment parameters
|
||||
fparam: function(param) {
|
||||
return typeof param !== 'undefined' ? this.data.param.fragment[param] : this.data.param.fragment;
|
||||
},
|
||||
|
||||
// return path segments
|
||||
segment: function(seg) {
|
||||
if (typeof seg === 'undefined') {
|
||||
return this.data.seg.path;
|
||||
} else {
|
||||
seg = seg < 0 ? this.data.seg.path.length + seg : seg - 1; // negative segments count from the end
|
||||
return this.data.seg.path[seg];
|
||||
}
|
||||
},
|
||||
|
||||
// return fragment segments
|
||||
fsegment: function(seg) {
|
||||
if (typeof seg === 'undefined') {
|
||||
return this.data.seg.fragment;
|
||||
} else {
|
||||
seg = seg < 0 ? this.data.seg.fragment.length + seg : seg - 1; // negative segments count from the end
|
||||
return this.data.seg.fragment[seg];
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
purl.jQuery = function($) {
|
||||
if ($ != null) {
|
||||
$.fn.url = function(strictMode) {
|
||||
var url = '';
|
||||
if (this.length) {
|
||||
url = $(this).attr(getAttrName(this[0])) || '';
|
||||
}
|
||||
return purl(url, strictMode);
|
||||
};
|
||||
|
||||
$.url = purl;
|
||||
}
|
||||
};
|
||||
|
||||
purl.jQuery(window.jQuery);
|
||||
|
||||
return purl;
|
||||
|
||||
});
|
|
@ -1,34 +0,0 @@
|
|||
!function(){var r=null;
|
||||
(function(){function X(e){function j(){try{J.doScroll("left")}catch(e){P(j,50);return}w("poll")}function w(j){if(!(j.type=="readystatechange"&&x.readyState!="complete")&&((j.type=="load"?n:x)[z](i+j.type,w,!1),!m&&(m=!0)))e.call(n,j.type||j)}var Y=x.addEventListener,m=!1,C=!0,t=Y?"addEventListener":"attachEvent",z=Y?"removeEventListener":"detachEvent",i=Y?"":"on";if(x.readyState=="complete")e.call(n,"lazy");else{if(x.createEventObject&&J.doScroll){try{C=!n.frameElement}catch(A){}C&&j()}x[t](i+"DOMContentLoaded",
|
||||
w,!1);x[t](i+"readystatechange",w,!1);n[t](i+"load",w,!1)}}function Q(){S&&X(function(){var e=K.length;$(e?function(){for(var j=0;j<e;++j)(function(e){P(function(){n.exports[K[e]].apply(n,arguments)},0)})(j)}:void 0)})}for(var n=window,P=n.setTimeout,x=document,J=x.documentElement,L=x.head||x.getElementsByTagName("head")[0]||J,z="",A=x.scripts,m=A.length;--m>=0;){var M=A[m],T=M.src.match(/^[^#?]*\/run_prettify\.js(\?[^#]*)?(?:#.*)?$/);if(T){z=T[1]||"";M.parentNode.removeChild(M);break}}var S=!0,D=
|
||||
[],N=[],K=[];z.replace(/[&?]([^&=]+)=([^&]+)/g,function(e,j,w){w=decodeURIComponent(w);j=decodeURIComponent(j);j=="autorun"?S=!/^[0fn]/i.test(w):j=="lang"?D.push(w):j=="skin"?N.push(w):j=="callback"&&K.push(w)});m=0;for(z=D.length;m<z;++m)(function(){var e=x.createElement("script");e.onload=e.onerror=e.onreadystatechange=function(){if(e&&(!e.readyState||/loaded|complete/.test(e.readyState)))e.onerror=e.onload=e.onreadystatechange=r,--R,R||P(Q,0),e.parentNode&&e.parentNode.removeChild(e),e=r};e.type=
|
||||
"text/javascript";e.src="https://google-code-prettify.googlecode.com/svn/loader/lang-"+encodeURIComponent(D[m])+".js";L.insertBefore(e,L.firstChild)})(D[m]);for(var R=D.length,A=[],m=0,z=N.length;m<z;++m)A.push("https://google-code-prettify.googlecode.com/svn/loader/skins/"+encodeURIComponent(N[m])+".css");A.push("https://google-code-prettify.googlecode.com/svn/loader/prettify.css");(function(e){function j(m){if(m!==w){var n=x.createElement("link");n.rel="stylesheet";n.type="text/css";if(m+1<w)n.error=
|
||||
n.onerror=function(){j(m+1)};n.href=e[m];L.appendChild(n)}}var w=e.length;j(0)})(A);var $=function(){window.PR_SHOULD_USE_CONTINUATION=!0;var e;(function(){function j(a){function d(f){var b=f.charCodeAt(0);if(b!==92)return b;var a=f.charAt(1);return(b=i[a])?b:"0"<=a&&a<="7"?parseInt(f.substring(1),8):a==="u"||a==="x"?parseInt(f.substring(2),16):f.charCodeAt(1)}function h(f){if(f<32)return(f<16?"\\x0":"\\x")+f.toString(16);f=String.fromCharCode(f);return f==="\\"||f==="-"||f==="]"||f==="^"?"\\"+f:
|
||||
f}function b(f){var b=f.substring(1,f.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),f=[],a=b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,g=b.length;a<g;++a){var k=b[a];if(/\\[bdsw]/i.test(k))c.push(k);else{var k=d(k),o;a+2<g&&"-"===b[a+1]?(o=d(b[a+2]),a+=2):o=k;f.push([k,o]);o<65||k>122||(o<65||k>90||f.push([Math.max(65,k)|32,Math.min(o,90)|32]),o<97||k>122||f.push([Math.max(97,k)&-33,Math.min(o,122)&-33]))}}f.sort(function(f,a){return f[0]-
|
||||
a[0]||a[1]-f[1]});b=[];g=[];for(a=0;a<f.length;++a)k=f[a],k[0]<=g[1]+1?g[1]=Math.max(g[1],k[1]):b.push(g=k);for(a=0;a<b.length;++a)k=b[a],c.push(h(k[0])),k[1]>k[0]&&(k[1]+1>k[0]&&c.push("-"),c.push(h(k[1])));c.push("]");return c.join("")}function e(f){for(var a=f.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],g=0,k=0;g<c;++g){var o=a[g];o==="("?++k:"\\"===o.charAt(0)&&(o=+o.substring(1))&&(o<=k?d[o]=-1:a[g]=h(o))}for(g=
|
||||
1;g<d.length;++g)-1===d[g]&&(d[g]=++j);for(k=g=0;g<c;++g)o=a[g],o==="("?(++k,d[k]||(a[g]="(?:")):"\\"===o.charAt(0)&&(o=+o.substring(1))&&o<=k&&(a[g]="\\"+d[o]);for(g=0;g<c;++g)"^"===a[g]&&"^"!==a[g+1]&&(a[g]="");if(f.ignoreCase&&F)for(g=0;g<c;++g)o=a[g],f=o.charAt(0),o.length>=2&&f==="["?a[g]=b(o):f!=="\\"&&(a[g]=o.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var j=0,F=!1,l=!1,I=0,c=a.length;I<c;++I){var p=a[I];if(p.ignoreCase)l=
|
||||
!0;else if(/[a-z]/i.test(p.source.replace(/\\u[\da-f]{4}|\\x[\da-f]{2}|\\[^UXux]/gi,""))){F=!0;l=!1;break}}for(var i={b:8,t:9,n:10,v:11,f:12,r:13},q=[],I=0,c=a.length;I<c;++I){p=a[I];if(p.global||p.multiline)throw Error(""+p);q.push("(?:"+e(p)+")")}return RegExp(q.join("|"),l?"gi":"g")}function m(a,d){function h(a){var c=a.nodeType;if(c==1){if(!b.test(a.className)){for(c=a.firstChild;c;c=c.nextSibling)h(c);c=a.nodeName.toLowerCase();if("br"===c||"li"===c)e[l]="\n",F[l<<1]=j++,F[l++<<1|1]=a}}else if(c==
|
||||
3||c==4)c=a.nodeValue,c.length&&(c=d?c.replace(/\r\n?/g,"\n"):c.replace(/[\t\n\r ]+/g," "),e[l]=c,F[l<<1]=j,j+=c.length,F[l++<<1|1]=a)}var b=/(?:^|\s)nocode(?:\s|$)/,e=[],j=0,F=[],l=0;h(a);return{a:e.join("").replace(/\n$/,""),d:F}}function n(a,d,h,b){d&&(a={a:d,e:a},h(a),b.push.apply(b,a.g))}function x(a){for(var d=void 0,h=a.firstChild;h;h=h.nextSibling)var b=h.nodeType,d=b===1?d?a:h:b===3?S.test(h.nodeValue)?a:d:d;return d===a?void 0:d}function C(a,d){function h(a){for(var l=a.e,j=[l,"pln"],c=
|
||||
0,p=a.a.match(e)||[],m={},q=0,f=p.length;q<f;++q){var B=p[q],y=m[B],u=void 0,g;if(typeof y==="string")g=!1;else{var k=b[B.charAt(0)];if(k)u=B.match(k[1]),y=k[0];else{for(g=0;g<i;++g)if(k=d[g],u=B.match(k[1])){y=k[0];break}u||(y="pln")}if((g=y.length>=5&&"lang-"===y.substring(0,5))&&!(u&&typeof u[1]==="string"))g=!1,y="src";g||(m[B]=y)}k=c;c+=B.length;if(g){g=u[1];var o=B.indexOf(g),H=o+g.length;u[2]&&(H=B.length-u[2].length,o=H-g.length);y=y.substring(5);n(l+k,B.substring(0,o),h,j);n(l+k+o,g,A(y,
|
||||
g),j);n(l+k+H,B.substring(H),h,j)}else j.push(l+k,y)}a.g=j}var b={},e;(function(){for(var h=a.concat(d),l=[],i={},c=0,p=h.length;c<p;++c){var m=h[c],q=m[3];if(q)for(var f=q.length;--f>=0;)b[q.charAt(f)]=m;m=m[1];q=""+m;i.hasOwnProperty(q)||(l.push(m),i[q]=r)}l.push(/[\S\s]/);e=j(l)})();var i=d.length;return h}function t(a){var d=[],h=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,
|
||||
r,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,r,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,r,"\"'"]);a.verbatimStrings&&h.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,r]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,r,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,
|
||||
r,"#"]),h.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,r])):d.push(["com",/^#[^\n\r]*/,r,"#"]));a.cStyleComments&&(h.push(["com",/^\/\/[^\n\r]*/,r]),h.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,r]));if(b=a.regexLiterals){var e=(b=b>1?"":"\n\r")?".":"[\\S\\s]";h.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<<?=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+
|
||||
("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+e+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+e+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&h.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&h.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),r]);d.push(["pln",/^\s+/,r," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");h.push(["lit",/^@[$_a-z][\w$@]*/i,r],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,r],["pln",/^[$_a-z][\w$@]*/i,r],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,
|
||||
r,"0123456789"],["pln",/^\\[\S\s]?/,r],["pun",RegExp(b),r]);return C(d,h)}function z(a,d,h){function b(a){var c=a.nodeType;if(c==1&&!j.test(a.className))if("br"===a.nodeName)e(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&h){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(l.createTextNode(d),a.nextSibling),e(a),c||a.parentNode.removeChild(a)}}
|
||||
function e(a){function b(a,c){var d=c?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),h=a.nextSibling;f.appendChild(d);for(var e=h;e;e=h)h=e.nextSibling,f.appendChild(e)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var j=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,l=a.ownerDocument,i=l.createElement("li");a.firstChild;)i.appendChild(a.firstChild);for(var c=[i],p=0;p<c.length;++p)b(c[p]);d===(d|0)&&c[0].setAttribute("value",
|
||||
d);var n=l.createElement("ol");n.className="linenums";for(var d=Math.max(0,d-1|0)||0,p=0,q=c.length;p<q;++p)i=c[p],i.className="L"+(p+d)%10,i.firstChild||i.appendChild(l.createTextNode("\u00a0")),n.appendChild(i);a.appendChild(n)}function i(a,d){for(var h=d.length;--h>=0;){var b=d[h];U.hasOwnProperty(b)?V.console&&console.warn("cannot override language handler %s",b):U[b]=a}}function A(a,d){if(!a||!U.hasOwnProperty(a))a=/^\s*</.test(d)?"default-markup":"default-code";return U[a]}function D(a){var d=
|
||||
a.h;try{var h=m(a.c,a.i),b=h.a;a.a=b;a.d=h.d;a.e=0;A(d,b)(a);var e=/\bMSIE\s(\d+)/.exec(navigator.userAgent),e=e&&+e[1]<=8,d=/\n/g,i=a.a,j=i.length,h=0,l=a.d,n=l.length,b=0,c=a.g,p=c.length,t=0;c[p]=j;var q,f;for(f=q=0;f<p;)c[f]!==c[f+2]?(c[q++]=c[f++],c[q++]=c[f++]):f+=2;p=q;for(f=q=0;f<p;){for(var x=c[f],y=c[f+1],u=f+2;u+2<=p&&c[u+1]===y;)u+=2;c[q++]=x;c[q++]=y;f=u}c.length=q;var g=a.c,k;if(g)k=g.style.display,g.style.display="none";try{for(;b<n;){var o=l[b+2]||j,H=c[t+2]||j,u=Math.min(o,H),E=l[b+
|
||||
1],W;if(E.nodeType!==1&&(W=i.substring(h,u))){e&&(W=W.replace(d,"\r"));E.nodeValue=W;var Z=E.ownerDocument,s=Z.createElement("span");s.className=c[t+1];var z=E.parentNode;z.replaceChild(s,E);s.appendChild(E);h<o&&(l[b+1]=E=Z.createTextNode(i.substring(u,o)),z.insertBefore(E,s.nextSibling))}h=u;h>=o&&(b+=2);h>=H&&(t+=2)}}finally{if(g)g.style.display=k}}catch(v){V.console&&console.log(v&&v.stack||v)}}var V=window,G=["break,continue,do,else,for,if,return,while"],O=[[G,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
|
||||
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],J=[O,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],K=[O,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
|
||||
L=[K,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],O=[O,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],M=[G,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
|
||||
N=[G,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],R=[G,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],G=[G,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],Q=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
|
||||
S=/\S/,T=t({keywords:[J,L,O,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",M,N,G],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),U={};i(T,["default-code"]);i(C([],[["pln",/^[^<?]+/],["dec",/^<!\w[^>]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
|
||||
/^<xmp\b[^>]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);i(C([["pln",/^\s+/,r," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,r,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],
|
||||
["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);i(C([],[["atv",/^[\S\s]+/]]),["uq.val"]);i(t({keywords:J,hashComments:!0,cStyleComments:!0,types:Q}),["c","cc","cpp","cxx","cyc","m"]);i(t({keywords:"null,true,false"}),["json"]);i(t({keywords:L,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:Q}),
|
||||
["cs"]);i(t({keywords:K,cStyleComments:!0}),["java"]);i(t({keywords:G,hashComments:!0,multiLineStrings:!0}),["bash","bsh","csh","sh"]);i(t({keywords:M,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),["cv","py","python"]);i(t({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:2}),["perl","pl","pm"]);i(t({keywords:N,
|
||||
hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb","ruby"]);i(t({keywords:O,cStyleComments:!0,regexLiterals:!0}),["javascript","js"]);i(t({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,throw,true,try,unless,until,when,while,yes",hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);i(t({keywords:R,cStyleComments:!0,multilineStrings:!0}),["rc","rs","rust"]);
|
||||
i(C([],[["str",/^[\S\s]+/]]),["regex"]);var X=V.PR={createSimpleLexer:C,registerLangHandler:i,sourceDecorator:t,PR_ATTRIB_NAME:"atn",PR_ATTRIB_VALUE:"atv",PR_COMMENT:"com",PR_DECLARATION:"dec",PR_KEYWORD:"kwd",PR_LITERAL:"lit",PR_NOCODE:"nocode",PR_PLAIN:"pln",PR_PUNCTUATION:"pun",PR_SOURCE:"src",PR_STRING:"str",PR_TAG:"tag",PR_TYPE:"typ",prettyPrintOne:function(a,d,e){var b=document.createElement("div");b.innerHTML="<pre>"+a+"</pre>";b=b.firstChild;e&&z(b,e,!0);D({h:d,j:e,c:b,i:1});return b.innerHTML},
|
||||
prettyPrint:e=e=function(a,d){function e(){for(var b=V.PR_SHOULD_USE_CONTINUATION?c.now()+250:Infinity;p<j.length&&c.now()<b;p++){for(var d=j[p],m=k,l=d;l=l.previousSibling;){var n=l.nodeType,s=(n===7||n===8)&&l.nodeValue;if(s?!/^\??prettify\b/.test(s):n!==3||/\S/.test(l.nodeValue))break;if(s){m={};s.replace(/\b(\w+)=([\w%+\-.:]+)/g,function(a,b,c){m[b]=c});break}}l=d.className;if((m!==k||f.test(l))&&!w.test(l)){n=!1;for(s=d.parentNode;s;s=s.parentNode)if(g.test(s.tagName)&&s.className&&f.test(s.className)){n=
|
||||
!0;break}if(!n){d.className+=" prettyprinted";n=m.lang;if(!n){var n=l.match(q),A;if(!n&&(A=x(d))&&u.test(A.tagName))n=A.className.match(q);n&&(n=n[1])}if(y.test(d.tagName))s=1;else var s=d.currentStyle,v=i.defaultView,s=(s=s?s.whiteSpace:v&&v.getComputedStyle?v.getComputedStyle(d,r).getPropertyValue("white-space"):0)&&"pre"===s.substring(0,3);v=m.linenums;if(!(v=v==="true"||+v))v=(v=l.match(/\blinenums\b(?::(\d+))?/))?v[1]&&v[1].length?+v[1]:!0:!1;v&&z(d,v,s);t={h:n,c:d,j:v,i:s};D(t)}}}p<j.length?
|
||||
P(e,250):"function"===typeof a&&a()}for(var b=d||document.body,i=b.ownerDocument||document,b=[b.getElementsByTagName("pre"),b.getElementsByTagName("code"),b.getElementsByTagName("xmp")],j=[],m=0;m<b.length;++m)for(var l=0,n=b[m].length;l<n;++l)j.push(b[m][l]);var b=r,c=Date;c.now||(c={now:function(){return+new Date}});var p=0,t,q=/\blang(?:uage)?-([\w.]+)(?!\S)/,f=/\bprettyprint\b/,w=/\bprettyprinted\b/,y=/pre|xmp/i,u=/^code$/i,g=/^(?:pre|code|xmp)$/i,k={};e()}};typeof define==="function"&&define.amd&&
|
||||
define("google-code-prettify",[],function(){return X})})();return e}();R||P(Q,0)})();}()
|
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 211 KiB |
Before Width: | Height: | Size: 42 KiB |
|
@ -1,110 +0,0 @@
|
|||
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<head>
|
||||
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
|
||||
<script src='http://code.jquery.com/jquery-latest.min.js' type='text/javascript'></script>
|
||||
<script src="https://google-code-prettify.googlecode.com/svn/loader/run_prettify.js"></script>
|
||||
<script src='./js/application.js' type='text/javascript'></script>
|
||||
<link href='./css/stylesheet.css' media='screen' rel='stylesheet' type='text/css'>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="box100 no-padding">
|
||||
<div class="phaser-version">
|
||||
<span>Phaser Version: 1.0.6</span>
|
||||
<a href="#" class="version-button">Update to 1.0.7</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="line">
|
||||
<div class="box20">
|
||||
<ul class="nav-links">
|
||||
<li class="link-home"><a href="#">Back to examples</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="box60 txt-center">
|
||||
<span class="main-title">Starstruck</span>
|
||||
</div>
|
||||
<div class="box20">
|
||||
<div class="phaser-logo"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="game-panel centered">
|
||||
<img src="./img/screenshot.jpg" alt="" class="game-screen"/>
|
||||
<div class="game-controls">
|
||||
<ul class="left-controls">
|
||||
<li class="controls-label"></li>
|
||||
<li class="up-label"></li>
|
||||
<li class="down-label"></li>
|
||||
<li class="left-label"></li>
|
||||
<li class="right-label"></li>
|
||||
<li class="space-label"></li>
|
||||
</ul>
|
||||
<ul class="right-controls">
|
||||
<li class="pause-button"></li>
|
||||
<li class="mute-button"></li>
|
||||
<li class="reset-button"></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clear filler"></div>
|
||||
<div class="gradient helvetica">
|
||||
<p class="centered px800">Lorem ipsum dolor sit amet enim. Etiam ullamcorper. Suspendisse a pellentesque dui, non felis. Maecenas malesuada elit lectus felis, malesuada ultricies. </p>
|
||||
<p class="centered px800">Curabitur et ligula. Ut molestie a, ultricies porta urna. Vestibulum commodo volutpat a, convallis ac, laoreet enim. Phasellus fermentum in, dolor. Pellentesque facilisis. Nulla imperdiet sit amet magna. </p>
|
||||
<pre class="code-block prettyprint centered">
|
||||
var Phaser;
|
||||
(function (Phaser) {
|
||||
var Basic = (function () {
|
||||
function Basic(game) {
|
||||
this.name = 'Space Harrier';
|
||||
this._game = game;
|
||||
this.ID = -1;
|
||||
this.exists = true;
|
||||
this.active = true;
|
||||
}
|
||||
Basic.prototype.destroy =
|
||||
function () {
|
||||
};
|
||||
// Code Comment
|
||||
Basic.prototype.toString =
|
||||
function () {
|
||||
return "";
|
||||
};
|
||||
return Basic;
|
||||
})();
|
||||
Phaser.Basic = Basic;
|
||||
})(Phaser || (Phaser = {}));
|
||||
</pre>
|
||||
<div class="clear20"></div>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
<div class="footer">
|
||||
<div class="main-container centered">
|
||||
<div class="clear25"></div>
|
||||
<div class="line">
|
||||
<div class="box20 helvetica">
|
||||
<a href="#" class="photonstorm-logo"></a>
|
||||
© 2013 Photon Storm Ltd.<br/>
|
||||
All rights reserved.
|
||||
</div>
|
||||
<div class="box5">
|
||||
<div class="flixel-logo"></div>
|
||||
</div>
|
||||
<div class="box15 helvetica">
|
||||
Looking for a flash game framework?<br/>
|
||||
<a href="#">Try flixel!</a>
|
||||
</div>
|
||||
<div class="box55 helvetica float-right">
|
||||
<ul class="footer-links">
|
||||
<li><a class="forums-icon" href="#">Phaser Forums</a></li>
|
||||
<li><a class="twitter-icon" href="#">@Photonstorm</a></li>
|
||||
<li><a class="github-icon" href="#">Phaser on Github</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,157 +0,0 @@
|
|||
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
|
||||
<head>
|
||||
<meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
|
||||
<script src='http://code.jquery.com/jquery-latest.min.js' type='text/javascript'></script>
|
||||
<script src='./js/application.js' type='text/javascript'></script>
|
||||
<link href='./css/stylesheet.css' media='screen' rel='stylesheet' type='text/css'>
|
||||
</head>
|
||||
<body>
|
||||
<div class="header">
|
||||
<div class="box100 no-padding">
|
||||
<div class="phaser-version">
|
||||
<span>Phaser Version: 1.0.6</span>
|
||||
<a href="#" class="version-button">Update to 1.0.7</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="line">
|
||||
<div class="box20">
|
||||
<ul class="nav-links">
|
||||
<li class="link-home"><a href="#">Phaser Home</a></li>
|
||||
<li class="link-latest"><a href="#">Download Latest</a></li>
|
||||
<li class="link-forum"><a href="#">Support Forum</a></li>
|
||||
<li class="link-docs"><a href="#">Documentation</a></li>
|
||||
<li class="link-twitter"><a href="#">Twitter</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="box60 txt-center">
|
||||
<div class="phaser-examples"></div>
|
||||
</div>
|
||||
<div class="box20">
|
||||
<div class="phaser-logo"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear clear25"></div>
|
||||
|
||||
<div class="line go-top border-bottom">
|
||||
<div class="box20">
|
||||
<p class="title strong">audio</p>
|
||||
<p class="count-examples strong">9 examples</p>
|
||||
</div>
|
||||
<div class="box80">
|
||||
<ul class="group-items">
|
||||
<li><a href="http://google.com">Play music<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Group<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite<span class="mark"></span></a></li>
|
||||
<li><a href="#">Play music2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Group2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Play music3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Group3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Play music3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Group3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Play music3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Group3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Play music3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Group3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Play music3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Group3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Play music3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Group3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Play music3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Group3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Play music3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Group3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite3<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Play music3<span class="mark"></span></a></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear5"></div>
|
||||
<div class="line dark-bg">
|
||||
<div class="box20">
|
||||
<p class="title strong">Collision</p>
|
||||
<p class="count-examples strong">3 examples</p>
|
||||
</div>
|
||||
<div class="box80">
|
||||
<ul class="group-items">
|
||||
<li><a href="#">Play music<span class="mark"></span></li>
|
||||
<li><a href="#">Sprite vs Group<span class="mark"></span></li>
|
||||
<li><a href="#">Sprite vs Sprite<span class="mark"></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear5"></div>
|
||||
<div class="line bright-bg">
|
||||
<div class="box20">
|
||||
<p class="title strong">Tilemaps</p>
|
||||
<p class="count-examples strong">7 examples</p>
|
||||
</div>
|
||||
<div class="box80">
|
||||
<ul class="group-items">
|
||||
<li><a href="#">Play music<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Group<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite<span class="mark"></span></a></li>
|
||||
<li><a href="#">Play music2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Group2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Sprite vs Sprite2<span class="mark"></span></a></li>
|
||||
<li><a href="#">Play music3<span class="mark"></span></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear5"></div>
|
||||
<div class="gradient">
|
||||
<div class="main-container centered">
|
||||
<div class="prize-bg">
|
||||
<a href="#" class="prize-button">View details & submit</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
<div class="footer">
|
||||
<div class="main-container centered">
|
||||
<div class="clear25"></div>
|
||||
<div class="line">
|
||||
<div class="box20 helvetica">
|
||||
<a href="#" class="photonstorm-logo"></a>
|
||||
© 2013 Photon Storm Ltd.<br/>
|
||||
All rights reserved.
|
||||
</div>
|
||||
<div class="box5">
|
||||
<div class="flixel-logo"></div>
|
||||
</div>
|
||||
<div class="box15 helvetica">
|
||||
Looking for a flash game framework?<br/>
|
||||
<a href="#">Try flixel!</a>
|
||||
</div>
|
||||
<div class="box55 helvetica float-right">
|
||||
<ul class="footer-links">
|
||||
<li><a class="forums-icon" href="#">Phaser Forums</a></li>
|
||||
<li><a class="twitter-icon" href="#">@Photonstorm</a></li>
|
||||
<li><a class="github-icon" href="#">Phaser on Github</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,94 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>phaser</title>
|
||||
<base href="../"></base>
|
||||
<script src="_site/js/jquery-2.0.3.min.js" type="text/javascript"></script>
|
||||
<script src="_site/js/purl.js" type="text/javascript"></script>
|
||||
<script src="_site/js/gamecontroller.js" type="text/javascript"></script>
|
||||
<script src="../build/phaser.js"></script>
|
||||
<script src="_site/js/phaser-viewer.js" type="text/javascript"></script>
|
||||
<script src="_site/js/run_prettify.js"></script>
|
||||
<link href="_site/css/phaser-examples.css" media="screen" rel="stylesheet" type="text/css">
|
||||
<link href="_site/css/desert.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
<div class="box100 no-padding">
|
||||
<div class="phaser-version">
|
||||
<span>Phaser Version: 2.0.0</span>
|
||||
<a id="upgrade" href="https://github.com/photonstorm/phaser" class="version-button">New version: </a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
<div class="line">
|
||||
<div class="box20">
|
||||
<ul class="nav-links">
|
||||
<li class="link-home"><a href="index.html">Back to examples</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="box60 txt-center">
|
||||
<span id="title" class="main-title"></span>
|
||||
</div>
|
||||
<div class="box20">
|
||||
<div class="phaser-logo"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="game-panel centered">
|
||||
<div id="phaser-example"></div>
|
||||
<div class="game-controls">
|
||||
<ul class="left-controls">
|
||||
<li class="controls-label"></li>
|
||||
<li class="up-label"></li>
|
||||
<li class="down-label"></li>
|
||||
<li class="left-label"></li>
|
||||
<li class="right-label"></li>
|
||||
<li class="space-label"></li>
|
||||
</ul>
|
||||
<ul class="right-controls">
|
||||
<li class="pause-button"></li>
|
||||
<li class="mute-button"></li>
|
||||
<li class="reset-button"></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clear filler"></div>
|
||||
<p class="centered px800">Source code:</p>
|
||||
<pre id="sourcecode" class="code-block centered prettyprint"></pre>
|
||||
|
||||
<div class="clear"></div>
|
||||
<div id="footer" class="footer">
|
||||
|
||||
<div class="main-container centered">
|
||||
<div class="prize-bg">
|
||||
<a href="http://www.html5gamedevs.com/topic/1813-the-monthly-phaser-examples-contest/" class="prize-button">View details & submit</a>
|
||||
</div>
|
||||
<div class="line">
|
||||
<div class="box20">
|
||||
<a href="http://www.photonstorm.com" class="photonstorm-logo"></a>
|
||||
© 2014 Photon Storm Ltd.<br/>
|
||||
All rights reserved.
|
||||
</div>
|
||||
<div class="box5">
|
||||
<div class="flixel-logo"></div>
|
||||
</div>
|
||||
<div class="box15">
|
||||
Looking for a flash game framework?<br/>
|
||||
<a href="http://flixel.org">Try Flixel</a>
|
||||
</div>
|
||||
<div class="box55 float-right">
|
||||
<ul class="footer-links">
|
||||
<li><a class="github-icon" href="https://github.com/photonstorm/phaser">Phaser on Github</a></li>
|
||||
<li><a class="twitter-icon" href="https://twitter.com/photonstorm">@photonstorm</a></li>
|
||||
<li><a class="forums-icon" href="http://www.html5gamedevs.com/forum/14-phaser/">Phaser Forums</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,19 +0,0 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>phaser</title>
|
||||
<base href="../"></base>
|
||||
<script src="_site/js/jquery-2.0.3.min.js" type="text/javascript"></script>
|
||||
<script src="_site/js/purl.js" type="text/javascript"></script>
|
||||
<script src="../build/phaser.js"></script>
|
||||
<script src="_site/js/phaser-viewer.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div id="phaser-example"></div>
|
||||
|
||||
<textarea id="sourcecode" style="margin-top: 16px; width: 800px; height: 600px"></textarea>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -1,69 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('lazur', 'assets/pics/thorn_lazur.png');
|
||||
game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
|
||||
|
||||
}
|
||||
|
||||
var back;
|
||||
var mummy;
|
||||
var anim;
|
||||
var loopText;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.smoothed = false;
|
||||
|
||||
back = game.add.image(0, -400, 'lazur');
|
||||
back.scale.set(2);
|
||||
|
||||
mummy = game.add.sprite(200, 360, 'mummy', 5);
|
||||
mummy.scale.set(4);
|
||||
|
||||
anim = mummy.animations.add('walk');
|
||||
|
||||
anim.onStart.add(animationStarted, this);
|
||||
anim.onLoop.add(animationLooped, this);
|
||||
anim.onComplete.add(animationStopped, this);
|
||||
|
||||
anim.play(10, true);
|
||||
|
||||
}
|
||||
|
||||
function animationStarted(sprite, animation) {
|
||||
|
||||
game.add.text(32, 32, 'Animation started', { fill: 'white' });
|
||||
|
||||
}
|
||||
|
||||
function animationLooped(sprite, animation) {
|
||||
|
||||
if (animation.loopCount === 1)
|
||||
{
|
||||
loopText = game.add.text(32, 64, 'Animation looped', { fill: 'white' });
|
||||
}
|
||||
else
|
||||
{
|
||||
loopText.text = 'Animation looped x2';
|
||||
animation.loop = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function animationStopped(sprite, animation) {
|
||||
|
||||
game.add.text(32, 64+32, 'Animation stopped', { fill: 'white' });
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
if (anim.isPlaying)
|
||||
{
|
||||
back.x -= 1;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.atlasJSONHash('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json');
|
||||
game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
|
||||
|
||||
}
|
||||
|
||||
var bot;
|
||||
|
||||
function create() {
|
||||
|
||||
bot = game.add.sprite(200, 200, 'bot');
|
||||
|
||||
bot.animations.add('run');
|
||||
|
||||
bot.animations.play('run', 15, true);
|
||||
|
||||
game.input.onDown.addOnce(changeMummy, this);
|
||||
|
||||
}
|
||||
|
||||
function changeMummy() {
|
||||
|
||||
bot.loadTexture('mummy', 0);
|
||||
|
||||
bot.animations.add('walk');
|
||||
|
||||
bot.animations.play('walk', 30, true);
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.body(bot);
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.atlas('seacreatures', 'assets/sprites/seacreatures_json.png', 'assets/sprites/seacreatures_json.json');
|
||||
game.load.image('undersea', 'assets/pics/undersea.jpg');
|
||||
game.load.image('coral', 'assets/pics/seabed.png');
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
game.add.sprite(0, 0, 'undersea');
|
||||
|
||||
// Here we create our group and populate it with 6 sprites
|
||||
var group = game.add.group();
|
||||
|
||||
for (var i = 0; i < 6; i++)
|
||||
{
|
||||
// They are evenly spaced out on the X coordinate, with a random Y coordinate
|
||||
sprite = group.create(120 * i, game.rnd.integerInRange(100, 400), 'seacreatures', 'octopus0000');
|
||||
}
|
||||
|
||||
// These are the frame names for the octopus animation. We use the generateFrames function to help create the array.
|
||||
var frameNames = Phaser.Animation.generateFrameNames('octopus', 0, 24, '', 4);
|
||||
|
||||
// Here is the important part. Group.callAll will call a method that exists on every child in the Group.
|
||||
// In this case we're saying: child.animations.add('swim', frameNames, 30, true, false)
|
||||
// The second parameter ('animations') is really important and is the context in which the method is called.
|
||||
// For animations the context is the Phaser.AnimationManager, which is linked to the child.animations property.
|
||||
// Everything after the 2nd parameter is just the usual values you'd pass to the animations.add method.
|
||||
group.callAll('animations.add', 'animations', 'swim', frameNames, 30, true, false);
|
||||
|
||||
// Here we just say 'play the swim animation', this time the 'play' method exists on the child itself, so we can set the context to null.
|
||||
group.callAll('play', null, 'swim');
|
||||
|
||||
game.add.sprite(0, 466, 'coral');
|
||||
|
||||
}
|
|
@ -1,126 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create});
|
||||
|
||||
function preload() {
|
||||
|
||||
// Texture Atlas Method 2
|
||||
//
|
||||
// In this example we assume that the TexturePacker JSON data is a real json object stored as a var
|
||||
// (in this case botData)
|
||||
|
||||
game.load.atlas('bot', 'assets/sprites/running_bot.png', null, botData);
|
||||
|
||||
}
|
||||
|
||||
var bot;
|
||||
|
||||
function create() {
|
||||
|
||||
bot = game.add.sprite(game.world.centerX, 300, 'bot');
|
||||
|
||||
bot.animations.add('run');
|
||||
bot.animations.play('run', 10, true);
|
||||
|
||||
}
|
||||
|
||||
var botData = {
|
||||
"frames": [
|
||||
|
||||
{
|
||||
"filename": "running bot.swf/0000",
|
||||
"frame": { "x": 34, "y": 128, "w": 56, "h": 60 },
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"spriteSourceSize": { "x": 0, "y": 2, "w": 56, "h": 60 },
|
||||
"sourceSize": { "w": 56, "h": 64 }
|
||||
},
|
||||
{
|
||||
"filename": "running bot.swf/0001",
|
||||
"frame": { "x": 54, "y": 0, "w": 56, "h": 58 },
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"spriteSourceSize": { "x": 0, "y": 3, "w": 56, "h": 58 },
|
||||
"sourceSize": { "w": 56, "h": 64 }
|
||||
},
|
||||
{
|
||||
"filename": "running bot.swf/0002",
|
||||
"frame": { "x": 54, "y": 58, "w": 56, "h": 58 },
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"spriteSourceSize": { "x": 0, "y": 3, "w": 56, "h": 58 },
|
||||
"sourceSize": { "w": 56, "h": 64 }
|
||||
},
|
||||
{
|
||||
"filename": "running bot.swf/0003",
|
||||
"frame": { "x": 0, "y": 192, "w": 34, "h": 64 },
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"spriteSourceSize": { "x": 11, "y": 0, "w": 34, "h": 64 },
|
||||
"sourceSize": { "w": 56, "h": 64 }
|
||||
},
|
||||
{
|
||||
"filename": "running bot.swf/0004",
|
||||
"frame": { "x": 0, "y": 64, "w": 54, "h": 64 },
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"spriteSourceSize": { "x": 1, "y": 0, "w": 54, "h": 64 },
|
||||
"sourceSize": { "w": 56, "h": 64 }
|
||||
},
|
||||
{
|
||||
"filename": "running bot.swf/0005",
|
||||
"frame": { "x": 196, "y": 0, "w": 56, "h": 58 },
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"spriteSourceSize": { "x": 0, "y": 3, "w": 56, "h": 58 },
|
||||
"sourceSize": { "w": 56, "h": 64 }
|
||||
},
|
||||
{
|
||||
"filename": "running bot.swf/0006",
|
||||
"frame": { "x": 0, "y": 0, "w": 54, "h": 64 },
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"spriteSourceSize": { "x": 1, "y": 0, "w": 54, "h": 64 },
|
||||
"sourceSize": { "w": 56, "h": 64 }
|
||||
},
|
||||
{
|
||||
"filename": "running bot.swf/0007",
|
||||
"frame": { "x": 140, "y": 0, "w": 56, "h": 58 },
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"spriteSourceSize": { "x": 0, "y": 3, "w": 56, "h": 58 },
|
||||
"sourceSize": { "w": 56, "h": 64 }
|
||||
},
|
||||
{
|
||||
"filename": "running bot.swf/0008",
|
||||
"frame": { "x": 34, "y": 188, "w": 50, "h": 60 },
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"spriteSourceSize": { "x": 3, "y": 2, "w": 50, "h": 60 },
|
||||
"sourceSize": { "w": 56, "h": 64 }
|
||||
},
|
||||
{
|
||||
"filename": "running bot.swf/0009",
|
||||
"frame": { "x": 0, "y": 128, "w": 34, "h": 64 },
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"spriteSourceSize": { "x": 11, "y": 0, "w": 34, "h": 64 },
|
||||
"sourceSize": { "w": 56, "h": 64 }
|
||||
},
|
||||
{
|
||||
"filename": "running bot.swf/0010",
|
||||
"frame": { "x": 84, "y": 188, "w": 56, "h": 58 },
|
||||
"rotated": false,
|
||||
"trimmed": true,
|
||||
"spriteSourceSize": { "x": 0, "y": 3, "w": 56, "h": 58 },
|
||||
"sourceSize": { "w": 56, "h": 64 }
|
||||
}],
|
||||
"meta": {
|
||||
"app": "http://www.texturepacker.com",
|
||||
"version": "1.0",
|
||||
"image": "running_bot.png",
|
||||
"format": "RGBA8888",
|
||||
"size": { "w": 252, "h": 256 },
|
||||
"scale": "0.2",
|
||||
"smartupdate": "$TexturePacker:SmartUpdate:fb56f261b1eb04e3215824426595f64c$"
|
||||
}
|
||||
};
|
|
@ -1,35 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
function preload() {
|
||||
game.load.atlasJSONHash('bot', 'assets/sprites/running_bot.png', 'assets/sprites/running_bot.json');
|
||||
}
|
||||
|
||||
var bot;
|
||||
|
||||
function create() {
|
||||
|
||||
// This sprite is using a texture atlas for all of its animation data
|
||||
bot = game.add.sprite(200, 200, 'bot');
|
||||
|
||||
// Here we add a new animation called 'run'
|
||||
// We haven't specified any frames because it's using every frame in the texture atlas
|
||||
bot.animations.add('run');
|
||||
|
||||
// And this starts the animation playing by using its key ("run")
|
||||
// 15 is the frame rate (15fps)
|
||||
// true means it will loop when it finishes
|
||||
bot.animations.play('run', 15, true);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
bot.x -= 2;
|
||||
|
||||
if (bot.x < -bot.width)
|
||||
{
|
||||
bot.x = game.world.width;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,78 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
|
||||
|
||||
function preload() {
|
||||
|
||||
// Here we load the Starling Texture Atlas and XML file
|
||||
game.load.atlasXML('seacreatures', 'assets/sprites/seacreatures.png', 'assets/sprites/seacreatures.xml');
|
||||
// Here is the exact same set of animations but as a JSON file instead
|
||||
// game.load.atlas('seacreatures', 'assets/sprites/seacreatures_json.png', 'assets/sprites/seacreatures_json.json');
|
||||
|
||||
// Just a few images to use in our underwater scene
|
||||
game.load.image('undersea', 'assets/pics/undersea.jpg');
|
||||
game.load.image('coral', 'assets/pics/seabed.png');
|
||||
|
||||
}
|
||||
|
||||
var jellyfish;
|
||||
var crab;
|
||||
var greenJellyfish;
|
||||
var octopus;
|
||||
var purpleFish;
|
||||
var seahorse;
|
||||
var squid;
|
||||
var stingray;
|
||||
var flyingfish;
|
||||
|
||||
function create() {
|
||||
|
||||
game.add.sprite(0, 0, 'undersea');
|
||||
|
||||
jellyfish = game.add.sprite(670, 20, 'seacreatures');
|
||||
|
||||
// In the texture atlas the jellyfish uses the frame names blueJellyfish0000 to blueJellyfish0032
|
||||
// So we can use the handy generateFrameNames function to create this for us.
|
||||
jellyfish.animations.add('swim', Phaser.Animation.generateFrameNames('blueJellyfish', 0, 32, '', 4), 30, true);
|
||||
jellyfish.animations.play('swim');
|
||||
|
||||
// Let's make some more sea creatures in the same way as the jellyfish
|
||||
|
||||
crab = game.add.sprite(550, 480, 'seacreatures');
|
||||
crab.animations.add('swim', Phaser.Animation.generateFrameNames('crab1', 0, 25, '', 4), 30, true);
|
||||
crab.animations.play('swim');
|
||||
|
||||
greenJellyfish = game.add.sprite(330, 100, 'seacreatures');
|
||||
greenJellyfish.animations.add('swim', Phaser.Animation.generateFrameNames('greenJellyfish', 0, 39, '', 4), 30, true);
|
||||
greenJellyfish.animations.play('swim');
|
||||
|
||||
octopus = game.add.sprite(160, 400, 'seacreatures');
|
||||
octopus.animations.add('swim', Phaser.Animation.generateFrameNames('octopus', 0, 24, '', 4), 30, true);
|
||||
octopus.animations.play('swim');
|
||||
|
||||
purpleFish = game.add.sprite(800, 413, 'seacreatures');
|
||||
purpleFish.animations.add('swim', Phaser.Animation.generateFrameNames('purpleFish', 0, 20, '', 4), 30, true);
|
||||
purpleFish.animations.play('swim');
|
||||
|
||||
seahorse = game.add.sprite(491, 40, 'seacreatures');
|
||||
seahorse.animations.add('swim', Phaser.Animation.generateFrameNames('seahorse', 0, 5, '', 4), 30, true);
|
||||
seahorse.animations.play('swim');
|
||||
|
||||
squid = game.add.sprite(610, 215, 'seacreatures', 'squid0000');
|
||||
|
||||
stingray = game.add.sprite(80, 190, 'seacreatures');
|
||||
stingray.animations.add('swim', Phaser.Animation.generateFrameNames('stingray', 0, 23, '', 4), 30, true);
|
||||
stingray.animations.play('swim');
|
||||
|
||||
flyingfish = game.add.sprite(60, 40, 'seacreatures', 'flyingFish0000');
|
||||
|
||||
|
||||
game.add.sprite(0, 466, 'coral');
|
||||
|
||||
// to: function ( properties, duration, ease, autoStart, delay, repeat, yoyo ) {
|
||||
|
||||
game.add.tween(purpleFish).to({ x: -200 }, 7500, Phaser.Easing.Quadratic.InOut, true, 0, 1000, false);
|
||||
game.add.tween(octopus).to({ y: 530 }, 2000, Phaser.Easing.Quadratic.InOut, true, 0, 1000, true);
|
||||
game.add.tween(greenJellyfish).to({ y: 250 }, 4000, Phaser.Easing.Quadratic.InOut, true, 0, 1000, true);
|
||||
game.add.tween(jellyfish).to({ y: 100 }, 8000, Phaser.Easing.Quadratic.InOut, true, 0, 1000, true);
|
||||
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
|
||||
|
||||
function preload() {
|
||||
|
||||
// 37x45 is the size of each frame
|
||||
|
||||
// There are 18 frames in the PNG - you can leave this value blank if the frames fill up the entire PNG, but in this case there are some
|
||||
// blank frames at the end, so we tell the loader how many to load
|
||||
|
||||
game.load.spritesheet('mummy', 'assets/sprites/metalslug_mummy37x45.png', 37, 45, 18);
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
var mummy = game.add.sprite(300, 200, 'mummy');
|
||||
|
||||
// Here we add a new animation called 'walk'
|
||||
// Because we didn't give any other parameters it's going to make an animation from all available frames in the 'mummy' sprite sheet
|
||||
mummy.animations.add('walk');
|
||||
|
||||
// And this starts the animation playing by using its key ("walk")
|
||||
// 30 is the frame rate (30fps)
|
||||
// true means it will loop when it finishes
|
||||
mummy.animations.play('walk', 20, true);
|
||||
|
||||
}
|
|
@ -1,28 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create });
|
||||
|
||||
function preload() {
|
||||
|
||||
// Here we load the Starling Texture Atlas and XML file
|
||||
game.load.atlasXML('octopus', 'assets/sprites/octopus.png', 'assets/sprites/octopus.xml');
|
||||
|
||||
}
|
||||
|
||||
function create() {
|
||||
|
||||
// A more suitable underwater background color
|
||||
game.stage.backgroundColor = '#1873CE';
|
||||
|
||||
// Create our octopus
|
||||
var octopus = game.add.sprite(300, 200, 'octopus');
|
||||
|
||||
// Create an animation called 'swim', the fact we don't specify any frames means it will use all frames in the atlas
|
||||
octopus.animations.add('swim');
|
||||
|
||||
// Play the animation at 30fps on a loop
|
||||
octopus.animations.play('swim', 30, true);
|
||||
|
||||
// Bob the octopus up and down with a tween
|
||||
game.add.tween(octopus).to({ y: 300 }, 2000, Phaser.Easing.Quadratic.InOut, true, 0, 1000, true);
|
||||
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
game.load.image('arrow', 'assets/sprites/arrow.png');
|
||||
}
|
||||
|
||||
var sprite;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#0072bc';
|
||||
|
||||
sprite = game.add.sprite(400, 300, 'arrow');
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
|
||||
// Enable Arcade Physics for the sprite
|
||||
game.physics.enable(sprite, Phaser.Physics.ARCADE);
|
||||
|
||||
// Tell it we don't want physics to manage the rotation
|
||||
sprite.body.allowRotation = false;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
sprite.rotation = game.physics.arcade.moveToPointer(sprite, 60, game.input.activePointer, 500);
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.spriteInfo(sprite, 32, 32);
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('arrow', 'assets/sprites/longarrow.png');
|
||||
game.load.image('ball', 'assets/sprites/pangball.png');
|
||||
|
||||
}
|
||||
|
||||
var arrow;
|
||||
var target;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#0072bc';
|
||||
|
||||
arrow = game.add.sprite(200, 250, 'arrow');
|
||||
arrow.anchor.setTo(0.1, 0.5);
|
||||
|
||||
target = game.add.sprite(600, 400, 'ball');
|
||||
target.anchor.setTo(0.5, 0.5);
|
||||
target.inputEnabled = true;
|
||||
target.input.enableDrag(true);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
arrow.rotation = game.physics.arcade.angleBetween(arrow, target);
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.text("Drag the ball", 32, 32);
|
||||
game.debug.spriteInfo(arrow, 32, 100);
|
||||
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
game.load.image('arrow', 'assets/sprites/arrow.png');
|
||||
}
|
||||
|
||||
var sprite;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#0072bc';
|
||||
|
||||
sprite = game.add.sprite(400, 300, 'arrow');
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
// This will update the sprite.rotation so that it points to the currently active pointer
|
||||
// On a Desktop that is the mouse, on mobile the most recent finger press.
|
||||
sprite.rotation = game.physics.arcade.angleToPointer(sprite);
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.spriteInfo(sprite, 32, 32);
|
||||
|
||||
}
|
52
examples/arcade physics/angular acceleration.js
vendored
|
@ -1,52 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
game.load.image('arrow', 'assets/sprites/arrow.png');
|
||||
}
|
||||
|
||||
var sprite;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#0072bc';
|
||||
|
||||
sprite = game.add.sprite(400, 300, 'arrow');
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
|
||||
game.physics.enable(sprite, Phaser.Physics.ARCADE);
|
||||
|
||||
// We'll set a lower max angular velocity here to keep it from going totally nuts
|
||||
sprite.body.maxAngular = 500;
|
||||
|
||||
// Apply a drag otherwise the sprite will just spin and never slow down
|
||||
sprite.body.angularDrag = 50;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
// Reset the acceleration
|
||||
sprite.body.angularAcceleration = 0;
|
||||
|
||||
// Apply acceleration if the left/right arrow keys are held down
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
|
||||
{
|
||||
sprite.body.angularAcceleration -= 200;
|
||||
}
|
||||
else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
|
||||
{
|
||||
sprite.body.angularAcceleration += 200;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.spriteInfo(sprite, 32, 32);
|
||||
game.debug.text('angularVelocity: ' + sprite.body.angularVelocity, 32, 200);
|
||||
game.debug.text('angularAcceleration: ' + sprite.body.angularAcceleration, 32, 232);
|
||||
game.debug.text('angularDrag: ' + sprite.body.angularDrag, 32, 264);
|
||||
game.debug.text('deltaZ: ' + sprite.body.deltaZ(), 32, 296);
|
||||
|
||||
}
|
50
examples/arcade physics/angular velocity.js
vendored
|
@ -1,50 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
game.load.image('arrow', 'assets/sprites/arrow.png');
|
||||
}
|
||||
|
||||
var sprite;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#0072bc';
|
||||
|
||||
sprite = game.add.sprite(400, 300, 'arrow');
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
game.physics.enable(sprite, Phaser.Physics.ARCADE);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
sprite.body.velocity.x = 0;
|
||||
sprite.body.velocity.y = 0;
|
||||
sprite.body.angularVelocity = 0;
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
|
||||
{
|
||||
sprite.body.angularVelocity = -200;
|
||||
}
|
||||
else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
|
||||
{
|
||||
sprite.body.angularVelocity = 200;
|
||||
}
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.UP))
|
||||
{
|
||||
game.physics.arcade.velocityFromAngle(sprite.angle, 300, sprite.body.velocity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.spriteInfo(sprite, 32, 32);
|
||||
game.debug.text('angularVelocity: ' + sprite.body.angularVelocity, 32, 200);
|
||||
game.debug.text('angularAcceleration: ' + sprite.body.angularAcceleration, 32, 232);
|
||||
game.debug.text('angularDrag: ' + sprite.body.angularDrag, 32, 264);
|
||||
game.debug.text('deltaZ: ' + sprite.body.deltaZ(), 32, 296);
|
||||
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.spritesheet('gameboy', 'assets/sprites/gameboy_seize_color_40x60.png', 40, 60);
|
||||
|
||||
}
|
||||
|
||||
var sprite;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#124184';
|
||||
|
||||
// Here we're tweening the scale of the sprite, which translates to the scale of the Body as well
|
||||
// The collision will carry on working even against the scaled body.
|
||||
|
||||
sprite = game.add.sprite(200, 300, 'gameboy', 2);
|
||||
sprite.name = 'green';
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
|
||||
game.physics.enable(sprite, Phaser.Physics.ARCADE);
|
||||
sprite.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(600, 270, 'gameboy', 3);
|
||||
sprite2.name = 'yellow';
|
||||
game.physics.enable(sprite2, Phaser.Physics.ARCADE);
|
||||
sprite2.body.rebound = false;
|
||||
|
||||
game.add.tween(sprite.scale).to( { x: 3, y: 3 }, 2000, Phaser.Easing.Linear.None, true, 0, 1000, true);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
sprite2.body.velocity.x = -200;
|
||||
|
||||
game.physics.arcade.collide(sprite, sprite2);
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
// game.debug.physicsBody(sprite.body);
|
||||
// game.debug.physicsBody(sprite2.body);
|
||||
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
// mods by Patrick OReilly
|
||||
// Twitter: @pato_reilly Web: http://patricko.byethost9.com
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.spritesheet('dude', 'assets/games/starstruck/dude.png', 32, 48);
|
||||
|
||||
}
|
||||
|
||||
var flyer;
|
||||
|
||||
function create() {
|
||||
|
||||
cursors = game.input.keyboard.createCursorKeys();
|
||||
|
||||
flyer = game.add.sprite(400, 200, 'dude');
|
||||
|
||||
flyer.animations.add('left', [0, 1, 2, 3], 10, true);
|
||||
flyer.animations.add('right', [5, 6, 7, 8], 10, true);
|
||||
|
||||
game.physics.enable(flyer, Phaser.Physics.ARCADE);
|
||||
|
||||
// This gets it moving
|
||||
flyer.body.velocity.setTo(200, 200);
|
||||
|
||||
// This makes the game world bounce-able
|
||||
flyer.body.collideWorldBounds = true;
|
||||
|
||||
// This sets the image bounce energy for the horizontal
|
||||
// and vertical vectors (as an x,y point). "1" is 100% energy return
|
||||
flyer.body.bounce.setTo(0.8, 0.8);
|
||||
|
||||
// gravityScale is a value between 0 and n, so if world gravity is 10 and gravityScale is 1,
|
||||
// then the body will have 10 gravity applied to it
|
||||
flyer.body.gravityScale.setTo(0, 6);
|
||||
|
||||
}
|
||||
|
||||
// Change the vertical and horizontal acceleration property accordingly with the key pressed
|
||||
// Also turn on and off the animation. Dude should have wings ;)
|
||||
|
||||
function update () {
|
||||
|
||||
if (cursors.up.isDown)
|
||||
{
|
||||
flyer.body.acceleration.y = -600;
|
||||
|
||||
if (flyer.body.velocity.x > 0)
|
||||
{
|
||||
flyer.animations.play('right');
|
||||
}
|
||||
else
|
||||
{
|
||||
flyer.animations.play('left');
|
||||
}
|
||||
}
|
||||
else if (cursors.down.isDown)
|
||||
{
|
||||
flyer.body.acceleration.y = 600;
|
||||
|
||||
if (flyer.body.velocity.x > 0)
|
||||
{
|
||||
flyer.animations.play('right');
|
||||
}
|
||||
else
|
||||
{
|
||||
flyer.animations.play('left');
|
||||
}
|
||||
}
|
||||
else if (cursors.left.isDown)
|
||||
{
|
||||
flyer.body.acceleration.x = -500;
|
||||
flyer.animations.play('left');
|
||||
}
|
||||
else if (cursors.right.isDown)
|
||||
{
|
||||
flyer.body.acceleration.x = 500;
|
||||
flyer.animations.play('right');
|
||||
}
|
||||
else
|
||||
{
|
||||
flyer.frame = 4;
|
||||
flyer.body.acceleration.setTo(0,0);
|
||||
flyer.animations.stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render () {
|
||||
|
||||
//debug helper
|
||||
game.debug.spriteInfo(flyer,32,32);
|
||||
|
||||
}
|
|
@ -1,76 +0,0 @@
|
|||
// mods by Patrick OReilly
|
||||
// Twitter: @pato_reilly Web: http://patricko.byethost9.com
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('dude', 'assets/sprites/phaser-dude.png');
|
||||
game.load.image('ball', 'assets/sprites/pangball.png');
|
||||
|
||||
}
|
||||
|
||||
var image;
|
||||
|
||||
function create() {
|
||||
|
||||
cursors = game.input.keyboard.createCursorKeys();
|
||||
|
||||
// This creates a simple sprite that is using our loaded image and
|
||||
// displays it on-screen
|
||||
// and assign it to a variable
|
||||
ball = game.add.sprite(400, 200, 'ball');
|
||||
|
||||
knocker = game.add.sprite(400, 200, 'dude');
|
||||
|
||||
game.physics.enable([knocker,ball], Phaser.Physics.ARCADE);
|
||||
knocker.body.immovable = true;
|
||||
|
||||
// This gets it moving
|
||||
ball.body.velocity.setTo(200, 200);
|
||||
|
||||
// This makes the game world bounce-able
|
||||
ball.body.collideWorldBounds = true;
|
||||
|
||||
// This sets the image bounce energy for the horizontal
|
||||
// and vertical vectors (as an x,y point). "1" is 100% energy return
|
||||
ball.body.bounce.setTo(1, 1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Move the knocker with the arrow keys
|
||||
function update () {
|
||||
|
||||
// Enable physics between the knocker and the ball
|
||||
game.physics.arcade.collide(knocker, ball);
|
||||
|
||||
if (cursors.up.isDown)
|
||||
{
|
||||
knocker.body.velocity.y = -300;
|
||||
}
|
||||
else if (cursors.down.isDown)
|
||||
{
|
||||
knocker.body.velocity.y = 300;
|
||||
}
|
||||
else if (cursors.left.isDown)
|
||||
{
|
||||
knocker.body.velocity.x = -300;
|
||||
}
|
||||
else if (cursors.right.isDown)
|
||||
{
|
||||
knocker.body.velocity.x = 300;
|
||||
}
|
||||
else
|
||||
{
|
||||
knocker.body.velocity.setTo(0, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render () {
|
||||
|
||||
//debug helper
|
||||
game.debug.spriteInfo(ball, 32, 32);
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
// mods by Patrick OReilly
|
||||
// Twitter: @pato_reilly Web: http://patricko.byethost9.com
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
// You can fill the preloader with as many assets as your game requires
|
||||
|
||||
// Here we are loading an image. The first parameter is the unique
|
||||
// string by which we'll identify the image later in our code.
|
||||
|
||||
// The second parameter is the URL of the image (relative)
|
||||
game.load.image('flyer', 'assets/sprites/phaser-dude.png');
|
||||
}
|
||||
|
||||
var image;
|
||||
|
||||
function create() {
|
||||
|
||||
// This creates a simple sprite that is using our loaded image and displays it on-screen and assign it to a variable
|
||||
image = game.add.sprite(400, 200, 'flyer');
|
||||
|
||||
game.physics.enable(image, Phaser.Physics.ARCADE);
|
||||
|
||||
// This gets it moving
|
||||
image.body.velocity.setTo(200, 200);
|
||||
|
||||
// This makes the game world bounce-able
|
||||
image.body.collideWorldBounds = true;
|
||||
|
||||
// This sets the image bounce energy for the horizontal and vertical vectors (as an x,y point). "1" is 100% energy return
|
||||
image.body.bounce.setTo(0.8, 0.8);
|
||||
|
||||
|
||||
image.body.gravityScale.setTo(0, 18);
|
||||
|
||||
}
|
||||
|
||||
function update () {
|
||||
|
||||
// nothing required here
|
||||
|
||||
}
|
||||
|
||||
function render () {
|
||||
|
||||
//debug helper
|
||||
game.debug.spriteInfo(image,32,32);
|
||||
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
// mods by Patrick OReilly
|
||||
// Twitter: @pato_reilly Web: http://patricko.byethost9.com
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
// You can fill the preloader with as many assets as your game requires
|
||||
|
||||
// Here we are loading an image. The first parameter is the unique
|
||||
// string by which we'll identify the image later in our code.
|
||||
|
||||
// The second parameter is the URL of the image (relative)
|
||||
game.load.image('flyer', 'assets/sprites/phaser-dude.png');
|
||||
}
|
||||
|
||||
var image;
|
||||
|
||||
function create() {
|
||||
|
||||
// This creates a simple sprite that is using our loaded image and
|
||||
// displays it on-screen
|
||||
// and assign it to a variable
|
||||
image = game.add.sprite(0, 0, 'flyer');
|
||||
|
||||
game.physics.enable(image, Phaser.Physics.ARCADE);
|
||||
|
||||
// This gets it moving
|
||||
image.body.velocity.setTo(200,200);
|
||||
|
||||
// This makes the game world bounce-able
|
||||
image.body.collideWorldBounds = true;
|
||||
|
||||
// This sets the image bounce energy for the horizontal
|
||||
// and vertical vectors. "1" is 100% energy return
|
||||
image.body.bounce.setTo(1,1);
|
||||
|
||||
}
|
||||
|
||||
function update () {
|
||||
|
||||
//nothing required here
|
||||
|
||||
}
|
||||
|
||||
function render () {
|
||||
//debug helper
|
||||
game.debug.spriteInfo(image,32,32);
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('atari', 'assets/sprites/atari130xe.png');
|
||||
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
sprite1 = game.add.sprite(150, 300, 'atari');
|
||||
sprite1.name = 'atari';
|
||||
game.physics.enable(sprite1, Phaser.Physics.ARCADE);
|
||||
|
||||
// Here you can visually see the two bounding boxes the sprites are using for collision.
|
||||
|
||||
sprite1.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(700, 320, 'mushroom');
|
||||
sprite2.name = 'mushroom';
|
||||
game.physics.enable(sprite2, Phaser.Physics.ARCADE);
|
||||
sprite2.body.velocity.x = -100;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.arcade.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
|
||||
function collisionHandler (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
// game.debug.bodyInfo(sprite1, 32, 32);
|
||||
|
||||
// game.debug.spriteBounds(sprite1);
|
||||
// game.debug.spriteBounds(sprite2);
|
||||
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('ilkke', 'assets/sprites/ilkke.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
var sprite3;
|
||||
var sprite4;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
// Set the world (global) gravity
|
||||
game.physics.arcade.gravity.y = 100;
|
||||
|
||||
// Sprite 1 will use the World (global) gravity
|
||||
sprite1 = game.add.sprite(100, 96, 'ilkke');
|
||||
|
||||
// Sprite 2 is set to ignore the global gravity and use its own value
|
||||
sprite2 = game.add.sprite(300, 96, 'ilkke');
|
||||
|
||||
// Sprite 3 will use both the world gravity and its own gravityScale modifier
|
||||
sprite3 = game.add.sprite(500, 96, 'ilkke');
|
||||
|
||||
// Sprite 4 will ignore all gravity
|
||||
sprite4 = game.add.sprite(700, 96, 'ilkke');
|
||||
|
||||
// Enable physics on those sprites
|
||||
game.physics.enable( [ sprite1, sprite2, sprite3, sprite4 ], Phaser.Physics.ARCADE);
|
||||
|
||||
sprite1.body.collideWorldBounds = true;
|
||||
sprite1.body.bounce.y = 0.8;
|
||||
|
||||
sprite2.body.collideWorldBounds = true;
|
||||
sprite2.body.bounce.y = 0.8;
|
||||
sprite2.body.gravity.y = 200;
|
||||
|
||||
sprite3.body.collideWorldBounds = true;
|
||||
sprite3.body.bounce.y = 0.8;
|
||||
sprite3.body.gravityScale.y = 3;
|
||||
|
||||
sprite4.body.allowGravity = false;
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.text('world gravity', sprite1.x - 32, 64);
|
||||
game.debug.text('local gravity', sprite2.x - 32, 64);
|
||||
game.debug.text('gravityScale', sprite3.x - 32, 64);
|
||||
game.debug.text('no gravity', sprite4.x - 32, 64);
|
||||
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('phaser', 'assets/sprites/phaser-dude.png');
|
||||
game.load.image('bullet', 'assets/misc/bullet0.png');
|
||||
game.load.spritesheet('veggies', 'assets/sprites/fruitnveg32wh37.png', 32, 32);
|
||||
|
||||
}
|
||||
|
||||
var sprite;
|
||||
var bullets;
|
||||
var veggies;
|
||||
var cursors;
|
||||
|
||||
var bulletTime = 0;
|
||||
var bullet;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
// This will check Group vs. Group collision (bullets vs. veggies!)
|
||||
|
||||
veggies = game.add.group();
|
||||
veggies.enableBody = true;
|
||||
veggies.physicsBodyType = Phaser.Physics.ARCADE;
|
||||
|
||||
for (var i = 0; i < 50; i++)
|
||||
{
|
||||
var c = veggies.create(game.world.randomX, Math.random() * 500, 'veggies', game.rnd.integerInRange(0, 36));
|
||||
c.name = 'veg' + i;
|
||||
c.body.immovable = true;
|
||||
}
|
||||
|
||||
bullets = game.add.group();
|
||||
bullets.enableBody = true;
|
||||
bullets.physicsBodyType = Phaser.Physics.ARCADE;
|
||||
|
||||
for (var i = 0; i < 20; i++)
|
||||
{
|
||||
var b = bullets.create(0, 0, 'bullet');
|
||||
b.name = 'bullet' + i;
|
||||
b.exists = false;
|
||||
b.visible = false;
|
||||
b.checkWorldBounds = true;
|
||||
b.events.onOutOfBounds.add(resetBullet, this);
|
||||
}
|
||||
|
||||
sprite = game.add.sprite(400, 550, 'phaser');
|
||||
game.physics.enable(sprite, Phaser.Physics.ARCADE);
|
||||
|
||||
cursors = game.input.keyboard.createCursorKeys();
|
||||
game.input.keyboard.addKeyCapture([ Phaser.Keyboard.SPACEBAR ]);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
// As we don't need to exchange any velocities or motion we can the 'overlap' check instead of 'collide'
|
||||
game.physics.arcade.overlap(bullets, veggies, collisionHandler, null, this);
|
||||
|
||||
sprite.body.velocity.x = 0;
|
||||
sprite.body.velocity.y = 0;
|
||||
|
||||
if (cursors.left.isDown)
|
||||
{
|
||||
sprite.body.velocity.x = -300;
|
||||
}
|
||||
else if (cursors.right.isDown)
|
||||
{
|
||||
sprite.body.velocity.x = 300;
|
||||
}
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR))
|
||||
{
|
||||
fireBullet();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function fireBullet () {
|
||||
|
||||
if (game.time.now > bulletTime)
|
||||
{
|
||||
bullet = bullets.getFirstExists(false);
|
||||
|
||||
if (bullet)
|
||||
{
|
||||
bullet.reset(sprite.x + 6, sprite.y - 8);
|
||||
bullet.body.velocity.y = -300;
|
||||
bulletTime = game.time.now + 150;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Called if the bullet goes out of the screen
|
||||
function resetBullet (bullet) {
|
||||
|
||||
bullet.kill();
|
||||
|
||||
}
|
||||
|
||||
// Called if the bullet hits one of the veg sprites
|
||||
function collisionHandler (bullet, veg) {
|
||||
|
||||
bullet.kill();
|
||||
veg.kill();
|
||||
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.spritesheet('spinner', 'assets/sprites/bluemetal_32x32x4.png', 32, 32);
|
||||
|
||||
}
|
||||
|
||||
var sprites;
|
||||
|
||||
function create() {
|
||||
|
||||
// Here we create a group, populate it with sprites, give them all a random velocity
|
||||
// and then check the group against itself for collision
|
||||
|
||||
sprites = game.add.group();
|
||||
|
||||
for (var i = 0; i < 30; i++)
|
||||
{
|
||||
var s = sprites.create(game.rnd.integerInRange(100, 700), game.rnd.integerInRange(32, 200), 'spinner');
|
||||
s.animations.add('spin', [0,1,2,3]);
|
||||
s.play('spin', 20, true);
|
||||
game.physics.enable(s, Phaser.Physics.ARCADE);
|
||||
s.body.velocity.x = game.rnd.integerInRange(-200, 200);
|
||||
s.body.velocity.y = game.rnd.integerInRange(-200, 200);
|
||||
}
|
||||
|
||||
sprites.setAll('body.collideWorldBounds', true);
|
||||
sprites.setAll('body.bounce.x', 1);
|
||||
sprites.setAll('body.bounce.y', 1);
|
||||
sprites.setAll('body.minBounceVelocity', 0);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.arcade.collide(sprites);
|
||||
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('atari', 'assets/sprites/atari130xe.png');
|
||||
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
sprite1 = game.add.sprite(130, 200, 'atari');
|
||||
sprite1.name = 'atari';
|
||||
|
||||
game.physics.enable(sprite1, Phaser.Physics.ARCADE);
|
||||
// In this example the new collision box is much larger than the original sprite
|
||||
sprite1.body.setSize(400, 50, -100, 20);
|
||||
sprite1.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(700, 210, 'mushroom');
|
||||
sprite2.name = 'mushroom';
|
||||
game.physics.enable(sprite2, Phaser.Physics.ARCADE);
|
||||
sprite2.body.velocity.x = -100;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.arcade.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
|
||||
function collisionHandler (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
// game.debug.bodyInfo(sprite1, 32, 32);
|
||||
|
||||
// game.debug.physicsBody(sprite1.body);
|
||||
// game.debug.physicsBody(sprite2.body);
|
||||
|
||||
}
|
|
@ -1,152 +0,0 @@
|
|||
// mods by Patrick OReilly
|
||||
// twitter: @pato_reilly
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('background','assets/misc/starfield.jpg');
|
||||
game.load.image('player','assets/sprites/phaser-dude.png');
|
||||
game.load.image('analog', 'assets/tests/fusia.png');
|
||||
game.load.image('arrow', 'assets/sprites/longarrow2.png');
|
||||
}
|
||||
|
||||
var myTween;
|
||||
var player;
|
||||
var cursors;
|
||||
var arrow;
|
||||
var catchFlag = false;
|
||||
var launchVelocity = 0;
|
||||
var launched;
|
||||
|
||||
function create() {
|
||||
|
||||
game.world.setBounds(0, 0, 5000, 600);
|
||||
game.add.tileSprite(0, 0, 5000, 600, 'background');
|
||||
|
||||
var graphics = game.add.graphics(0,0);
|
||||
graphics.beginFill(0x049e0c);
|
||||
graphics.drawRect(395, 400, 10, 250);
|
||||
|
||||
analog = game.add.sprite(400, 400, 'analog');
|
||||
analog.width = 8;
|
||||
analog.rotation = 220;
|
||||
analog.alpha = 0;
|
||||
analog.anchor.setTo(0.5, 0.0);
|
||||
|
||||
arrow = game.add.sprite(400, 400, 'arrow');
|
||||
arrow.anchor.setTo(0.1, 0.5);
|
||||
arrow.alpha = 0;
|
||||
|
||||
player = game.add.sprite(150, 320, 'player');
|
||||
player.anchor.setTo(0.5, 0.5);
|
||||
|
||||
game.physics.enable(player, Phaser.Physics.ARCADE);
|
||||
|
||||
player.body.collideWorldBounds = true;
|
||||
player.body.bounce.setTo(0.9, 0.9);
|
||||
player.body.linearDamping = 0.2;
|
||||
player.body.gravityScale.setTo(0, 0.8);
|
||||
|
||||
// Enable input.
|
||||
player.inputEnabled = true;
|
||||
player.input.start(0, true);
|
||||
player.events.onInputDown.add(set);
|
||||
player.events.onInputUp.add(launch);
|
||||
//player.events.onInputOut.add(launch);
|
||||
|
||||
// this tween is to make the camera return to left side of world when done launching
|
||||
// so it is not used until then
|
||||
myTween = game.add.tween(player).to({x: 150}, 5000, Phaser.Easing.Linear.None);
|
||||
myTween.onComplete.add(reappear, this);
|
||||
game.camera.follow(player, Phaser.Camera.FOLLOW_TOPDOWN);
|
||||
}
|
||||
|
||||
function reappear() {
|
||||
|
||||
launched = false;
|
||||
player.alpha = 1;
|
||||
}
|
||||
|
||||
function set(player,pointer) {
|
||||
|
||||
//disallow launching until reset
|
||||
if (!launched)
|
||||
{
|
||||
catchFlag = true;
|
||||
game.camera.follow(null);
|
||||
player.body.gravity.setTo(0,0);
|
||||
player.body.velocity.setTo(0,0);
|
||||
}
|
||||
}
|
||||
|
||||
function launch() {
|
||||
|
||||
if (catchFlag)
|
||||
{
|
||||
catchFlag = false;
|
||||
launched = true;
|
||||
game.camera.follow(player, Phaser.Camera.FOLLOW_TOPDOWN);
|
||||
|
||||
arrow.alpha = 0;
|
||||
analog.alpha = 0;
|
||||
Xvector = (arrow.x - player.x)*3.8;
|
||||
Yvector = (arrow.y - player.y)*3.8;
|
||||
player.body.gravity.setTo(0,8);
|
||||
player.body.velocity.setTo(Xvector,Yvector);
|
||||
}
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
arrow.rotation = game.physics.arcade.angleBetween(arrow, player);
|
||||
|
||||
// Track the player sprite to the mouse
|
||||
if (catchFlag)
|
||||
{
|
||||
distance = game.physics.arcade.distanceToPointer(arrow);
|
||||
theta = game.physics.arcade.angleToPointer(arrow);
|
||||
|
||||
// Govern the distance the sprite is dragged away from launch post
|
||||
if (distance > 300)
|
||||
{
|
||||
distance = 300;
|
||||
adjacentX = Math.cos(theta) * distance;
|
||||
oppositeY = Math.sin(theta) * distance;
|
||||
player.x = 400 + adjacentX;
|
||||
player.y = 400 + oppositeY;
|
||||
analog.height = distance;
|
||||
}
|
||||
else
|
||||
{
|
||||
player.x = game.input.activePointer.worldX;
|
||||
player.y = game.input.activePointer.worldY;
|
||||
analog.height = distance;
|
||||
}
|
||||
|
||||
arrow.alpha = 1;
|
||||
analog.alpha = 0.5;
|
||||
analog.rotation = arrow.rotation - Math.PI/2;
|
||||
launchVelocity = analog.height;
|
||||
}
|
||||
|
||||
//check sprite motion and if done, return camera to left side of world
|
||||
var tweening = myTween.isRunning;
|
||||
|
||||
if (!tweening && launched && (player.x >= game.world.width-20 || player.body.deltaX() == 0))
|
||||
{
|
||||
player.body.velocity.setTo(0, 0);
|
||||
player.alpha = 0;
|
||||
myTween.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.text("Drag the sprite and release to launch", 32, 32, 'rgb(0,255,0)');
|
||||
game.debug.cameraInfo(game.camera, 32, 64);
|
||||
game.debug.spriteCoords(player, 32, 150);
|
||||
game.debug.text("Launch Velocity: " + parseInt(launchVelocity), 550, 32, 'rgb(0,255,0)');
|
||||
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
// mods by Patrick OReilly
|
||||
// twitter: @pato_reilly
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('background','assets/misc/starfield.jpg');
|
||||
game.load.image('player','assets/sprites/phaser-dude.png');
|
||||
game.load.image('analog', 'assets/tests/fusia.png');
|
||||
game.load.image('arrow', 'assets/sprites/longarrow2.png');
|
||||
|
||||
}
|
||||
|
||||
var player;
|
||||
var cursors;
|
||||
var arrow;
|
||||
var catchFlag = false;
|
||||
var launchVelocity = 0;
|
||||
|
||||
function create() {
|
||||
|
||||
game.world.setBounds(0, 0, 3400, 1000);
|
||||
game.add.tileSprite(0, 0, 3400, 1000, 'background');
|
||||
|
||||
analog = game.add.sprite(200, 450, 'analog');
|
||||
analog.width = 8;
|
||||
analog.rotation = 220;
|
||||
analog.alpha = 0;
|
||||
analog.anchor.setTo(0.5, 0.0);
|
||||
|
||||
arrow = game.add.sprite(200, 450, 'arrow');
|
||||
arrow.anchor.setTo(0.1, 0.5);
|
||||
arrow.alpha = 0;
|
||||
|
||||
player = game.add.sprite(150, 320, 'player');
|
||||
|
||||
game.physics.enable([player], Phaser.Physics.ARCADE);
|
||||
|
||||
player.anchor.setTo(0.5, 0.5);
|
||||
player.body.collideWorldBounds = true;
|
||||
player.body.bounce.setTo(0.9, 0.9);
|
||||
player.body.linearDamping = 0.2;
|
||||
|
||||
// Enable input.
|
||||
player.inputEnabled = true;
|
||||
player.input.start(0, true);
|
||||
player.events.onInputDown.add(set);
|
||||
player.events.onInputUp.add(launch);
|
||||
|
||||
game.camera.follow(player, Phaser.Camera.FOLLOW_TOPDOWN);
|
||||
|
||||
}
|
||||
|
||||
function set(player,pointer) {
|
||||
|
||||
catchFlag = true;
|
||||
game.camera.follow(null);
|
||||
|
||||
player.body.velocity.setTo(0, 0);
|
||||
arrow.reset(player.x, player.y);
|
||||
analog.reset(player.x, player.y);
|
||||
|
||||
}
|
||||
|
||||
function launch() {
|
||||
|
||||
catchFlag = false;
|
||||
game.camera.follow(player, Phaser.Camera.FOLLOW_TOPDOWN);
|
||||
|
||||
arrow.alpha = 0;
|
||||
analog.alpha = 0;
|
||||
Xvector = (arrow.x - player.x) * 4.1;
|
||||
Yvector = (arrow.y - player.y) * 4.1;
|
||||
player.body.velocity.setTo(Xvector,Yvector);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
arrow.rotation = game.physics.arcade.angleBetween(arrow, player);
|
||||
|
||||
if (catchFlag == true)
|
||||
{
|
||||
// Track the ball sprite to the mouse
|
||||
player.x = game.input.activePointer.worldX;
|
||||
player.y = game.input.activePointer.worldY;
|
||||
|
||||
arrow.alpha = 1;
|
||||
analog.alpha = 0.5;
|
||||
analog.rotation = arrow.rotation - 3.14 / 2;
|
||||
analog.height = game.physics.arcade.distanceBetween(arrow, player);
|
||||
launchVelocity = analog.height;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.text("Drag the sprite and release to launch", 32, 32, 'rgb(0,255,0)');
|
||||
game.debug.cameraInfo(game.camera, 32, 64);
|
||||
game.debug.spriteCoords(player, 32, 150);
|
||||
game.debug.text("Launch Velocity: " + parseInt(launchVelocity), 550, 32, 'rgb(0,255,0)');
|
||||
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
// mods by Patrick OReilly
|
||||
// twitter: @pato_reilly
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('analog', 'assets/tests/fusia.png');
|
||||
game.load.image('arrow', 'assets/sprites/longarrow2.png');
|
||||
game.load.image('ball', 'assets/sprites/pangball.png');
|
||||
|
||||
}
|
||||
|
||||
var arrow;
|
||||
var ball;
|
||||
var catchFlag = false;
|
||||
var launchVelocity = 0;
|
||||
|
||||
function create() {
|
||||
|
||||
// set global gravity
|
||||
game.physics.arcade.gravity.y = 200;
|
||||
game.stage.backgroundColor = '#0072bc';
|
||||
|
||||
var graphics = game.add.graphics(0,0);
|
||||
graphics.beginFill(0x049e0c);
|
||||
graphics.drawRect(395, 350, 10, 250);
|
||||
|
||||
analog = game.add.sprite(400, 350, 'analog');
|
||||
|
||||
game.physics.enable(analog, Phaser.Physics.ARCADE);
|
||||
|
||||
analog.body.allowGravity = false;
|
||||
analog.width = 8;
|
||||
analog.rotation = 220;
|
||||
analog.alpha = 0;
|
||||
analog.anchor.setTo(0.5, 0.0);
|
||||
|
||||
arrow = game.add.sprite(400, 350, 'arrow');
|
||||
|
||||
game.physics.enable(arrow, Phaser.Physics.ARCADE);
|
||||
arrow.anchor.setTo(0.1, 0.5);
|
||||
arrow.body.allowGravity = false;
|
||||
arrow.alpha = 0;
|
||||
|
||||
ball = game.add.sprite(100, 400, 'ball');
|
||||
game.physics.enable(ball, Phaser.Physics.ARCADE);
|
||||
ball.anchor.setTo(0.5, 0.5);
|
||||
ball.body.collideWorldBounds = true;
|
||||
ball.body.bounce.setTo(0.9, 0.9);
|
||||
|
||||
// Enable input.
|
||||
ball.inputEnabled = true;
|
||||
ball.input.start(0, true);
|
||||
ball.events.onInputDown.add(set);
|
||||
ball.events.onInputUp.add(launch);
|
||||
|
||||
}
|
||||
|
||||
function set(ball, pointer) {
|
||||
|
||||
ball.body.velocity.setTo(0, 0);
|
||||
ball.body.allowGravity = false;
|
||||
catchFlag = true;
|
||||
|
||||
}
|
||||
|
||||
function launch() {
|
||||
|
||||
catchFlag = false;
|
||||
|
||||
arrow.alpha = 0;
|
||||
analog.alpha = 0;
|
||||
Xvector = (arrow.x - ball.x) * 3;
|
||||
Yvector = (arrow.y - ball.y) * 3;
|
||||
ball.body.allowGravity = true;
|
||||
ball.body.velocity.setTo(Xvector, Yvector);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
arrow.rotation = game.physics.arcade.angleBetween(arrow, ball);
|
||||
|
||||
if (catchFlag == true)
|
||||
{
|
||||
// Track the ball sprite to the mouse
|
||||
ball.x = game.input.activePointer.worldX;
|
||||
ball.y = game.input.activePointer.worldY;
|
||||
|
||||
arrow.alpha = 1;
|
||||
analog.alpha = 0.5;
|
||||
analog.rotation = arrow.rotation - 3.14 / 2;
|
||||
analog.height = game.physics.arcade.distanceToPointer(arrow);
|
||||
launchVelocity = analog.height;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.text("Drag the ball and release to launch", 32, 32);
|
||||
|
||||
game.debug.bodyInfo(ball, 32, 64);
|
||||
|
||||
// game.debug.spriteInfo(ball, 32, 64);
|
||||
// game.debug.text("Launch Velocity: " + parseInt(launchVelocity), 32, 250);
|
||||
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('car', 'assets/sprites/car90.png');
|
||||
game.load.image('baddie', 'assets/sprites/space-baddie.png');
|
||||
|
||||
}
|
||||
|
||||
var car;
|
||||
var aliens;
|
||||
|
||||
function create() {
|
||||
|
||||
aliens = game.add.group();
|
||||
|
||||
game.physics.arcade.gravity.y = 100;
|
||||
|
||||
for (var i = 0; i < 50; i++)
|
||||
{
|
||||
var s = aliens.create(game.world.randomX, game.world.randomY, 'baddie');
|
||||
game.physics.enable(s, Phaser.Physics.ARCADE);
|
||||
s.name = 'alien' + s;
|
||||
s.body.collideWorldBounds = true;
|
||||
s.body.bounce.setTo(0.8, 0.8);
|
||||
s.body.linearDamping = 0;
|
||||
s.body.velocity.setTo(10 + Math.random() * 40, 10 + Math.random() * 40);
|
||||
}
|
||||
|
||||
car = game.add.sprite(400, 300, 'car');
|
||||
car.name = 'car';
|
||||
car.anchor.setTo(0.5, 0.5);
|
||||
game.physics.enable(car, Phaser.Physics.ARCADE);
|
||||
car.body.collideWorldBounds = true;
|
||||
// car.body.bounce.setTo(0.8, 0.8);
|
||||
car.body.allowRotation = true;
|
||||
// car.body.immovable = true;
|
||||
// car.body.minBounceVelocity = 0;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.arcade.collide(car, aliens);
|
||||
|
||||
car.body.velocity.x = 0;
|
||||
car.body.velocity.y = 0;
|
||||
car.body.angularVelocity = 0;
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
|
||||
{
|
||||
car.body.angularVelocity = -200;
|
||||
}
|
||||
else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
|
||||
{
|
||||
car.body.angularVelocity = 200;
|
||||
}
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.UP))
|
||||
{
|
||||
car.body.velocity.copyFrom(game.physics.arcade.velocityFromAngle(car.angle, 300));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
// for (var i = 0; i < aliens._container.children.length; i++)
|
||||
// {
|
||||
// game.debug.polygon(aliens._container.children[i].body.polygons);
|
||||
// }
|
||||
|
||||
// game.debug.polygon(car.body.polygons);
|
||||
|
||||
// game.debug.bodyInfo(aliens._container.children[0], 32, 32);
|
||||
// game.debug.bodyInfo(aliens._container.children[0], 32, 32);
|
||||
|
||||
// game.debug.bodyInfo(car, 16, 24);
|
||||
// game.debug.bodyInfo(aliens.getFirstAlive(), 16, 24);
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('ball', 'assets/sprites/shinyball.png');
|
||||
|
||||
}
|
||||
|
||||
var balls;
|
||||
|
||||
function create() {
|
||||
|
||||
balls = game.add.group();
|
||||
|
||||
for (var i = 0; i < 50; i++)
|
||||
{
|
||||
var ball = balls.create(game.world.randomX, game.world.randomY, 'ball');
|
||||
game.physics.enable(ball, Phaser.Physics.ARCADE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
if (game.input.mousePointer.isDown)
|
||||
{
|
||||
// First is the callback
|
||||
// Second is the context in which the callback runs, in this case game.physics.arcade
|
||||
// Third is the parameter the callback expects - it is always sent the Group child as the first parameter
|
||||
balls.forEach(game.physics.arcade.moveToPointer, game.physics.arcade, false, 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
balls.setAll('body.velocity.x', 0);
|
||||
balls.setAll('body.velocity.y', 0);
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
function preload() {
|
||||
game.load.image('arrow', 'assets/sprites/longarrow.png');
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
var sprite3;
|
||||
var sprite4;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#363636';
|
||||
|
||||
sprite1 = game.add.sprite(150, 150, 'arrow');
|
||||
sprite1.anchor.setTo(0.1, 0.5);
|
||||
|
||||
sprite2 = game.add.sprite(200, 500, 'arrow');
|
||||
sprite2.anchor.setTo(0.1, 0.5);
|
||||
|
||||
sprite3 = game.add.sprite(400, 200, 'arrow');
|
||||
sprite3.anchor.setTo(0.1, 0.5);
|
||||
|
||||
sprite4 = game.add.sprite(600, 400, 'arrow');
|
||||
sprite4.anchor.setTo(0.1, 0.5);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
// This will update the sprite.rotation so that it points to the currently active pointer
|
||||
// On a Desktop that is the mouse, on mobile the most recent finger press.
|
||||
|
||||
sprite1.rotation = game.physics.arcade.angleToPointer(sprite1);
|
||||
sprite2.rotation = game.physics.arcade.angleToPointer(sprite2);
|
||||
sprite3.rotation = game.physics.arcade.angleToPointer(sprite3);
|
||||
sprite4.rotation = game.physics.arcade.angleToPointer(sprite4);
|
||||
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('atari', 'assets/sprites/atari130xe.png');
|
||||
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
sprite1 = game.add.sprite(150, 200, 'atari');
|
||||
sprite1.name = 'atari';
|
||||
|
||||
sprite2 = game.add.sprite(700, 220, 'mushroom');
|
||||
sprite2.name = 'mushroom';
|
||||
|
||||
game.physics.enable([sprite1,sprite2], Phaser.Physics.ARCADE);
|
||||
|
||||
// This adjusts the collision body size to be a 100x50 box.
|
||||
// 50, 25 is the X and Y offset of the newly sized box.
|
||||
|
||||
sprite1.body.setSize(100, 50, 50, 25);
|
||||
sprite1.body.immovable = true;
|
||||
|
||||
|
||||
sprite2.body.velocity.x = -100;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.arcade.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
|
||||
function collisionHandler (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
// game.debug.bodyInfo(sprite1, 32, 32);
|
||||
|
||||
// game.debug.physicsBody(sprite1.body);
|
||||
// game.debug.physicsBody(sprite2.body);
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.spritesheet('gameboy', 'assets/sprites/gameboy_seize_color_40x60.png', 40, 60);
|
||||
game.load.image('atari', 'assets/sprites/atari130xe.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite;
|
||||
var sprite2;
|
||||
var sprite3;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#124184';
|
||||
|
||||
// In this example the little Gameboy sprite can pass through the top/bottom of the Atari sprite
|
||||
// Because it's set to ignore collisions on its top/bottom faces.
|
||||
|
||||
sprite = game.add.sprite(300, 200, 'atari');
|
||||
sprite.name = 'atari';
|
||||
game.physics.enable(sprite, Phaser.Physics.ARCADE);
|
||||
sprite.body.collideWorldBounds = true;
|
||||
sprite.body.checkCollision.up = false;
|
||||
sprite.body.checkCollision.down = false;
|
||||
sprite.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(350, 400, 'gameboy', 2);
|
||||
sprite2.name = 'gameboy';
|
||||
|
||||
game.physics.enable(sprite2, Phaser.Physics.ARCADE);
|
||||
sprite2.body.collideWorldBounds = true;
|
||||
sprite2.body.bounce.setTo(1, 1);
|
||||
|
||||
sprite3 = game.add.sprite(0, 210, 'gameboy', 4);
|
||||
|
||||
game.physics.enable(sprite3, Phaser.Physics.ARCADE);
|
||||
|
||||
sprite3.name = 'gameboy2';
|
||||
sprite3.body.collideWorldBounds = true;
|
||||
sprite3.body.bounce.setTo(1, 1);
|
||||
|
||||
sprite2.body.velocity.y = -200;
|
||||
sprite3.body.velocity.x = 200;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.arcade.collide(sprite, sprite2);
|
||||
game.physics.arcade.collide(sprite, sprite3);
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
// game.debug.bodyInfo(sprite, 16, 24);
|
||||
|
||||
// game.debug.physicsBody(sprite.body);
|
||||
// game.debug.physicsBody(sprite2.body);
|
||||
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('atari', 'assets/sprites/atari130xe.png');
|
||||
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
// This will check Sprite vs. Sprite collision using a custom process callback
|
||||
sprite1 = game.add.sprite(0, 200, 'atari');
|
||||
sprite2 = game.add.sprite(750, 220, 'mushroom');
|
||||
|
||||
game.physics.enable([sprite1,sprite2], Phaser.Physics.ARCADE);
|
||||
|
||||
// We'll use random velocities so we can test it in our processCallback
|
||||
sprite1.body.velocity.x = 50 + Math.random() * 100;
|
||||
sprite2.body.velocity.x = -(50 + Math.random() * 100);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.arcade.collide(sprite1, sprite2, collisionCallback, processCallback, this);
|
||||
|
||||
}
|
||||
|
||||
function processCallback (obj1, obj2) {
|
||||
|
||||
// This function can perform your own additional checks on the 2 objects that collided.
|
||||
// For example you could test for velocity, health, etc.
|
||||
// This function needs to return either true or false. If it returns true then collision carries on (separating the two objects).
|
||||
// If it returns false the collision is assumed to have failed and aborts, no further checks or separation happen.
|
||||
|
||||
if (obj1.body.speed > obj2.body.speed)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function collisionCallback (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.text('The processCallback will only collide if sprite1 is going fastest.', 32, 32);
|
||||
game.debug.text('Sprite 1 speed: ' + sprite1.body.speed, 32, 64);
|
||||
game.debug.text('Sprite 2 speed: ' + sprite2.body.speed, 32, 96);
|
||||
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('ship', 'assets/sprites/xenon2_ship.png');
|
||||
game.load.image('baddie', 'assets/sprites/space-baddie.png');
|
||||
|
||||
}
|
||||
|
||||
var ship;
|
||||
var aliens;
|
||||
|
||||
function create() {
|
||||
|
||||
aliens = game.add.group();
|
||||
aliens.enableBody = true;
|
||||
|
||||
for (var i = 0; i < 50; i++)
|
||||
{
|
||||
var s = aliens.create(game.world.randomX, game.world.randomY, 'baddie');
|
||||
s.body.collideWorldBounds = true;
|
||||
s.body.bounce.set(1);
|
||||
s.body.velocity.setTo(10 + Math.random() * 40, 10 + Math.random() * 40);
|
||||
}
|
||||
|
||||
ship = game.add.sprite(400, 400, 'ship');
|
||||
game.physics.enable(ship, Phaser.Physics.ARCADE);
|
||||
ship.body.collideWorldBounds = true;
|
||||
ship.body.bounce.set(1);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.arcade.collide(ship, aliens);
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
|
||||
{
|
||||
ship.body.velocity.x -= 4;
|
||||
}
|
||||
else if (game.input.keyboard.isDown(Phaser.Keyboard.RIGHT))
|
||||
{
|
||||
ship.body.velocity.x += 4;
|
||||
}
|
||||
|
||||
if (game.input.keyboard.isDown(Phaser.Keyboard.UP))
|
||||
{
|
||||
ship.body.velocity.y -= 4;
|
||||
}
|
||||
else if (game.input.keyboard.isDown(Phaser.Keyboard.DOWN))
|
||||
{
|
||||
ship.body.velocity.y += 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.quadTree(game.physics.arcade.quadTree);
|
||||
|
||||
}
|