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.coordinatesOnLine will return all coordinates on the line using …
…Bresenhams line algorithm.
- Loading branch information
1 parent
ec0b222
commit a83a76b
Showing
5 changed files
with
97 additions
and
28 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,20 @@ | ||
|
||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { create: create }); | ||
|
||
|
||
function create() { | ||
|
||
var line = new Phaser.Line(100, 50, 10, 300); | ||
|
||
var coords = line.coordinatesOnLine(); | ||
|
||
var bmd = game.add.bitmapData(800, 600); | ||
bmd.context.fillStyle = '#ffffff'; | ||
var bg = game.add.sprite(0, 0, bmd); | ||
|
||
for (var i = 0; i < coords.length; i++) | ||
{ | ||
bmd.context.fillRect(coords[i][0], coords[i][1], 1, 1); | ||
} | ||
|
||
} |
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