diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 00000000..643c8639 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +phaser \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 00000000..e206d70d --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..d16ceba4 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,22 @@ + + + + + + + diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..4a058776 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/phaser.iml b/.idea/phaser.iml new file mode 100644 index 00000000..6b8184f8 --- /dev/null +++ b/.idea/phaser.iml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 00000000..922003b8 --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..c80f2198 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 00000000..8f4da607 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,377 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1377531134782 + 1377531134782 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Phaser OSX.sublime-project b/Phaser OSX.sublime-project new file mode 100644 index 00000000..2ce86d47 --- /dev/null +++ b/Phaser OSX.sublime-project @@ -0,0 +1,9 @@ +{ + "folders": + [ + { + "follow_symlinks": true, + "path": "/Users/rich/Documents/phaser" + } + ] +} diff --git a/Phaser OSX.sublime-workspace b/Phaser OSX.sublime-workspace new file mode 100644 index 00000000..36e9b0e3 --- /dev/null +++ b/Phaser OSX.sublime-workspace @@ -0,0 +1,967 @@ +{ + "auto_complete": + { + "selected_items": + [ + [ + "inter", + "intersectsRaw" + ], + [ + "cont", + "containsRect" + ], + [ + "prot", + "prototype" + ], + [ + "atl", + "atlasURL" + ], + [ + "addT", + "addTextureAtlas" + ], + [ + "TEX", + "TEXTURE_ATLAS_JSON_HASH (variable)" + ], + [ + "ad", + "appendChild (function)" + ], + [ + "fun", + "function" + ], + [ + "prop", + "properties" + ], + [ + "the", + "the_terms" + ], + [ + "load", + "loadPuzzleRatings" + ], + [ + "tr", + "true" + ], + [ + "font-", + "font-family" + ], + [ + "sca", + "scaling" + ], + [ + "Pos", + "Position" + ], + [ + "Po", + "Position" + ], + [ + "to", + "toString" + ], + [ + "phas", + "phaserSpace" + ], + [ + "cen", + "centroid2" + ], + [ + "set", + "setPosition" + ], + [ + "space", + "Space" + ], + [ + "iter", + "iteration" + ], + [ + "mar", + "margin-bottom" + ], + [ + "font", + "font-size" + ], + [ + "puzzle", + "puzzle_id" + ], + [ + "cre", + "createSprite" + ], + [ + "displ", + "displaySummary" + ], + [ + "strr", + "strrpos" + ], + [ + "file", + "filename" + ], + [ + "save", + "save_result" + ], + [ + "proces", + "processFile" + ], + [ + "single", + "single_file" + ], + [ + "all", + "all_files" + ], + [ + "sing", + "single_file" + ], + [ + "bac", + "background-color" + ], + [ + "text", + "text-decoration" + ], + [ + "va", + "vars" + ], + [ + "con", + "consts" + ], + [ + "c", + "consts" + ], + [ + "class", + "classname" + ], + [ + "clas", + "classname" + ], + [ + "output", + "output_file" + ], + [ + "str_re", + "str_replace" + ], + [ + "input", + "input_dir" + ], + [ + "back", + "background-size" + ], + [ + "wait", + "waitingHelpscreen" + ], + [ + "juke", + "jukebox" + ], + [ + "jukeb", + "jukeboxPP" + ], + [ + "start", + "startTheEngines" + ], + [ + "star", + "startPause" + ], + [ + "Beak", + "BeakerGameStartGameHook" + ], + [ + "Bea", + "BeakerGameStartGameHook" + ], + [ + "crea", + "createHD" + ], + [ + "whee", + "wheelUp" + ], + [ + "whe", + "wheelSpeed" + ], + [ + "cr", + "currentDelivery" + ], + [ + "let", + "letter1" + ], + [ + "g", + "getLetterData" + ], + [ + "sc", + "scanIt" + ], + [ + "pro", + "progressFill" + ], + [ + "up", + "update" + ], + [ + "deli", + "delivery1" + ], + [ + "ju", + "justPressed" + ], + [ + "de", + "delivery1" + ], + [ + "del", + "delivery" + ], + [ + "is", + "isShowingDelivery" + ], + [ + "he", + "height" + ], + [ + "fc", + "function" + ], + [ + "roun", + "roundTimer" + ], + [ + "drage", + "dragEndTime" + ], + [ + "drags", + "dragStartTime" + ], + [ + "drag", + "dragStartY" + ], + [ + "_id", + "_idCount" + ], + [ + "_oncom", + "_onCompleteCallbackFired" + ], + [ + "round", + "roundComplete" + ], + [ + "scr", + "scrollUp" + ], + [ + "shad", + "shadowFloatY" + ], + [ + "pau", + "pauseScreen" + ], + [ + "ne", + "nextRound" + ], + [ + "sha", + "shadow" + ], + [ + "flo", + "floatOff" + ], + [ + "st", + "startY" + ], + [ + "pip", + "piplin1" + ], + [ + "tw", + "tween" + ], + [ + "rou", + "round" + ], + [ + "time", + "timeToShine" + ], + [ + "shado", + "shadowY" + ], + [ + "shi", + "shine" + ], + [ + "shin", + "shineY" + ], + [ + "sh", + "shineY" + ], + [ + "pp", + "piplin1" + ], + [ + "setup", + "setupRound" + ], + [ + "leaf", + "leafX" + ], + [ + "rust", + "rustleOut" + ], + [ + "rus", + "rustleTimer" + ], + [ + "lea", + "leaves" + ], + [ + "hit", + "hitContext" + ], + [ + "ol", + "oldY" + ], + [ + "old", + "oldX" + ], + [ + "rot", + "rotation" + ], + [ + "ro", + "rotation" + ], + [ + "l", + "leaves" + ], + [ + "pi", + "piplin2" + ], + [ + "game", + "gameButton2" + ], + [ + "pl", + "playGame" + ], + [ + "mouse", + "mouseEnabled" + ], + [ + "first", + "first_time_online" + ], + [ + "use", + "useWebAudio" + ], + [ + "web", + "webAudioSupported" + ], + [ + "pop", + "poppedTotal" + ], + [ + "fn", + "function" + ], + [ + "bubb", + "bubbleSize" + ], + [ + "bub", + "bubbleMaxY" + ], + [ + "sele", + "selectGame" + ], + [ + "gameb", + "gameButton1" + ], + [ + "selec", + "selectScreen" + ], + [ + "pla", + "playButton" + ], + [ + "titl", + "titleScreen" + ], + [ + "tit", + "titleScreen" + ], + [ + "dr", + "drawGridLines" + ], + [ + "init", + "initGame" + ], + [ + "die", + "diveSpeed" + ], + [ + "wave", + "waveY" + ], + [ + "dive", + "diveCanvas" + ], + [ + "wa", + "waveY" + ], + [ + "di", + "diveContext" + ], + [ + "divec", + "diveContext" + ], + [ + "wavet", + "waveTween1" + ] + ] + }, + "buffers": + [ + ], + "build_system": "", + "command_palette": + { + "height": 380.0, + "selected_items": + [ + [ + "pack", + "Package Control: Install Package" + ] + ], + "width": 416.0 + }, + "console": + { + "height": 146.0, + "history": + [ + ] + }, + "distraction_free": + { + "menu_visible": true, + "show_minimap": false, + "show_open_files": false, + "show_tabs": false, + "side_bar_visible": false, + "status_bar_visible": false + }, + "file_history": + [ + "/D/wamp/www/phaser/TS Source/tweens/TweenManager.js", + "/D/wamp/www/phaser/src/geom/Rectangle.js", + "/D/wamp/www/phaser/TS Source/utils/RectangleUtils.js", + "/D/wamp/www/phaser/TS Source/geom/Rectangle.js", + "/D/wamp/www/phaser/src/system/Device.js", + "/D/wamp/www/phaser/src/math/Math.js", + "/D/wamp/www/phaser/examples/point.html", + "/D/wamp/www/phaser/src/geom/Point.js", + "/D/wamp/www/phaser/src/geom/Circle.js", + "/D/wamp/www/phaser/TS Source/utils/PointUtils.js", + "/D/wamp/www/phaser/TS Source/geom/Point.js", + "/D/wamp/www/phaser/TS Source/time/TimeManager.js", + "/D/wamp/www/phaser/TS Source/time/TimeManager.ts", + "/D/wamp/www/phaser/TS Source/math/GameMath.js", + "/D/wamp/www/phaser/examples/math sincos.html", + "/D/wamp/www/phaser/examples/circle.html", + "/D/wamp/www/phaser/TS Source/utils/CircleUtils.js", + "/D/wamp/www/phaser/TS Source/geom/Circle.js", + "/D/wamp/www/phaser/src/time/Time.js", + "/D/wamp/www/phaser/src/net/Net.js", + "/D/wamp/www/phaser/examples/net.html", + "/D/wamp/www/phaser/TS Source/net/Net.js", + "/D/wamp/www/phaser/src/animation/Parser.js", + "/D/wamp/www/phaser/src/loader/Cache.js", + "/D/wamp/www/phaser/src/loader/Loader.js", + "/D/wamp/www/phaser/examples/loader audio.html", + "/D/wamp/www/phaser/examples/loader spritesheet.html", + "/D/wamp/www/phaser/examples/loader atlas xml.html", + "/D/wamp/www/phaser/examples/loader atlas json.html", + "/D/wamp/www/phaser/examples/assets/sprites/shoebot.xml", + "/D/wamp/www/phaser/src/animation/Frame.js", + "/D/wamp/www/phaser/TS Source/loader/AnimationLoader.js", + "/D/wamp/www/phaser/TS Source/loader/AnimationLoader.ts", + "/D/wamp/www/phaser/src/animation/Animation.js", + "/D/wamp/www/phaser/src/loader/AnimationLoader.js", + "/D/wamp/www/phaser/src/animation/FrameData.js", + "/D/wamp/www/phaser/TS Source/animation/FrameData.ts", + "/D/wamp/www/phaser/TS Source/animation/FrameData.js", + "/D/wamp/www/phaser/TS Source/animation/Frame.ts", + "/D/wamp/www/phaser/TS Source/animation/Frame.js", + "/D/wamp/www/phaser/examples/loader 2.html", + "/D/wamp/www/bbc-wolfblood/game.js", + "/D/wamp/www/phaser/examples/loader.html", + "/D/wamp/www/phaser/TS Source/loader/Loader.js", + "/D/wamp/www/phaser/TS Source/Game.js", + "/D/wamp/www/phaser/TS Source/loader/Cache.js", + "/D/wamp/www/phaser/TS Source/loader/Cache.ts", + "/D/wamp/www/phaser/src/Phaser.js", + "/D/wamp/www/phaser/TS Source/loader/Loader.ts", + "/D/wamp/www/phaser/src/math/RandomDataGenerator.js", + "/D/wamp/www/phaser/src/core/SignalBinding.js", + "/D/wamp/www/phaser/src/core/Signal.js", + "/D/wamp/www/phaser/examples/signals.html", + "/D/wamp/www/phaser/examples/rnd.html", + "/D/wamp/www/phaser/TS Source/core/Signal.js", + "/D/wamp/www/js-signals/src/Signal.js", + "/D/wamp/www/js-signals/src/wrapper.js", + "/D/wamp/www/pixi.js/examples/example 1 - Basics/index.html", + "/D/wamp/www/awasenghi/lib/Core.js", + "/D/wamp/www/phaser/TS Source/math/RandomDataGenerator.js", + "/D/wamp/www/Nonsense/Nonsense.js", + "/D/wamp/www/numtums/pop/bake.php", + "/D/wamp/www/phaser/src/pixi/Pixi.js", + "/D/wamp/www/phaser/TS Source/Phaser.ts", + "/D/wamp/www/bbc-wolfblood/tsc.txt", + "/D/wamp/www/bbc-wolfblood/load.php", + "/D/wamp/www/phaser/build/phaser-debug.js", + "/D/wamp/www/bbc-wolfblood/embed.js", + "/D/wamp/www/phaser/README.md", + "/D/wamp/www/bbc-wolfblood/mobile.php", + "/D/wamp/www/bbc-wolfblood/load-desktop.php", + "/D/wamp/www/bbc-wolfblood/Wolfblood/Wolfblood.csproj", + "/D/wamp/www/phaser/Phaser/defToXML.php", + "/D/wamp/www/bbc-wolfblood/Phaser/Phaser.csproj", + "/D/wamp/www/bbc-wolfblood/mobile-wolfblood-min.js", + "/D/wamp/www/elmo/README.md", + "/C/Users/rich/AppData/Local/Temp/dtemp-6fdf6c055229125-20.dop/mobile-wolfblood-min.js", + "/C/Users/rich/AppData/Local/Temp/dtemp-6fafca055212843-20.dop/wolfblood-min.js", + "/C/Users/rich/Desktop/embed.js", + "/D/wamp/www/bbc-wolfblood/embed (1).js", + "/C/Users/rich/Desktop/Q3.qif", + "/C/Users/rich/Downloads/Sheet 52.qif", + "/C/Users/rich/Downloads/Sheet 49-51.qif", + "/C/Users/rich/Downloads/Sheet 48.qif", + "/C/Users/rich/Downloads/Sheets 45-47.qif", + "/C/Users/rich/Downloads/Sheet 44.qif", + "/C/Users/rich/Downloads/Sheet 40 (May).qif", + "/D/wamp/www/bbc-wolfblood/Wolfblood/sha1.js", + "/D/webroot/phaser.io/index.html", + "/D/wamp/www/phaser/Phaser/Stage.js", + "/D/wamp/www/phaser/Tests/physics/temp2.ts", + "/D/wamp/www/phaser/Tests/physics/aabb vs aabb 1.js", + "/D/wamp/www/phaser/Tests/physics/aabb 1.js", + "/D/wamp/www/Proton/example/helloworld/emitter/emitter.html", + "/D/wamp/www/Proton/src/emitter/Emitter.js", + "/D/wamp/www/Proton/src/initialize/InitializeUtil.js", + "/D/wamp/www/Proton/src/initialize/Position.js", + "/D/wamp/www/Proton/src/render/BaseRender.js", + "/D/wamp/www/Proton/src/render/Renderer.js", + "/D/wamp/www/Proton/src/render/CanvasRender.js", + "/D/wamp/www/Proton/src/zone/Zone.js", + "/D/wamp/www/Proton/src/zone/PointZone.js", + "/D/wamp/www/Proton/src/plus/ease.js", + "/D/wamp/www/Proton/src/behaviour/RandomDrift.js", + "/D/wamp/www/Proton/src/math/ColorSpan.js", + "/D/wamp/www/Proton/src/math/NumericalIntegration.js", + "/D/wamp/www/Proton/src/math/MathUtils.js", + "/D/wamp/www/Proton/src/behaviour/Behaviour.js", + "/D/wamp/www/Proton/src/initialize/Velocity.js", + "/D/wamp/www/Proton/src/math/Polar2D.js", + "/D/wamp/www/Proton/src/behaviour/Scale.js", + "/D/wamp/www/Proton/src/behaviour/Repulsion.js", + "/D/wamp/www/Proton/src/initialize/Rate.js", + "/D/wamp/www/Proton/src/core/Proton.js", + "/D/wamp/www/Proton/src/core/Particle.js", + "/D/wamp/www/Proton/src/core/ParticlePool.js", + "/D/wamp/www/Proton/src/initialize/Life.js", + "/D/wamp/www/Proton/src/initialize/Radius.js", + "/D/wamp/www/Proton/src/utils/Util.js", + "/D/wamp/www/Proton/src/math/Span.js", + "/D/wamp/www/Proton/src/initialize/Initialize.js", + "/D/wamp/www/Proton/src/initialize/Mass.js", + "/D/wamp/www/bbc-jigsaw/sarahandduck/frame.html", + "/D/wamp/www/phaser/Tests/phaser.css", + "/D/wamp/www/phaser/Docs/tags.txt", + "/D/wamp/www/phaser/Docs/docs_server.bat", + "/D/wamp/www/phaser/Docs/docs_build.bat", + "/D/wamp/www/phaser/Phaser/Phaser.csproj" + ], + "find": + { + "height": 34.0 + }, + "find_in_files": + { + "height": 90.0, + "where_history": + [ + "D:\\wamp\\www\\phaser\\src\\pixi", + "D:\\wamp\\www\\phaser\\Tests\\tilemap", + "D:\\wamp\\www\\phaser\\Tests\\sprites", + "D:\\wamp\\www\\phaser\\Tests\\particles", + "D:\\wamp\\www\\phaser\\Tests\\mini games", + "D:\\wamp\\www\\phaser\\Tests\\misc", + "D:\\wamp\\www\\phaser\\Tests\\input", + "D:\\wamp\\www\\phaser\\Tests\\groups", + "D:\\wamp\\www\\phaser\\Tests\\collision", + "D:\\wamp\\www\\phaser\\Tests\\cameras", + "", + "D:\\wamp\\www\\bbc\\firsttimeonline\\src", + "D:\\wamp\\www\\bbc\\hideandseek\\src", + "D:\\wamp\\www\\clients\\bitecp\\lib\\game", + "D:\\wamp\\www\\numtums\\swipetum\\src" + ] + }, + "find_state": + { + "case_sensitive": false, + "find_history": + [ + "TweenManager.prototype.", + "Phaser.Rectangle.", + "a.", + "RectangleUtils", + "defineProperty(Rectangle.prototype", + "});", + "x", + "Rectangle.prototype.", + "this.android", + "dest", + "this", + "a", + "*", + "Point.prototype.", + "GameMath.prototype.", + "};", + "GameMath.prototype.", + "};", + "GameMath.prototype.", + "};", + "GameMath.prototype.", + "source", + "(Circle.prototype", + "defineProperty", + "getter", + "public ", + "Net.prototype.", + "this.TEXTURE", + "Phaser", + "FrameData.prototype.", + "number;", + "public ", + "pop", + "_queueSize", + "nextFile", + "Cache.prototype.", + "public ", + "{bool}", + " if (this._fileList[key]) {\n return true;\n } else {\n return false;\n }\n", + "_queueSize", + "Phaser.Signal", + ";", + "private ", + "public ", + "validateListener", + " : function", + "SignalBinding", + " : function", + " : ", + "validateListener", + "Nonsense.prototype.", + " = ", + ";", + " = null", + "this.", + "Maze", + "Include=\"", + "=", + "Fixed", + "wolfblood", + "index.php", + "unrated", + "UNRATED", + "setAll", + "Game.Sound", + "unlock", + "pause", + ".value", + ".pause", + "noteOn", + "refreshBuffer", + ".src", + "line", + "onAlpha", + "bunny", + "bunnies", + "bunny", + "write", + "step", + "shapes", + "].", + "hapes", + "verts", + "transform", + "position", + "Manager", + "position", + "solveVelocityConstraints", + "false", + "position", + "p", + "ju", + "\n ", + "position", + "staticBody", + "stepCount", + "stats =", + "frameRateHz", + "collision", + "ready", + "runFrame", + " Manager.write('findContactSolver. Length: ' + this.contactSolvers.length);\nfindContact", + "postSolve", + "gravity", + "runFrame", + "onClickedPlayer", + "step", + "Manager", + "solveVelocity", + "velocitySolver", + "initSolve", + "step", + "contactSolverArr", + "add", + "findContact", + "contactSolvers", + "add", + "norma", + "saveSceneToServer", + "console", + "saveSceneToServer", + "drawBox", + "drawBodyShape", + "scale", + "damping", + "gravity", + "timeDelta", + " for (var i = 0; i <= 10; i++) {\n var body = new Body(Body.DYNAMIC, new vec2(-6 + i * 1.2, 8));\n var shape = new ShapeCircle(0, 0, 0.4);\n shape.e = i / 10;\n shape.u = 1.0;\n shape.density = 1;\n body.addShape(shape);\n body.resetMassData();\n space.addBody(body);\n }\n" + ], + "highlight": true, + "in_selection": false, + "preserve_case": false, + "regex": false, + "replace_history": + [ + "queueSize", + "{boolean}", + "queueSize", + "Phaser.SignalBinding", + "launcher.html", + "/Phaser/", + "", + "SignalBinding", + "Signal", + "/// \n/// ", + "Quadratic", + "//Playtomic", + "hasSwiped", + "firsttimeonline/html5", + "this.popped", + "if (game.useWebAudio === false)", + "sd/", + "assets/hd/", + "runningWellDoneSequence", + "html5/media/", + "duckButton", + "bestfootforward", + "duckButton", + "", + "cardBack", + "hideURLBar", + "isGameComplete", + "sengi", + "Sengi", + "style.display" + ], + "reverse": false, + "show_context": true, + "use_buffer2": true, + "whole_word": false, + "wrap": true + }, + "groups": + [ + { + "sheets": + [ + ] + } + ], + "incremental_find": + { + "height": 0.0 + }, + "input": + { + "height": 34.0 + }, + "layout": + { + "cells": + [ + [ + 0, + 0, + 1, + 1 + ] + ], + "cols": + [ + 0.0, + 1.0 + ], + "rows": + [ + 0.0, + 1.0 + ] + }, + "menu_visible": true, + "project": "Phaser OSX.sublime-project", + "replace": + { + "height": 62.0 + }, + "save_all_on_build": true, + "select_file": + { + "height": 0.0, + "selected_items": + [ + ], + "width": 0.0 + }, + "select_project": + { + "height": 0.0, + "selected_items": + [ + ], + "width": 0.0 + }, + "select_symbol": + { + "height": 0.0, + "selected_items": + [ + ], + "width": 0.0 + }, + "settings": + { + }, + "show_minimap": true, + "show_open_files": false, + "show_tabs": true, + "side_bar_visible": true, + "side_bar_width": 284.0, + "status_bar_visible": true, + "template_settings": + { + } +} diff --git a/Phaser.sublime-workspace b/Phaser.sublime-workspace index 7bd602aa..cf201740 100644 --- a/Phaser.sublime-workspace +++ b/Phaser.sublime-workspace @@ -560,7 +560,10 @@ }, "console": { - "height": 146.0 + "height": 146.0, + "history": + [ + ] }, "distraction_free": { @@ -914,6 +917,7 @@ { "buffer": 0, "file": "src/Game.js", + "semi_transient": false, "settings": { "buffer_size": 5482, @@ -1044,6 +1048,7 @@ { "buffer": 1, "file": "todo/Tween.js", + "semi_transient": false, "settings": { "buffer_size": 12434, @@ -1174,6 +1179,7 @@ { "buffer": 2, "file": "src/tween/TweenManager.js", + "semi_transient": false, "settings": { "buffer_size": 3317, @@ -1335,6 +1341,7 @@ ] }, "menu_visible": true, + "project": "Phaser.sublime-project", "replace": { "height": 62.0 @@ -1356,10 +1363,24 @@ ], "width": 0.0 }, + "select_symbol": + { + "height": 0.0, + "selected_items": + [ + ], + "width": 0.0 + }, + "settings": + { + }, "show_minimap": true, "show_open_files": false, "show_tabs": true, "side_bar_visible": true, "side_bar_width": 284.0, - "status_bar_visible": true + "status_bar_visible": true, + "template_settings": + { + } } diff --git a/examples/wip1.html b/examples/wip1.html index 716778e9..225755e9 100644 --- a/examples/wip1.html +++ b/examples/wip1.html @@ -11,6 +11,9 @@ + + + @@ -26,17 +29,16 @@ var game = new Phaser.Game(this, '', 800, 600); -var a = new Phaser.Point(100, 100); -var b = new Phaser.Point(200, 100); +var test = { x: 0 }; -console.log('Point A', a.toString()); -console.log('Point B', b.toString()); +var tween = game.tweens.create(test); -a.add(b.x, b.y); +tween.onComplete.add(onComplete, this); +tween.to({x: 100}, 1000, Phaser.Easing.Linear.None, true); -console.log('Point A + B', a.toString()); - -console.log('Distance between A and B', Phaser.Point.distance(a, b)); +function onComplete() { + console.log('tween finished, new data: ', test); +} diff --git a/src/Game.js b/src/Game.js index f0e642a9..8f2e6fab 100644 --- a/src/Game.js +++ b/src/Game.js @@ -184,7 +184,7 @@ Phaser.Game.prototype = { this.cache = new Phaser.Cache(this); this.load = new Phaser.Loader(this); this.time = new Phaser.Time(this); - // this.tweens = new Phaser.TweenManager(this); + this.tweens = new Phaser.TweenManager(this); // this.input = new Phaser.InputManager(this); // this.sound = new Phaser.SoundManager(this); this.rnd = new Phaser.RandomDataGenerator([(Date.now() * Math.random()).toString()]); diff --git a/src/tween/Easing.js b/src/tween/Easing.js new file mode 100644 index 00000000..7e007a8e --- /dev/null +++ b/src/tween/Easing.js @@ -0,0 +1,278 @@ +Phaser.Easing = { + + Linear: { + + None: function ( k ) { + + return k; + + } + + }, + + Quadratic: { + + In: function ( k ) { + + return k * k; + + }, + + Out: function ( k ) { + + return k * ( 2 - k ); + + }, + + InOut: function ( k ) { + + if ( ( k *= 2 ) < 1 ) return 0.5 * k * k; + return - 0.5 * ( --k * ( k - 2 ) - 1 ); + + } + + }, + + Cubic: { + + In: function ( k ) { + + return k * k * k; + + }, + + Out: function ( k ) { + + return --k * k * k + 1; + + }, + + InOut: function ( k ) { + + if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k; + return 0.5 * ( ( k -= 2 ) * k * k + 2 ); + + } + + }, + + Quartic: { + + In: function ( k ) { + + return k * k * k * k; + + }, + + Out: function ( k ) { + + return 1 - ( --k * k * k * k ); + + }, + + InOut: function ( k ) { + + if ( ( k *= 2 ) < 1) return 0.5 * k * k * k * k; + return - 0.5 * ( ( k -= 2 ) * k * k * k - 2 ); + + } + + }, + + Quintic: { + + In: function ( k ) { + + return k * k * k * k * k; + + }, + + Out: function ( k ) { + + return --k * k * k * k * k + 1; + + }, + + InOut: function ( k ) { + + if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k * k * k; + return 0.5 * ( ( k -= 2 ) * k * k * k * k + 2 ); + + } + + }, + + Sinusoidal: { + + In: function ( k ) { + + return 1 - Math.cos( k * Math.PI / 2 ); + + }, + + Out: function ( k ) { + + return Math.sin( k * Math.PI / 2 ); + + }, + + InOut: function ( k ) { + + return 0.5 * ( 1 - Math.cos( Math.PI * k ) ); + + } + + }, + + Exponential: { + + In: function ( k ) { + + return k === 0 ? 0 : Math.pow( 1024, k - 1 ); + + }, + + Out: function ( k ) { + + return k === 1 ? 1 : 1 - Math.pow( 2, - 10 * k ); + + }, + + InOut: function ( k ) { + + if ( k === 0 ) return 0; + if ( k === 1 ) return 1; + if ( ( k *= 2 ) < 1 ) return 0.5 * Math.pow( 1024, k - 1 ); + return 0.5 * ( - Math.pow( 2, - 10 * ( k - 1 ) ) + 2 ); + + } + + }, + + Circular: { + + In: function ( k ) { + + return 1 - Math.sqrt( 1 - k * k ); + + }, + + Out: function ( k ) { + + return Math.sqrt( 1 - ( --k * k ) ); + + }, + + InOut: function ( k ) { + + if ( ( k *= 2 ) < 1) return - 0.5 * ( Math.sqrt( 1 - k * k) - 1); + return 0.5 * ( Math.sqrt( 1 - ( k -= 2) * k) + 1); + + } + + }, + + Elastic: { + + In: function ( k ) { + + var s, a = 0.1, p = 0.4; + if ( k === 0 ) return 0; + if ( k === 1 ) return 1; + if ( !a || a < 1 ) { a = 1; s = p / 4; } + else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI ); + return - ( a * Math.pow( 2, 10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) ); + + }, + + Out: function ( k ) { + + var s, a = 0.1, p = 0.4; + if ( k === 0 ) return 0; + if ( k === 1 ) return 1; + if ( !a || a < 1 ) { a = 1; s = p / 4; } + else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI ); + return ( a * Math.pow( 2, - 10 * k) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) + 1 ); + + }, + + InOut: function ( k ) { + + var s, a = 0.1, p = 0.4; + if ( k === 0 ) return 0; + if ( k === 1 ) return 1; + if ( !a || a < 1 ) { a = 1; s = p / 4; } + else s = p * Math.asin( 1 / a ) / ( 2 * Math.PI ); + if ( ( k *= 2 ) < 1 ) return - 0.5 * ( a * Math.pow( 2, 10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) ); + return a * Math.pow( 2, -10 * ( k -= 1 ) ) * Math.sin( ( k - s ) * ( 2 * Math.PI ) / p ) * 0.5 + 1; + + } + + }, + + Back: { + + In: function ( k ) { + + var s = 1.70158; + return k * k * ( ( s + 1 ) * k - s ); + + }, + + Out: function ( k ) { + + var s = 1.70158; + return --k * k * ( ( s + 1 ) * k + s ) + 1; + + }, + + InOut: function ( k ) { + + var s = 1.70158 * 1.525; + if ( ( k *= 2 ) < 1 ) return 0.5 * ( k * k * ( ( s + 1 ) * k - s ) ); + return 0.5 * ( ( k -= 2 ) * k * ( ( s + 1 ) * k + s ) + 2 ); + + } + + }, + + Bounce: { + + In: function ( k ) { + + return 1 - TWEEN.Easing.Bounce.Out( 1 - k ); + + }, + + Out: function ( k ) { + + if ( k < ( 1 / 2.75 ) ) { + + return 7.5625 * k * k; + + } else if ( k < ( 2 / 2.75 ) ) { + + return 7.5625 * ( k -= ( 1.5 / 2.75 ) ) * k + 0.75; + + } else if ( k < ( 2.5 / 2.75 ) ) { + + return 7.5625 * ( k -= ( 2.25 / 2.75 ) ) * k + 0.9375; + + } else { + + return 7.5625 * ( k -= ( 2.625 / 2.75 ) ) * k + 0.984375; + + } + + }, + + InOut: function ( k ) { + + if ( k < 0.5 ) return TWEEN.Easing.Bounce.In( k * 2 ) * 0.5; + return TWEEN.Easing.Bounce.Out( k * 2 - 1 ) * 0.5 + 0.5; + + } + + } + +}; diff --git a/src/tween/Tween.js b/src/tween/Tween.js new file mode 100644 index 00000000..8c58ced5 --- /dev/null +++ b/src/tween/Tween.js @@ -0,0 +1,345 @@ +/** +* Tween constructor +* Create a new Tween. +* +* @param object {object} Target object will be affected by this tween. +* @param game {Phaser.Game} Current game instance. +*/ + +Phaser.Tween = function (object, game) { + + /** + * Reference to the target object. + * @type {object} + */ + this._object = object; + + this.game = game; + this._manager = this.game.tweens; + + this._valuesStart = {}; + this._valuesEnd = {}; + this._valuesStartRepeat = {}; + this._duration = 1000; + this._repeat = 0; + this._yoyo = false; + this._reversed = false; + this._delayTime = 0; + this._startTime = null; + this._easingFunction = Phaser.Easing.Linear.None; + this._interpolationFunction = Phaser.Math.linearInterpolation; + this._chainedTweens = []; + this._onStartCallback = null; + this._onStartCallbackFired = false; + this._onUpdateCallback = null; + this._onCompleteCallback = null; + + this._pausedTime = 0; + + // Set all starting values present on the target object + for ( var field in object ) { + this._valuesStart[ field ] = parseFloat(object[field], 10); + } + + // this.onStart = new Phaser.Signal(); + // this.onUpdate = new Phaser.Signal(); + this.onComplete = new Phaser.Signal(); + + this.isRunning = false; + +}; + +Phaser.Tween.prototype = { + + /** + * Configure the Tween + * @param properties {object} Propertis you want to tween. + * @param [duration] {number} duration of this tween. + * @param [ease] {any} Easing function. + * @param [autoStart] {bool} Whether this tween will start automatically or not. + * @param [delay] {number} delay before this tween will start, defaults to 0 (no delay) + * @param [loop] {bool} Should the tween automatically restart once complete? (ignores any chained tweens) + * @return {Tween} Itself. + */ + to: function ( properties, duration, ease, autoStart, delay, repeat, yoyo ) { + + if (typeof duration === "undefined") { duration = 1000; } + if (typeof ease === "undefined") { ease = null; } + if (typeof autoStart === "undefined") { autoStart = false; } + if (typeof delay === "undefined") { delay = 0; } + if (typeof repeat === "undefined") { repeat = 0; } + if (typeof yoyo === "undefined") { yoyo = false; } + + this._duration = duration; + this._valuesEnd = properties; + + if (ease !== null) { + this._easingFunction = ease; + } + + if (delay > 0) { + this._delayTime = delay; + } + + this._yoyo = yoyo; + + if (autoStart) { + return this.start(); + } else { + return this; + } + + }, + + start: function ( time ) { + + //TWEEN.add( this ); + + if (this.game === null || this._object === null) { + return; + } + + this.isRunning = true; + + this._onStartCallbackFired = false; + + // this._startTime = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() ); + // this._startTime += _delayTime; + this._startTime = this.game.time.now + this._delayTime; + + for ( var property in this._valuesEnd ) { + + // check if an Array was provided as property value + if ( this._valuesEnd[ property ] instanceof Array ) { + + if ( this._valuesEnd[ property ].length === 0 ) { + + continue; + + } + + // create a local copy of the Array with the start value at the front + this._valuesEnd[ property ] = [ this._object[ property ] ].concat( this._valuesEnd[ property ] ); + + } + + this._valuesStart[ property ] = this._object[ property ]; + + if ( ( this._valuesStart[ property ] instanceof Array ) === false ) { + this._valuesStart[ property ] *= 1.0; // Ensures we're using numbers, not strings + } + + this._valuesStartRepeat[ property ] = this._valuesStart[ property ] || 0; + + } + + return this; + + }, + + stop: function () { + + //TWEEN.remove( this ); + if (this._manager !== null) { + this._manager.remove(this); + } + + this.isRunning = false; + + return this; + + }, + + delay: function ( amount ) { + + this._delayTime = amount; + return this; + + }, + + repeat: function ( times ) { + + this._repeat = times; + return this; + + }, + + yoyo: function( yoyo ) { + + this._yoyo = yoyo; + return this; + + }, + + + easing: function ( easing ) { + + this._easingFunction = easing; + return this; + + }, + + interpolation: function ( interpolation ) { + + this._interpolationFunction = interpolation; + return this; + + }, + + chain: function () { + + this._chainedTweens = arguments; + return this; + + }, + + onStart: function ( callback ) { + + this._onStartCallback = callback; + return this; + + }, + + onUpdate: function ( callback ) { + + this._onUpdateCallback = callback; + return this; + + }, + + onComplete: function ( callback ) { + + this._onCompleteCallback = callback; + return this; + + }, + + pause: function () { + this._paused = true; + }, + + resume: function () { + this._paused = false; + this._startTime += this.game.time.pauseDuration; + }, + + update: function ( time ) { + + if (this._paused || time < this._startTime) { + + return true; + + } + + var property; + + if ( time < this._startTime ) { + + return true; + + } + + if ( this._onStartCallbackFired === false ) { + + if ( this._onStartCallback !== null ) { + + this._onStartCallback.call( this._object ); + + } + + this._onStartCallbackFired = true; + + } + + var elapsed = ( time - this._startTime ) / this._duration; + elapsed = elapsed > 1 ? 1 : elapsed; + + var value = this._easingFunction( elapsed ); + + for ( property in this._valuesEnd ) { + + var start = this._valuesStart[ property ] || 0; + var end = this._valuesEnd[ property ]; + + if ( end instanceof Array ) { + + this._object[ property ] = this._interpolationFunction( end, value ); + + } else { + + // Parses relative end values with start as base (e.g.: +10, -3) + if ( typeof(end) === "string" ) { + end = start + parseFloat(end, 10); + } + + // protect against non numeric properties. + if ( typeof(end) === "number" ) { + this._object[ property ] = start + ( end - start ) * value; + } + + } + + } + + if ( this._onUpdateCallback !== null ) { + + this._onUpdateCallback.call( this._object, value ); + + } + + if ( elapsed == 1 ) { + + if ( this._repeat > 0 ) { + + if ( isFinite( this._repeat ) ) { + this._repeat--; + } + + // reassign starting values, restart by making startTime = now + for ( property in this._valuesStartRepeat ) { + + if ( typeof( this._valuesEnd[ property ] ) === "string" ) { + this._valuesStartRepeat[ property ] = this._valuesStartRepeat[ property ] + parseFloat(this._valuesEnd[ property ], 10); + } + + if (this._yoyo) { + var tmp = this._valuesStartRepeat[ property ]; + this._valuesStartRepeat[ property ] = this._valuesEnd[ property ]; + this._valuesEnd[ property ] = tmp; + this._reversed = !this._reversed; + } + this._valuesStart[ property ] = this._valuesStartRepeat[ property ]; + + } + + this._startTime = time + this._delayTime; + + return true; + + } else { + + if ( this._onCompleteCallback !== null ) { + + this.onComplete.dispatch(this._object); + this._onCompleteCallback.call( this._object ); + + } + + for ( var i = 0, numChainedTweens = this._chainedTweens.length; i < numChainedTweens; i ++ ) { + + this._chainedTweens[ i ].start( time ); + + } + + return false; + + } + + } + + return true; + + } + +}; + diff --git a/src/tween/TweenManager.js b/src/tween/TweenManager.js index e93775de..3b161bb5 100644 --- a/src/tween/TweenManager.js +++ b/src/tween/TweenManager.js @@ -96,17 +96,15 @@ Phaser.TweenManager.prototype = { * * @return {bool} Return false if there's no tween to update, otherwise return true. */ - update: function ( time ) { + update: function () { if ( _tweens.length === 0 ) return false; var i = 0, numTweens = _tweens.length; - time = time !== undefined ? time : ( typeof window !== 'undefined' && window.performance !== undefined && window.performance.now !== undefined ? window.performance.now() : Date.now() ); - while ( i < numTweens ) { - if ( _tweens[ i ].update( time ) ) { + if ( _tweens[ i ].update( this.game.time.now ) ) { i ++;