forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Line now has x, y, width, height, top, bottom, left and right propert…
…ies, so you can effectively get its bounds.
- Loading branch information
1 parent
a83a76b
commit f678d1f
Showing
6 changed files
with
202 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { create: create, update: update, render: render }); | ||
|
||
var line; | ||
var setting = false; | ||
|
||
function create() { | ||
|
||
line = new Phaser.Line(64, 64, 200, 300); | ||
|
||
game.input.onDown.add(click, this); | ||
|
||
} | ||
|
||
function update() { | ||
|
||
if (setting) | ||
{ | ||
if (game.input.activePointer.isDown) | ||
{ | ||
line.end.set(game.input.activePointer.x, game.input.activePointer.y); | ||
} | ||
else | ||
{ | ||
setting = false; | ||
} | ||
} | ||
|
||
} | ||
|
||
function click(pointer) { | ||
|
||
setting = true; | ||
line.start.set(pointer.x, pointer.y); | ||
|
||
} | ||
|
||
function render() { | ||
|
||
game.debug.geom(line); | ||
game.debug.rectangle(line); | ||
|
||
} |
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,43 @@ | ||
|
||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { create: create, update: update, render: render }); | ||
|
||
var line; | ||
var setting = false; | ||
|
||
function create() { | ||
|
||
line = new Phaser.Line(64, 64, 200, 300); | ||
|
||
game.input.onDown.add(click, this); | ||
|
||
} | ||
|
||
function update() { | ||
|
||
if (setting) | ||
{ | ||
if (game.input.activePointer.isDown) | ||
{ | ||
line.end.set(game.input.activePointer.x, game.input.activePointer.y); | ||
} | ||
else | ||
{ | ||
setting = false; | ||
} | ||
} | ||
|
||
} | ||
|
||
function click(pointer) { | ||
|
||
setting = true; | ||
line.start.set(pointer.x, pointer.y); | ||
|
||
} | ||
|
||
function render() { | ||
|
||
game.debug.geom(line); | ||
game.debug.rectangle(line); | ||
|
||
} |
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