mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 15:14:47 +00:00
Added Phaser.Graphics and fixed the Out of World Bounds call.
This commit is contained in:
parent
30fc4099c6
commit
60f0e8967f
8 changed files with 669 additions and 123 deletions
|
@ -3,6 +3,42 @@
|
|||
{
|
||||
"selected_items":
|
||||
[
|
||||
[
|
||||
"call",
|
||||
"callbackContext (argument)"
|
||||
],
|
||||
[
|
||||
"str_re",
|
||||
"str_replace"
|
||||
],
|
||||
[
|
||||
"curr",
|
||||
"currentNode"
|
||||
],
|
||||
[
|
||||
"cur",
|
||||
"currentNode"
|
||||
],
|
||||
[
|
||||
"alpha",
|
||||
"alphaThreshold (variable)"
|
||||
],
|
||||
[
|
||||
"alph",
|
||||
"alphaThreshold"
|
||||
],
|
||||
[
|
||||
"_",
|
||||
"_iPrev (variable)"
|
||||
],
|
||||
[
|
||||
"nl",
|
||||
"null"
|
||||
],
|
||||
[
|
||||
"ha",
|
||||
"head"
|
||||
],
|
||||
[
|
||||
"set",
|
||||
"setTo"
|
||||
|
@ -75,10 +111,6 @@
|
|||
"canv",
|
||||
"canvasToConsole"
|
||||
],
|
||||
[
|
||||
"_",
|
||||
"_iNext"
|
||||
],
|
||||
[
|
||||
"nex",
|
||||
"nextNode"
|
||||
|
@ -207,10 +239,6 @@
|
|||
"act",
|
||||
"actualWidth"
|
||||
],
|
||||
[
|
||||
"curr",
|
||||
"currentFrame"
|
||||
],
|
||||
[
|
||||
"til",
|
||||
"tilingSprite"
|
||||
|
@ -486,44 +514,32 @@
|
|||
[
|
||||
"phas",
|
||||
"phaserSpace"
|
||||
],
|
||||
[
|
||||
"cen",
|
||||
"centroid2"
|
||||
],
|
||||
[
|
||||
"space",
|
||||
"Space"
|
||||
],
|
||||
[
|
||||
"iter",
|
||||
"iteration"
|
||||
],
|
||||
[
|
||||
"mar",
|
||||
"margin-bottom"
|
||||
],
|
||||
[
|
||||
"font",
|
||||
"font-size"
|
||||
],
|
||||
[
|
||||
"puzzle",
|
||||
"puzzle_id"
|
||||
],
|
||||
[
|
||||
"cre",
|
||||
"createSprite"
|
||||
]
|
||||
]
|
||||
},
|
||||
"buffers":
|
||||
[
|
||||
{
|
||||
"file": "src/core/Group.js",
|
||||
"file": "src/gameobjects/Button.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 17255,
|
||||
"buffer_size": 4621,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "src/gameobjects/GameObjectFactory.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 2971,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
},
|
||||
{
|
||||
"file": "examples/button1.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 1548,
|
||||
"line_ending": "Windows"
|
||||
}
|
||||
}
|
||||
|
@ -556,9 +572,42 @@
|
|||
},
|
||||
"file_history":
|
||||
[
|
||||
"/D/wamp/www/phaser/TS Tests/buttons/basic button.ts",
|
||||
"/D/wamp/www/phaser/TS Source/gameobjects/GameObjectFactory.js",
|
||||
"/D/wamp/www/phaser/examples/js.php",
|
||||
"/D/wamp/www/phaser/src/gameobjects/TileSprite.js",
|
||||
"/D/wamp/www/phaser/TS Source/ui/Button.js",
|
||||
"/D/wamp/www/phaser/src/input/InputHandler.js",
|
||||
"/D/wamp/www/phaser/src/gameobjects/Sprite.js",
|
||||
"/D/wamp/www/phaser/src/physics/arcade/Body.js",
|
||||
"/D/wamp/www/phaser/src/Phaser.js",
|
||||
"/D/wamp/www/phaser/build/build.php",
|
||||
"/D/wamp/www/phaser/src/Intro.js",
|
||||
"/D/wamp/www/phaser/build/phaser.js",
|
||||
"/D/wamp/www/phaser/src/input/Input.js",
|
||||
"/D/wamp/www/phaser/src/input/Pointer.js",
|
||||
"/D/wamp/www/phaser/src/core/World.js",
|
||||
"/D/wamp/www/phaser/src/core/Group.js",
|
||||
"/D/wamp/www/phaser/examples/js-physics.php",
|
||||
"/D/wamp/www/phaser/src/utils/Utils.js",
|
||||
"/D/wamp/www/phaser/src/pixi/utils/Utils.js",
|
||||
"/D/wamp/www/phaser/src/pixi/display/Stage.js",
|
||||
"/D/wamp/www/phaser/examples/js_full.php",
|
||||
"/D/wamp/www/phaser/examples/bring top top2.php",
|
||||
"/D/wamp/www/phaser/TS Tests/input/bring to top.ts",
|
||||
"/D/wamp/www/phaser/examples/touch1.php",
|
||||
"/D/wamp/www/phaser/src/utils/Debug.js",
|
||||
"/D/wamp/www/phaser/src/pixi/InteractionManager.js",
|
||||
"/D/wamp/www/phaser/src/gameobjects/Events.js",
|
||||
"/D/wamp/www/phaser/TS Source/utils/DebugUtils.js",
|
||||
"/D/wamp/www/phaser/src/core/LinkedList.js",
|
||||
"/D/wamp/www/phaser/TS Source/gameobjects/Events.js",
|
||||
"/D/wamp/www/phaser/TS Source/input/InputHandler.ts",
|
||||
"/D/wamp/www/phaser/TS Source/input/InputHandler.js",
|
||||
"/D/wamp/www/phaser/examples/linkedlist1.php",
|
||||
"/D/wamp/www/phaser/src/pixi/display/DisplayObjectContainer.js",
|
||||
"/D/wamp/www/phaser/src/pixi/display/DisplayObject.js",
|
||||
"/D/wamp/www/phaser/src/pixi/text/BitmapText.js",
|
||||
"/D/wamp/www/phaser/src/physics/arcade/Body.js",
|
||||
"/D/wamp/www/phaser/src/core/Game.js",
|
||||
"/D/wamp/www/phaser/examples/quadtree2.php",
|
||||
"/D/wamp/www/phaser/examples/body3.php",
|
||||
|
@ -568,17 +617,13 @@
|
|||
"/D/wamp/www/phaser/examples/anchor1.php",
|
||||
"/D/wamp/www/phaser/src/physics/arcade/ArcadePhysics.js",
|
||||
"/D/wamp/www/phaser/src/geom/Rectangle.js",
|
||||
"/D/wamp/www/phaser/src/utils/Debug.js",
|
||||
"/D/wamp/www/phaser/src/gameobjects/GameObjectFactory.js",
|
||||
"/D/wamp/www/phaser/src/core/Group.js",
|
||||
"/D/wamp/www/phaser/src/tween/Tween.js",
|
||||
"/D/wamp/www/phaser/TS Source/core/Group.ts",
|
||||
"/D/wamp/www/phaser/TS Source/core/Group.js",
|
||||
"/D/wamp/www/phaser/src/pixi/display/DisplayObjectContainer.js",
|
||||
"/D/wamp/www/phaser/examples/consoleBanner3.php",
|
||||
"/D/wamp/www/consoledemo/index.html",
|
||||
"/D/wamp/www/phaser/src/core/Stage.js",
|
||||
"/D/wamp/www/phaser/examples/js.php",
|
||||
"/D/wamp/www/phaser/src/system/Canvas.js",
|
||||
"/D/wamp/www/phaser/examples/consoleBanner2.php",
|
||||
"/D/wamp/www/consoledemo/src/codef_core.js",
|
||||
|
@ -592,10 +637,6 @@
|
|||
"/D/wamp/www/phaser/TS Source/utils/ColorUtils.ts",
|
||||
"/D/wamp/www/phaser/src/pixi/renderers/canvas/CanvasRenderer.js",
|
||||
"/D/wamp/www/phaser/TS Source/display/DynamicTexture.ts",
|
||||
"/D/wamp/www/phaser/TS Source/gameobjects/Events.js",
|
||||
"/D/wamp/www/phaser/TS Source/input/InputHandler.js",
|
||||
"/D/wamp/www/phaser/src/input/Input.js",
|
||||
"/D/wamp/www/phaser/src/input/Pointer.js",
|
||||
"/D/wamp/www/phaser/examples/motion1.php",
|
||||
"/D/wamp/www/phaser/todo/phaser clean up/Collision.js",
|
||||
"/D/wamp/www/phaser/todo/physics/Collision.js",
|
||||
|
@ -626,12 +667,9 @@
|
|||
"/D/wamp/www/phaser/src/physics/advanced/base.js",
|
||||
"/D/wamp/www/physicsRus/ph.js",
|
||||
"/D/wamp/www/phaser/src/pixi/textures/Texture.js",
|
||||
"/D/wamp/www/phaser/src/gameobjects/TileSprite.js",
|
||||
"/D/wamp/www/phaser/examples/get_bounds.php",
|
||||
"/D/wamp/www/phaser/src/pixi/display/Sprite.js",
|
||||
"/D/wamp/www/phaser/examples/tilesprite1.php",
|
||||
"/D/wamp/www/phaser/src/utils/Utils.js",
|
||||
"/D/wamp/www/phaser/src/Phaser.js",
|
||||
"/D/wamp/www/phaser/examples/inherit.php",
|
||||
"/D/wamp/www/bbc-wolfblood/wolfblood.js",
|
||||
"/D/wamp/www/phaser/examples/tilesprite2.php",
|
||||
|
@ -647,9 +685,7 @@
|
|||
"/D/wamp/www/phaser/TS Source/sound/Sound.ts",
|
||||
"/D/wamp/www/phaser/TS Source/sound/SoundManager.js",
|
||||
"/D/wamp/www/phaser/TS Source/math/QuadTree.js",
|
||||
"/D/wamp/www/phaser/src/pixi/display/Stage.js",
|
||||
"/D/wamp/www/phaser/examples/camera_cull1.php",
|
||||
"/D/wamp/www/phaser/src/pixi/display/DisplayObject.js",
|
||||
"/D/wamp/www/bbc-wolfblood/assets/1024/help/help_titles.json",
|
||||
"/D/wamp/www/phaser/src/math/LinkedList.js",
|
||||
"/D/wamp/www/phaser/TS Source/math/LinkedList.js",
|
||||
|
@ -657,33 +693,13 @@
|
|||
"/D/wamp/www/phaser/examples/camera4.php",
|
||||
"/D/wamp/www/phaser/examples/sprite3.php",
|
||||
"/D/wamp/www/phaser/examples/camera5.php",
|
||||
"/D/wamp/www/phaser/src/pixi/InteractionManager.js",
|
||||
"/D/wamp/www/pixi.js/examples/example 6 - Interactivity/index.html",
|
||||
"/D/wamp/www/phaser/src/math/Math.js",
|
||||
"/D/wamp/www/phaser/src/geom/Point.js",
|
||||
"/D/wamp/www/phaser/TS Source/gameobjects/TransformManager.ts",
|
||||
"/D/wamp/www/phaser/TS Source/utils/SpriteUtils.ts",
|
||||
"/D/wamp/www/phaser/TS Source/utils/SpriteUtils.js",
|
||||
"/D/wamp/www/phaser/src/core/Camera.js",
|
||||
"/D/wamp/www/phaser/src/input/MSPointer.js",
|
||||
"/D/wamp/www/phaser/src/core/StateManager.js",
|
||||
"/D/wamp/www/phaser/TS Source/utils/DebugUtils.js",
|
||||
"/D/wamp/www/phaser/TS Source/renderers/canvas/SpriteRenderer.ts",
|
||||
"/D/wamp/www/phaser/examples/input1.php",
|
||||
"/D/wamp/www/phaser/src/input/Mouse.js",
|
||||
"/D/wamp/www/phaser/src/input/Touch.js",
|
||||
"/D/wamp/www/phaser/src/input/Keyboard.js",
|
||||
"/D/wamp/www/phaser/TS Source/gameobjects/Sprite.ts",
|
||||
"/D/wamp/www/phaser/TS Source/input/Pointer.js",
|
||||
"/D/wamp/www/phaser/TS Source/input/Touch.js",
|
||||
"/D/wamp/www/phaser/TS Source/input/MSPointer.js",
|
||||
"/D/wamp/www/phaser/TS Source/cameras/Camera.js",
|
||||
"/D/wamp/www/phaser/examples/camera1.php",
|
||||
"/D/wamp/www/phaser/TS Source/input/Mouse.js",
|
||||
"/D/wamp/www/phaser/TS Source/math/Vec2Utils.js",
|
||||
"/D/wamp/www/phaser/TS Source/input/InputManager.js",
|
||||
"/D/wamp/www/phaser/TS Source/input/Keyboard.ts",
|
||||
"/D/wamp/www/phaser/TS Source/input/Keyboard.js"
|
||||
"/D/wamp/www/phaser/src/core/Camera.js"
|
||||
],
|
||||
"find":
|
||||
{
|
||||
|
@ -691,9 +707,10 @@
|
|||
},
|
||||
"find_in_files":
|
||||
{
|
||||
"height": 0.0,
|
||||
"height": 90.0,
|
||||
"where_history":
|
||||
[
|
||||
"D:\\wamp\\www\\phaser\\src\\pixi",
|
||||
"D:\\wamp\\www\\phaser\\src\\input",
|
||||
"D:\\wamp\\www\\phaser\\src\\physics\\advanced",
|
||||
"D:\\wamp\\www\\phaser\\src\\pixi",
|
||||
|
@ -721,6 +738,38 @@
|
|||
"case_sensitive": true,
|
||||
"find_history":
|
||||
[
|
||||
"this.",
|
||||
"transform.origin",
|
||||
"TileSprite",
|
||||
"PolyK",
|
||||
"bind",
|
||||
"Rectangle",
|
||||
"_container",
|
||||
"stage",
|
||||
"global",
|
||||
"Phaser.DebugUtils",
|
||||
"targetObject.input",
|
||||
"first",
|
||||
"sprite.events",
|
||||
"new Phaser.Signal",
|
||||
"()",
|
||||
"_parent",
|
||||
"if(",
|
||||
"InputHandler.prototype.",
|
||||
"_parent",
|
||||
"()",
|
||||
"InputHandler.prototype.",
|
||||
"game.world.randomY",
|
||||
"_iPrev",
|
||||
"_iNext",
|
||||
"entity",
|
||||
"ship",
|
||||
"displayObject",
|
||||
"this",
|
||||
"interactiveItems",
|
||||
"PIXI.visibleCount",
|
||||
"vcount",
|
||||
"childLast",
|
||||
"bounds",
|
||||
"body.bounds",
|
||||
"right",
|
||||
|
@ -816,39 +865,7 @@
|
|||
"this.position.x",
|
||||
"position.x",
|
||||
"Position.x",
|
||||
"position.x",
|
||||
"this.bounds",
|
||||
"public get ",
|
||||
"Vec2",
|
||||
"bounds",
|
||||
"width",
|
||||
"bunny",
|
||||
"getFr",
|
||||
"this._cache.halfWidth",
|
||||
"halfWidth",
|
||||
"X",
|
||||
"x",
|
||||
"X",
|
||||
"x",
|
||||
"width",
|
||||
"y",
|
||||
"sourceSize",
|
||||
"halfWidth",
|
||||
"frameWidth",
|
||||
"x",
|
||||
"width",
|
||||
"()",
|
||||
"ArcadePhysics.prototype.",
|
||||
"Vec2",
|
||||
"Space.write",
|
||||
"isEmptyObject",
|
||||
"addEvent",
|
||||
"text",
|
||||
"TileSprite",
|
||||
"4",
|
||||
"256",
|
||||
"Phaser.Sprite",
|
||||
"\n});\n"
|
||||
"position.x"
|
||||
],
|
||||
"highlight": true,
|
||||
"in_selection": false,
|
||||
|
@ -856,6 +873,11 @@
|
|||
"regex": false,
|
||||
"replace_history":
|
||||
[
|
||||
"sprite",
|
||||
"if (",
|
||||
"sprite",
|
||||
"prev",
|
||||
"next",
|
||||
"body",
|
||||
"_stage",
|
||||
")',",
|
||||
|
@ -951,23 +973,152 @@
|
|||
"groups":
|
||||
[
|
||||
{
|
||||
"selected": 0,
|
||||
"selected": 2,
|
||||
"sheets":
|
||||
[
|
||||
{
|
||||
"buffer": 0,
|
||||
"file": "src/core/Group.js",
|
||||
"file": "src/gameobjects/Button.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 17255,
|
||||
"buffer_size": 4621,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
4441,
|
||||
4441
|
||||
2537,
|
||||
2537
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"codeintel": true,
|
||||
"codeintel_config":
|
||||
{
|
||||
"JavaScript":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 2,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"javascriptExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"PHP":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 5,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"phpExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"Python":
|
||||
{
|
||||
"env":
|
||||
{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codeintel_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_live": true,
|
||||
"codeintel_live_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_max_recursive_dir_depth": 10,
|
||||
"codeintel_scan_exclude_dir":
|
||||
{
|
||||
"JavaScript":
|
||||
[
|
||||
"/build/",
|
||||
"/min/"
|
||||
]
|
||||
},
|
||||
"codeintel_scan_files_in_project": true,
|
||||
"codeintel_selected_catalogs":
|
||||
[
|
||||
"PyWin32",
|
||||
"jQuery",
|
||||
"Rails"
|
||||
],
|
||||
"codeintel_snippets": true,
|
||||
"codeintel_syntax_map":
|
||||
{
|
||||
"Python Django": "Python"
|
||||
},
|
||||
"sublime_auto_complete": true,
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage"
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 1188.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 1,
|
||||
"file": "src/gameobjects/GameObjectFactory.js",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 2971,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
2960,
|
||||
2960
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
|
@ -1076,10 +1227,142 @@
|
|||
},
|
||||
"sublime_auto_complete": true,
|
||||
"syntax": "Packages/JavaScript/JavaScript.tmLanguage",
|
||||
"translate_tabs_to_spaces": false
|
||||
"tab_size": 4,
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 3550.0,
|
||||
"translation.y": 758.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
},
|
||||
{
|
||||
"buffer": 2,
|
||||
"file": "examples/button1.php",
|
||||
"settings":
|
||||
{
|
||||
"buffer_size": 1548,
|
||||
"regions":
|
||||
{
|
||||
},
|
||||
"selection":
|
||||
[
|
||||
[
|
||||
510,
|
||||
510
|
||||
]
|
||||
],
|
||||
"settings":
|
||||
{
|
||||
"codeintel": true,
|
||||
"codeintel_config":
|
||||
{
|
||||
"JavaScript":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 2,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"javascriptExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"PHP":
|
||||
{
|
||||
"codeintel_max_recursive_dir_depth": 5,
|
||||
"codeintel_scan_files_in_project": false,
|
||||
"phpExtraPaths":
|
||||
[
|
||||
]
|
||||
},
|
||||
"Python":
|
||||
{
|
||||
"env":
|
||||
{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codeintel_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_live": true,
|
||||
"codeintel_live_enabled_languages":
|
||||
[
|
||||
"JavaScript",
|
||||
"Mason",
|
||||
"XBL",
|
||||
"XUL",
|
||||
"RHTML",
|
||||
"SCSS",
|
||||
"Python",
|
||||
"HTML",
|
||||
"Ruby",
|
||||
"Python3",
|
||||
"XML",
|
||||
"Sass",
|
||||
"XSLT",
|
||||
"Django",
|
||||
"HTML5",
|
||||
"Perl",
|
||||
"CSS",
|
||||
"Twig",
|
||||
"Less",
|
||||
"Smarty",
|
||||
"Node.js",
|
||||
"Tcl",
|
||||
"TemplateToolkit",
|
||||
"PHP"
|
||||
],
|
||||
"codeintel_max_recursive_dir_depth": 10,
|
||||
"codeintel_scan_exclude_dir":
|
||||
{
|
||||
"JavaScript":
|
||||
[
|
||||
"/build/",
|
||||
"/min/"
|
||||
]
|
||||
},
|
||||
"codeintel_scan_files_in_project": true,
|
||||
"codeintel_selected_catalogs":
|
||||
[
|
||||
"PyWin32",
|
||||
"jQuery",
|
||||
"Rails"
|
||||
],
|
||||
"codeintel_snippets": true,
|
||||
"codeintel_syntax_map":
|
||||
{
|
||||
"Python Django": "Python"
|
||||
},
|
||||
"sublime_auto_complete": true,
|
||||
"syntax": "Packages/PHP/PHP.tmLanguage",
|
||||
"tab_size": 4,
|
||||
"translate_tabs_to_spaces": true
|
||||
},
|
||||
"translation.x": 0.0,
|
||||
"translation.y": 328.0,
|
||||
"zoom_level": 1.0
|
||||
},
|
||||
"type": "text"
|
||||
|
|
80
examples/graphics.php
Normal file
80
examples/graphics.php
Normal file
|
@ -0,0 +1,80 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>phaser.js - a new beginning</title>
|
||||
<?php
|
||||
require('js.php');
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('atari1', 'assets/sprites/atari130xe.png');
|
||||
|
||||
}
|
||||
|
||||
var graphics;
|
||||
|
||||
function create() {
|
||||
|
||||
graphics = game.add.graphics(0, 0);
|
||||
|
||||
// set a fill and line style
|
||||
graphics.beginFill(0xFF3300);
|
||||
graphics.lineStyle(10, 0xffd900, 1);
|
||||
|
||||
// draw a shape
|
||||
graphics.moveTo(50,50);
|
||||
graphics.lineTo(250, 50);
|
||||
graphics.lineTo(100, 100);
|
||||
graphics.lineTo(250, 220);
|
||||
graphics.lineTo(50, 220);
|
||||
graphics.lineTo(50, 50);
|
||||
graphics.endFill();
|
||||
|
||||
// set a fill and line style again
|
||||
graphics.lineStyle(10, 0xFF0000, 0.8);
|
||||
graphics.beginFill(0xFF700B, 1);
|
||||
|
||||
// draw a second shape
|
||||
graphics.moveTo(210,300);
|
||||
graphics.lineTo(450,320);
|
||||
graphics.lineTo(570,350);
|
||||
graphics.lineTo(580,20);
|
||||
graphics.lineTo(330,120);
|
||||
graphics.lineTo(410,200);
|
||||
graphics.lineTo(210,300);
|
||||
graphics.endFill();
|
||||
|
||||
// draw a rectangel
|
||||
graphics.lineStyle(2, 0x0000FF, 1);
|
||||
graphics.drawRect(50, 250, 100, 100);
|
||||
|
||||
// draw a circle
|
||||
graphics.lineStyle(0);
|
||||
graphics.beginFill(0xFFFF0B, 0.5);
|
||||
graphics.drawCircle(470, 200,100);
|
||||
|
||||
graphics.lineStyle(20, 0x33FF00);
|
||||
graphics.moveTo(30,30);
|
||||
graphics.lineTo(600, 300);
|
||||
|
||||
game.add.tween(graphics).to({ x: 200 }, 2000, Phaser.Easing.Linear.None, true, 0, 1000, true);
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
}
|
||||
|
||||
})();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -64,6 +64,7 @@
|
|||
<script src="../src/gameobjects/TileSprite.js"></script>
|
||||
<script src="../src/gameobjects/Text.js"></script>
|
||||
<script src="../src/gameobjects/Button.js"></script>
|
||||
<script src="../src/gameobjects/Graphics.js"></script>
|
||||
<script src="../src/system/Canvas.js"></script>
|
||||
<script src="../src/system/StageScaleMode.js"></script>
|
||||
<script src="../src/system/Device.js"></script>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
(function () {
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, '', { preload: preload, create: create, update: update, render: render });
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
game.load.image('alien', 'assets/sprites/space-baddie.png');
|
||||
|
@ -33,10 +33,10 @@
|
|||
{
|
||||
for (var x = 0; x < 10; x++)
|
||||
{
|
||||
var alien = aliens.create(x * 48, y * 50, 'alien');
|
||||
var alien = aliens.create(200 + x * 48, y * 50, 'alien');
|
||||
alien.name = 'alien' + x.toString() + y.toString();
|
||||
alien.events.onOutOfBounds.add(alienOut, this);
|
||||
alien.body.velocity.y = 50 + Math.random() * 150;
|
||||
alien.body.velocity.y = 50 + Math.random() * 200;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,10 @@
|
|||
|
||||
function alienOut(alien) {
|
||||
|
||||
// Move the alien to the top of the screen again
|
||||
alien.reset(alien.x, -32);
|
||||
// And give it a new random velocity
|
||||
alien.body.velocity.y = 50 + Math.random() * 200;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -85,4 +85,10 @@ Phaser.GameObjectFactory.prototype = {
|
|||
|
||||
},
|
||||
|
||||
graphics: function (x, y) {
|
||||
|
||||
return this.world.add(new Phaser.Graphics(this.game, x, y));
|
||||
|
||||
},
|
||||
|
||||
};
|
154
src/gameobjects/Graphics.js
Normal file
154
src/gameobjects/Graphics.js
Normal file
|
@ -0,0 +1,154 @@
|
|||
Phaser.Graphics = function (game, x, y) {
|
||||
|
||||
// If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all
|
||||
this.exists = true;
|
||||
|
||||
// This is a handy little var your game can use to determine if a sprite is alive or not, it doesn't effect rendering
|
||||
this.alive = true;
|
||||
|
||||
this.group = null;
|
||||
|
||||
this.name = '';
|
||||
|
||||
this.game = game;
|
||||
|
||||
PIXI.DisplayObjectContainer.call(this);
|
||||
|
||||
this.position.x = x;
|
||||
this.position.y = y;
|
||||
|
||||
// Replaces the PIXI.Point with a slightly more flexible one
|
||||
this.scale = new Phaser.Point(1, 1);
|
||||
|
||||
// Influence of camera movement upon the position
|
||||
this.scrollFactor = new Phaser.Point(1, 1);
|
||||
|
||||
// A mini cache for storing all of the calculated values
|
||||
this._cache = {
|
||||
|
||||
dirty: false,
|
||||
|
||||
// Transform cache
|
||||
a00: 1, a01: 0, a02: x, a10: 0, a11: 1, a12: y, id: 1,
|
||||
|
||||
// The previous calculated position inc. camera x/y and scrollFactor
|
||||
x: -1, y: -1,
|
||||
|
||||
// The actual scale values based on the worldTransform
|
||||
scaleX: 1, scaleY: 1
|
||||
|
||||
};
|
||||
|
||||
this._cache.x = this.x - (this.game.world.camera.x * this.scrollFactor.x);
|
||||
this._cache.y = this.y - (this.game.world.camera.y * this.scrollFactor.y);
|
||||
|
||||
this.renderable = true;
|
||||
|
||||
/**
|
||||
* The alpha of the fill of this graphics object
|
||||
*
|
||||
* @property fillAlpha
|
||||
* @type Number
|
||||
*/
|
||||
this.fillAlpha = 1;
|
||||
|
||||
/**
|
||||
* The width of any lines drawn
|
||||
*
|
||||
* @property lineWidth
|
||||
* @type Number
|
||||
*/
|
||||
this.lineWidth = 0;
|
||||
|
||||
/**
|
||||
* The color of any lines drawn
|
||||
*
|
||||
* @property lineColor
|
||||
* @type String
|
||||
*/
|
||||
this.lineColor = "black";
|
||||
|
||||
/**
|
||||
* Graphics data
|
||||
*
|
||||
* @property graphicsData
|
||||
* @type Array
|
||||
* @private
|
||||
*/
|
||||
this.graphicsData = [];
|
||||
|
||||
/**
|
||||
* Current path
|
||||
*
|
||||
* @property currentPath
|
||||
* @type Object
|
||||
* @private
|
||||
*/
|
||||
this.currentPath = {points:[]};
|
||||
|
||||
};
|
||||
|
||||
Phaser.Graphics.prototype = Phaser.Utils.extend(true, PIXI.Graphics.prototype, PIXI.DisplayObjectContainer.prototype, Phaser.Sprite.prototype);
|
||||
Phaser.Graphics.prototype.constructor = Phaser.Graphics;
|
||||
|
||||
// Add our own custom methods
|
||||
|
||||
/**
|
||||
* Automatically called by World.update
|
||||
*/
|
||||
Phaser.Graphics.prototype.update = function() {
|
||||
|
||||
if (!this.exists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this._cache.dirty = false;
|
||||
|
||||
this._cache.x = this.x - (this.game.world.camera.x * this.scrollFactor.x);
|
||||
this._cache.y = this.y - (this.game.world.camera.y * this.scrollFactor.y);
|
||||
|
||||
if (this.position.x != this._cache.x || this.position.y != this._cache.y)
|
||||
{
|
||||
this.position.x = this._cache.x;
|
||||
this.position.y = this._cache.y;
|
||||
this._cache.dirty = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Object.defineProperty(Phaser.Graphics.prototype, 'angle', {
|
||||
|
||||
get: function() {
|
||||
return Phaser.Math.radToDeg(this.rotation);
|
||||
},
|
||||
|
||||
set: function(value) {
|
||||
this.rotation = Phaser.Math.degToRad(value);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Object.defineProperty(Phaser.Graphics.prototype, 'x', {
|
||||
|
||||
get: function() {
|
||||
return this.position.x;
|
||||
},
|
||||
|
||||
set: function(value) {
|
||||
this.position.x = value;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Object.defineProperty(Phaser.Graphics.prototype, 'y', {
|
||||
|
||||
get: function() {
|
||||
return this.position.y;
|
||||
},
|
||||
|
||||
set: function(value) {
|
||||
this.position.y = value;
|
||||
}
|
||||
|
||||
});
|
|
@ -142,6 +142,9 @@ Phaser.Sprite = function (game, x, y, key, frame) {
|
|||
// Set-up the physics body
|
||||
this.body = new Phaser.Physics.Arcade.Body(this);
|
||||
|
||||
// World bounds check
|
||||
this.inWorld = Phaser.Rectangle.intersects(this.bounds, this.game.world.bounds);
|
||||
this.inWorldThreshold = 0;
|
||||
this._outOfBoundsFired = false;
|
||||
|
||||
};
|
||||
|
@ -280,7 +283,7 @@ Phaser.Sprite.prototype.reset = function(x, y) {
|
|||
this.exists = true;
|
||||
this.visible = true;
|
||||
this._outOfBoundsFired = false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
Phaser.Sprite.prototype.updateBounds = function() {
|
||||
|
@ -306,11 +309,27 @@ Phaser.Sprite.prototype.updateBounds = function() {
|
|||
this._cache.boundsX = this._cache.x;
|
||||
this._cache.boundsY = this._cache.y;
|
||||
|
||||
// Check world bounds
|
||||
if (this._outOfBoundsFired == false && Phaser.Rectangle.intersects(this.bounds, this.game.world.bounds, 100) == false)
|
||||
if (this.inWorld == false)
|
||||
{
|
||||
this.events.onOutOfBounds.dispatch(this);
|
||||
this._outOfBoundsFired = true;
|
||||
// Sprite WAS out of the screen, is it still?
|
||||
this.inWorld = Phaser.Rectangle.intersects(this.bounds, this.game.world.bounds, this.inWorldThreshold);
|
||||
|
||||
if (this.inWorld)
|
||||
{
|
||||
// It's back again, reset the OOB check
|
||||
this._outOfBoundsFired = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sprite WAS in the screen, has it now left?
|
||||
this.inWorld = Phaser.Rectangle.intersects(this.bounds, this.game.world.bounds, this.inWorldThreshold);
|
||||
|
||||
if (this.inWorld == false)
|
||||
{
|
||||
this.events.onOutOfBounds.dispatch(this);
|
||||
this._outOfBoundsFired = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ Phaser.TweenManager.prototype = {
|
|||
*/
|
||||
create: function (object, localReference) {
|
||||
|
||||
if (typeof localReference === "undefined") { localReference = false; }
|
||||
localReference = localReference || false;
|
||||
|
||||
if (localReference)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue