forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added class constructors, fixed Stripshader, added relative Tween exa…
…mple and updated Tween source.
- Loading branch information
1 parent
fdbdd81
commit ce4cf53
Showing
59 changed files
with
324 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render }); | ||
|
||
function preload() { | ||
|
||
game.load.image('phaser', 'assets/sprites/phaser1.png'); | ||
game.load.spritesheet('arrows', 'assets/sprites/arrows.png', 23, 31); | ||
|
||
} | ||
|
||
var arrowStart; | ||
var arrowEnd; | ||
var sprite; | ||
|
||
function create() { | ||
|
||
game.stage.backgroundColor = '#2384e7'; | ||
|
||
arrowStart = game.add.sprite(100, 100, 'arrows', 0); | ||
|
||
arrowEnd = game.add.sprite(400, 100, 'arrows', 1); | ||
|
||
sprite = game.add.sprite(100, 164, 'phaser'); | ||
sprite.inputEnabled = true; | ||
|
||
sprite.events.onInputDown.add(move, this); | ||
|
||
} | ||
|
||
function move() { | ||
|
||
if (sprite.x === 100) | ||
{ | ||
// Here you'll notice we are using a relative value for the tween. | ||
// You can specify a number as a string with either + or - at the start of it. | ||
// When the tween starts it will take the sprites current X value and add +300 to it. | ||
|
||
game.add.tween(sprite).to( { x: '+300' }, 2000, Phaser.Easing.Linear.None, true); | ||
} | ||
else if (sprite.x === 400) | ||
{ | ||
game.add.tween(sprite).to( { x: '-300' }, 2000, Phaser.Easing.Linear.None, true); | ||
} | ||
|
||
} | ||
|
||
function render() { | ||
|
||
if (sprite.x === 100 || sprite.x === 400) | ||
{ | ||
game.debug.renderText('Click sprite to tween', 32, 32); | ||
} | ||
|
||
game.debug.renderText('x: ' + arrowStart.x, arrowStart.x, arrowStart.y - 4); | ||
game.debug.renderText('x: ' + arrowEnd.x, arrowEnd.x, arrowEnd.y - 4); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, render: render }); | ||
|
||
function preload() { | ||
|
||
game.load.image('phaser', 'assets/sprites/phaser1.png'); | ||
game.load.spritesheet('arrows', 'assets/sprites/arrows.png', 23, 31); | ||
|
||
} | ||
|
||
var arrowStart; | ||
var arrowEnd; | ||
var sprite; | ||
|
||
function create() { | ||
|
||
game.stage.backgroundColor = '#2384e7'; | ||
|
||
arrowStart = game.add.sprite(100, 100, 'arrows', 0); | ||
|
||
arrowEnd = game.add.sprite(400, 100, 'arrows', 1); | ||
|
||
sprite = game.add.sprite(100, 164, 'phaser'); | ||
sprite.inputEnabled = true; | ||
|
||
sprite.events.onInputDown.add(move, this); | ||
|
||
} | ||
|
||
function move() { | ||
|
||
if (sprite.x === 100) | ||
{ | ||
// Here you'll notice we are using a relative value for the tween. | ||
// You can specify a number as a string with either + or - at the start of it. | ||
// When the tween starts it will take the sprites current X value and add +300 to it. | ||
|
||
game.add.tween(sprite).to( { x: '+300' }, 2000, Phaser.Easing.Linear.None, true); | ||
} | ||
else if (sprite.x === 400) | ||
{ | ||
game.add.tween(sprite).to( { x: '-300' }, 2000, Phaser.Easing.Linear.None, true); | ||
} | ||
|
||
} | ||
|
||
function render() { | ||
|
||
if (sprite.x === 100 || sprite.x === 400) | ||
{ | ||
game.debug.renderText('Click sprite to tween', 32, 32); | ||
} | ||
|
||
game.debug.renderText('x: ' + arrowStart.x, arrowStart.x, arrowStart.y - 4); | ||
game.debug.renderText('x: ' + arrowEnd.x, arrowEnd.x, arrowEnd.y - 4); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,3 +158,5 @@ Phaser.Frame.prototype = { | |
} | ||
|
||
}; | ||
|
||
Phaser.Frame.prototype.constructor = Phaser.Frame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,4 +151,6 @@ Phaser.LinkedList.prototype = { | |
|
||
} | ||
|
||
}; | ||
}; | ||
|
||
Phaser.LinkedList.prototype.constructor = Phaser.LinkedList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,3 +119,5 @@ Phaser.Plugin.prototype = { | |
} | ||
|
||
}; | ||
|
||
Phaser.Plugin.prototype.constructor = Phaser.Plugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -295,3 +295,5 @@ Phaser.PluginManager.prototype = { | |
} | ||
|
||
}; | ||
|
||
Phaser.PluginManager.prototype.constructor = Phaser.PluginManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,3 +300,5 @@ Phaser.Signal.prototype = { | |
} | ||
|
||
}; | ||
|
||
Phaser.Signal.prototype.constructor = Phaser.Signal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,3 +160,5 @@ Phaser.SignalBinding.prototype = { | |
} | ||
|
||
}; | ||
|
||
Phaser.SignalBinding.prototype.constructor = Phaser.SignalBinding; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,3 +167,5 @@ Phaser.State.prototype = { | |
} | ||
|
||
}; | ||
|
||
Phaser.State.prototype.constructor = Phaser.State; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -512,3 +512,5 @@ Phaser.StateManager.prototype = { | |
} | ||
|
||
}; | ||
|
||
Phaser.StateManager.prototype.constructor = Phaser.StateManager; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,4 +73,6 @@ Phaser.Events.prototype = { | |
|
||
} | ||
|
||
}; | ||
}; | ||
|
||
Phaser.Events.prototype.constructor = Phaser.Events; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1106,4 +1106,6 @@ Phaser.InputHandler.prototype = { | |
|
||
} | ||
|
||
}; | ||
}; | ||
|
||
Phaser.InputHandler.prototype.constructor = Phaser.InputHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -169,3 +169,5 @@ Phaser.Key.prototype = { | |
} | ||
|
||
}; | ||
|
||
Phaser.Key.prototype.constructor = Phaser.Key; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.