mirror of
https://github.com/wassname/phaser.git
synced 2026-06-27 16:10:15 +08:00
New polygon collision object examples and Body scale fixes.
This commit is contained in:
@@ -118,6 +118,14 @@
|
||||
"file": "bounding+box.js",
|
||||
"title": "bounding box"
|
||||
},
|
||||
{
|
||||
"file": "circle+body.js",
|
||||
"title": "circle body"
|
||||
},
|
||||
{
|
||||
"file": "circle+vs+polygon.js",
|
||||
"title": "circle vs polygon"
|
||||
},
|
||||
{
|
||||
"file": "group+vs+group.js",
|
||||
"title": "group vs group"
|
||||
@@ -134,10 +142,18 @@
|
||||
"file": "offset+bounding+box.js",
|
||||
"title": "offset bounding box"
|
||||
},
|
||||
{
|
||||
"file": "polygon+body.js",
|
||||
"title": "polygon body"
|
||||
},
|
||||
{
|
||||
"file": "process+callback.js",
|
||||
"title": "process callback"
|
||||
},
|
||||
{
|
||||
"file": "rotated+bounding+box.js",
|
||||
"title": "rotated bounding box"
|
||||
},
|
||||
{
|
||||
"file": "sprite+vs+group.js",
|
||||
"title": "sprite vs group"
|
||||
@@ -276,6 +292,10 @@
|
||||
"file": "circle.js",
|
||||
"title": "circle"
|
||||
},
|
||||
{
|
||||
"file": "line+intersection.js",
|
||||
"title": "line intersection"
|
||||
},
|
||||
{
|
||||
"file": "line.js",
|
||||
"title": "line"
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,125 @@
|
||||
Simple plain text exporter for demo purposes
|
||||
|
||||
See http://www.grantlee.org/apidox/for_themers.html for more information
|
||||
|
||||
Custom values (from the <bodies> section)
|
||||
Grav: 9.81
|
||||
|
||||
List of all bodies:
|
||||
|
||||
|
||||
Name: exocet_spaceman
|
||||
Custom values (from the <bodies> section):
|
||||
Identifier: 0
|
||||
FixedRotation: NO
|
||||
|
||||
AnchorPointRel: { 0.000,1.000 }
|
||||
AnchorPointAbs: { 0.000,175.000 }
|
||||
Size: { 153.000,175.000 }
|
||||
|
||||
List of all fixtures:
|
||||
|
||||
----------------------------------------------------------
|
||||
fixtureType: POLYGON
|
||||
|
||||
Box2D special values (only available if box2d is active):
|
||||
filter_groupIndex:
|
||||
filter_categoryBits:
|
||||
filter_maskBits:
|
||||
|
||||
Custom values (from the <fixtures> section):
|
||||
density: 2
|
||||
friction: 0
|
||||
restitution: 0
|
||||
isSensor: NO
|
||||
|
||||
|
||||
Hull polygon:
|
||||
(34, -172) , (75, -172) , (87, -145) , (121, -52) , (105, -16) , (55, -3) , (9, -19) , (1, -57) , (24, -145)
|
||||
|
||||
Convex sub polygons:
|
||||
|
||||
(75, -172) , (87, -145) , (121, -52) , (105, -16) , (55, -3) , (1, -57) , (24, -145) , (34, -172)
|
||||
(1, -57) , (55, -3) , (9, -19)
|
||||
|
||||
|
||||
|
||||
|
||||
Name: parsec
|
||||
Custom values (from the <bodies> section):
|
||||
Identifier: 0
|
||||
FixedRotation: NO
|
||||
|
||||
AnchorPointRel: { 0.000,1.000 }
|
||||
AnchorPointAbs: { 0.000,80.000 }
|
||||
Size: { 302.000,80.000 }
|
||||
|
||||
List of all fixtures:
|
||||
|
||||
----------------------------------------------------------
|
||||
fixtureType: POLYGON
|
||||
|
||||
Box2D special values (only available if box2d is active):
|
||||
filter_groupIndex:
|
||||
filter_categoryBits:
|
||||
filter_maskBits:
|
||||
|
||||
Custom values (from the <fixtures> section):
|
||||
density: 2
|
||||
friction: 0
|
||||
restitution: 0
|
||||
isSensor: NO
|
||||
|
||||
|
||||
Hull polygon:
|
||||
(56, -1) , (10, -5) , (1, -13) , (0, -34) , (55, -60) , (122, -78) , (165, -80) , (214, -74) , (285, -71) , (296, -44) , (298, -12) , (292, -5) , (168, -3)
|
||||
|
||||
Convex sub polygons:
|
||||
|
||||
(296, -44) , (298, -12) , (292, -5) , (168, -3) , (214, -74) , (285, -71)
|
||||
(0, -34) , (55, -60) , (122, -78) , (165, -80) , (168, -3) , (56, -1) , (10, -5) , (1, -13)
|
||||
(214, -74) , (168, -3) , (165, -80)
|
||||
|
||||
|
||||
|
||||
|
||||
Name: wasp
|
||||
Custom values (from the <bodies> section):
|
||||
Identifier: 0
|
||||
FixedRotation: NO
|
||||
|
||||
AnchorPointRel: { 0.000,1.000 }
|
||||
AnchorPointAbs: { 0.000,91.000 }
|
||||
Size: { 175.000,91.000 }
|
||||
|
||||
List of all fixtures:
|
||||
|
||||
----------------------------------------------------------
|
||||
fixtureType: POLYGON
|
||||
|
||||
Box2D special values (only available if box2d is active):
|
||||
filter_groupIndex:
|
||||
filter_categoryBits:
|
||||
filter_maskBits:
|
||||
|
||||
Custom values (from the <fixtures> section):
|
||||
density: 2
|
||||
friction: 0
|
||||
restitution: 0
|
||||
isSensor: NO
|
||||
|
||||
|
||||
Hull polygon:
|
||||
(62, -89) , (89, -85) , (173, -42) , (171, -32) , (116, -31) , (106, -2) , (93, -1) , (91, -22) , (52, -17) , (39, 0) , (28, -5) , (31, -25) , (21, -37) , (5, -41) , (0, -62) , (17, -68) , (18, -85) , (38, -90)
|
||||
|
||||
Convex sub polygons:
|
||||
|
||||
(17, -68) , (21, -37) , (5, -41) , (0, -62)
|
||||
(38, -90) , (62, -89) , (89, -85) , (173, -42) , (116, -31) , (21, -37) , (17, -68) , (18, -85)
|
||||
(91, -22) , (116, -31) , (106, -2) , (93, -1)
|
||||
(31, -25) , (52, -17) , (39, 0) , (28, -5)
|
||||
(21, -37) , (116, -31) , (91, -22) , (52, -17) , (31, -25)
|
||||
(116, -31) , (173, -42) , (171, -32)
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 482 B |
Binary file not shown.
|
After Width: | Height: | Size: 433 B |
Binary file not shown.
|
After Width: | Height: | Size: 395 B |
Binary file not shown.
|
After Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 16 KiB |
@@ -40,7 +40,7 @@ function update() {
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderPolygon(sprite.body.polygons, 'rgb(255,0,0)');
|
||||
game.debug.renderPolygon(sprite2.body.polygons, 'rgb(255,0,0)');
|
||||
game.debug.renderPhysicsBody(sprite.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
|
||||
@@ -17,9 +17,8 @@ function create() {
|
||||
sprite1 = game.add.sprite(150, 300, 'atari');
|
||||
sprite1.name = 'atari';
|
||||
|
||||
// This adjusts the collision body size to be 104 x 104.
|
||||
// See the offset bounding box for another example.
|
||||
sprite1.body.setSize(104, 104, 0, 0);
|
||||
// Here you can visually see the two bounding boxes the sprites are using for collision.
|
||||
|
||||
sprite1.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(700, 320, 'mushroom');
|
||||
@@ -30,7 +29,6 @@ function create() {
|
||||
|
||||
function update() {
|
||||
|
||||
// object1, object2, collideCallback, processCallback, callbackContext
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
@@ -45,7 +43,7 @@ function render() {
|
||||
|
||||
game.debug.renderBodyInfo(sprite1, 32, 32);
|
||||
|
||||
game.debug.renderPolygon(sprite1.body.polygons, 'rgb(255,0,0)');
|
||||
game.debug.renderPolygon(sprite2.body.polygons, 'rgb(255,0,0)');
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('wizball', 'assets/sprites/wizball.png');
|
||||
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
sprite1 = game.add.sprite(130, 250, 'wizball');
|
||||
|
||||
// Here we've replaced the sprites body with a circle instead of a rectangle
|
||||
// The value is the radius of the body in pixels
|
||||
|
||||
sprite1.body.setCircle(46);
|
||||
sprite1.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(700, 210, 'mushroom');
|
||||
sprite2.name = 'mushroom';
|
||||
sprite2.body.velocity.x = -100;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
|
||||
function collisionHandler (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderBodyInfo(sprite2, 32, 32);
|
||||
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('parsec', 'assets/sprites/parsec.png');
|
||||
game.load.image('wizball', 'assets/sprites/wizball.png');
|
||||
game.load.image('spaceman', 'assets/sprites/exocet_spaceman.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
var sprite3;
|
||||
var sprite4;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
game.physics.gravity.y = 100;
|
||||
|
||||
sprite1 = game.add.sprite(80, 200);
|
||||
sprite1.body.setPolygon(0,0, 60,0, 100,40, 60,80, 0,80);
|
||||
sprite1.body.translate(0, 144);
|
||||
sprite1.body.immovable = true;
|
||||
sprite1.body.allowGravity = false;
|
||||
|
||||
sprite2 = game.add.sprite(450, 300, 'parsec');
|
||||
sprite2.body.setPolygon(56, -1 , 10, -5 , 1, -13 , 0, -34 , 55, -60 , 122, -78 , 165, -80 , 214, -74 , 285, -71 , 296, -44 , 298, -12 , 292, -5 , 168, -3);
|
||||
sprite2.body.translate(0, 80);
|
||||
sprite2.body.immovable = true;
|
||||
sprite2.body.allowGravity = false;
|
||||
|
||||
sprite3 = game.add.sprite(230, 400, 'spaceman');
|
||||
sprite3.body.setPolygon(34, -172 , 75, -172 , 87, -145 , 121, -52 , 105, -16 , 55, -3 , 9, -19 , 1, -57 , 24, -145);
|
||||
sprite3.body.translate(0, 175);
|
||||
sprite3.body.immovable = true;
|
||||
sprite3.body.allowGravity = false;
|
||||
|
||||
sprite4 = game.add.sprite(380, 100, 'wizball');
|
||||
sprite4.body.setCircle(46);
|
||||
sprite4.body.collideWorldBounds = true;
|
||||
sprite4.body.friction = 0;
|
||||
sprite4.body.bounce.setTo(0.9, 0.9);
|
||||
sprite4.body.velocity.setTo(100, 100);
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.collideArray(sprite4, [ sprite1, sprite2, sprite3 ]);
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderBodyInfo(sprite4, 32, 32);
|
||||
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
game.debug.renderPhysicsBody(sprite3.body);
|
||||
game.debug.renderPhysicsBody(sprite4.body);
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update });
|
||||
|
||||
function preload() {
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ function create() {
|
||||
sprite1.name = 'atari';
|
||||
|
||||
// In this example the new collision box is much larger than the original sprite
|
||||
sprite1.body.setSize(400, 50, -100, 20);
|
||||
sprite1.body.setRectangle(400, 50, -100, 20);
|
||||
sprite1.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(700, 210, 'mushroom');
|
||||
@@ -30,7 +30,6 @@ function create() {
|
||||
|
||||
function update() {
|
||||
|
||||
// object1, object2, collideCallback, processCallback, callbackContext
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
@@ -45,7 +44,7 @@ function render() {
|
||||
|
||||
game.debug.renderBodyInfo(sprite1, 32, 32);
|
||||
|
||||
game.debug.renderPolygon(sprite1.body.polygons, 'rgb(255,0,0)');
|
||||
game.debug.renderPolygon(sprite2.body.polygons, 'rgb(255,0,0)');
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ function create() {
|
||||
|
||||
// This adjusts the collision body size to be a 100x50 box.
|
||||
// 50, 25 is the X and Y offset of the newly sized box.
|
||||
sprite1.body.setSize(100, 50, 50, 25);
|
||||
sprite1.body.setRectangle(100, 50, 50, 25);
|
||||
sprite1.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(700, 220, 'mushroom');
|
||||
@@ -31,7 +31,6 @@ function create() {
|
||||
|
||||
function update() {
|
||||
|
||||
// object1, object2, collideCallback, processCallback, callbackContext
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
@@ -46,7 +45,7 @@ function render() {
|
||||
|
||||
game.debug.renderBodyInfo(sprite1, 32, 32);
|
||||
|
||||
game.debug.renderPolygon(sprite1.body.polygons, 'rgb(255,0,0)');
|
||||
game.debug.renderPolygon(sprite2.body.polygons, 'rgb(255,0,0)');
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('parsec', 'assets/sprites/parsec.png');
|
||||
game.load.image('spaceman', 'assets/sprites/exocet_spaceman.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
// Here we've replaced the sprites body with a polygon.
|
||||
// The point data was generated by tracing the PNGs in Physics Editor: http://www.codeandweb.com/physicseditor
|
||||
|
||||
sprite1 = game.add.sprite(550, 250, 'parsec');
|
||||
sprite1.body.setPolygon(56, -1 , 10, -5 , 1, -13 , 0, -34 , 55, -60 , 122, -78 , 165, -80 , 214, -74 , 285, -71 , 296, -44 , 298, -12 , 292, -5 , 168, -3);
|
||||
sprite1.body.translate(0, 80);
|
||||
sprite1.body.velocity.x = -100;
|
||||
|
||||
sprite2 = game.add.sprite(0, 200, 'spaceman');
|
||||
sprite2.body.setPolygon(34, -172 , 75, -172 , 87, -145 , 121, -52 , 105, -16 , 55, -3 , 9, -19 , 1, -57 , 24, -145);
|
||||
sprite2.body.translate(0, 175);
|
||||
sprite2.body.velocity.x = 100;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
|
||||
function collisionHandler (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
|
||||
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });
|
||||
|
||||
function preload() {
|
||||
|
||||
game.load.image('atari', 'assets/sprites/atari130xe.png');
|
||||
game.load.image('mushroom', 'assets/sprites/mushroom2.png');
|
||||
|
||||
}
|
||||
|
||||
var sprite1;
|
||||
var sprite2;
|
||||
|
||||
function create() {
|
||||
|
||||
game.stage.backgroundColor = '#2d2d2d';
|
||||
|
||||
sprite1 = game.add.sprite(130, 200, 'atari');
|
||||
sprite1.name = 'atari';
|
||||
|
||||
// Here we're rotated both the sprite and the physics body
|
||||
|
||||
sprite1.rotation = 0.6;
|
||||
sprite1.body.polygon.rotate(0.6);
|
||||
sprite1.body.immovable = true;
|
||||
|
||||
sprite2 = game.add.sprite(700, 210, 'mushroom');
|
||||
sprite2.name = 'mushroom';
|
||||
sprite2.body.velocity.x = -100;
|
||||
|
||||
}
|
||||
|
||||
function update() {
|
||||
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
|
||||
function collisionHandler (obj1, obj2) {
|
||||
|
||||
game.stage.backgroundColor = '#992d2d';
|
||||
|
||||
}
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderBodyInfo(sprite1, 32, 32);
|
||||
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@ function create() {
|
||||
// This adjusts the collision body size.
|
||||
// 220x10 is the new width/height.
|
||||
// See the offset bounding box for another example.
|
||||
sprite1.body.setSize(220, 10, 0, 0);
|
||||
sprite1.body.setRectangle(220, 10, 0, 0);
|
||||
|
||||
sprite2 = game.add.sprite(400, 450, 'mushroom');
|
||||
sprite2.name = 'mushroom';
|
||||
@@ -32,7 +32,6 @@ function create() {
|
||||
|
||||
function update() {
|
||||
|
||||
// object1, object2, collideCallback, processCallback, callbackContext
|
||||
game.physics.collide(sprite1, sprite2, collisionHandler, null, this);
|
||||
|
||||
}
|
||||
@@ -45,10 +44,7 @@ function collisionHandler (obj1, obj2) {
|
||||
|
||||
function render() {
|
||||
|
||||
game.debug.renderSpriteInfo(sprite1, 32, 32);
|
||||
game.debug.renderSpriteCollision(sprite1, 400, 32);
|
||||
|
||||
game.debug.renderSpriteBody(sprite1);
|
||||
game.debug.renderSpriteBody(sprite2);
|
||||
game.debug.renderPhysicsBody(sprite1.body);
|
||||
game.debug.renderPhysicsBody(sprite2.body);
|
||||
|
||||
}
|
||||
|
||||
@@ -29,16 +29,10 @@ function create() {
|
||||
// Basically this sets EVERY SINGLE tile to fully collide on all faces
|
||||
map.setCollisionByExclusion([7, 32, 35, 36, 47]);
|
||||
|
||||
layer.debug = true;
|
||||
// layer.debug = true;
|
||||
|
||||
layer.resizeWorld();
|
||||
|
||||
sprite = game.add.sprite(450, 80, 'phaser');
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
|
||||
game.camera.follow(sprite);
|
||||
// game.camera.deadzone = new Phaser.Rectangle(160, 160, layer.renderWidth-320, layer.renderHeight-320);
|
||||
|
||||
cursors = game.input.keyboard.createCursorKeys();
|
||||
|
||||
emitter = game.add.emitter(0, 0, 200);
|
||||
@@ -49,15 +43,18 @@ function create() {
|
||||
emitter.gravity = 150;
|
||||
emitter.bounce.setTo(0.5, 0.5);
|
||||
|
||||
game.input.onDown.add(particleBurst, this);
|
||||
sprite = game.add.sprite(200, 70, 'phaser');
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
|
||||
game.camera.follow(sprite);
|
||||
|
||||
}
|
||||
|
||||
function particleBurst() {
|
||||
|
||||
emitter.x = game.input.worldX;
|
||||
emitter.y = game.input.worldY;
|
||||
emitter.start(true, 4000, null, 10);
|
||||
emitter.x = sprite.x;
|
||||
emitter.y = sprite.y;
|
||||
emitter.start(true, 2000, null, 1);
|
||||
|
||||
}
|
||||
|
||||
@@ -72,21 +69,25 @@ function update() {
|
||||
if (cursors.up.isDown)
|
||||
{
|
||||
sprite.body.velocity.y = -150;
|
||||
particleBurst();
|
||||
}
|
||||
else if (cursors.down.isDown)
|
||||
{
|
||||
sprite.body.velocity.y = 150;
|
||||
particleBurst();
|
||||
}
|
||||
|
||||
if (cursors.left.isDown)
|
||||
{
|
||||
sprite.body.velocity.x = -150;
|
||||
sprite.scale.x = -1;
|
||||
particleBurst();
|
||||
}
|
||||
else if (cursors.right.isDown)
|
||||
{
|
||||
sprite.body.velocity.x = 150;
|
||||
sprite.scale.x = 1;
|
||||
particleBurst();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ function update() {
|
||||
|
||||
// sprite.body.velocity.x = 0;
|
||||
// sprite.body.velocity.y = 0;
|
||||
// sprite.body.angularVelocity = 0;
|
||||
sprite.body.angularVelocity = 0;
|
||||
|
||||
// sprite.body.acceleration.x = 0;
|
||||
// sprite.body.angularAcceleration = 0;
|
||||
|
||||
@@ -29,7 +29,7 @@ function create() {
|
||||
// Basically this sets EVERY SINGLE tile to fully collide on all faces
|
||||
map.setCollisionByExclusion([7, 32, 35, 36, 47]);
|
||||
|
||||
layer.debug = true;
|
||||
// layer.debug = true;
|
||||
|
||||
layer.resizeWorld();
|
||||
|
||||
@@ -43,13 +43,10 @@ function create() {
|
||||
emitter.gravity = 150;
|
||||
emitter.bounce.setTo(0.5, 0.5);
|
||||
|
||||
sprite = game.add.sprite(450, 80, 'phaser');
|
||||
sprite = game.add.sprite(200, 70, 'phaser');
|
||||
sprite.anchor.setTo(0.5, 0.5);
|
||||
|
||||
game.camera.follow(sprite);
|
||||
// game.camera.deadzone = new Phaser.Rectangle(160, 160, layer.renderWidth-320, layer.renderHeight-320);
|
||||
|
||||
// game.input.onDown.add(particleBurst, this);
|
||||
|
||||
}
|
||||
|
||||
@@ -57,9 +54,6 @@ function particleBurst() {
|
||||
|
||||
emitter.x = sprite.x;
|
||||
emitter.y = sprite.y;
|
||||
// emitter.x = game.input.worldX;
|
||||
// emitter.y = game.input.worldY;
|
||||
// emitter.start(true, 4000, null, 10);
|
||||
emitter.start(true, 2000, null, 1);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user