Notice: Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.0.) in /home/wcc1969/public_html/phasergames.com/wp-includes/functions.php on line 6085
Notice: Function wpdb::prepare was called incorrectly. The query does not contain the correct number of placeholders (0) for the number of arguments passed (1). Please see Debugging in WordPress for more information. (This message was added in version 4.8.3.) in /home/wcc1969/public_html/phasergames.com/wp-includes/functions.php on line 6085
Warning: Undefined variable $output in /home/wcc1969/public_html/phasergames.com/wp-content/plugins/wc_snippets/snippets.php on line 110
Physic Object
Description:This is a config file example to pass to the game object
Example:var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
parent: 'phaser-example',
physics: {
default: 'arcade',
arcade: {
gravity: { y: 0 },
debug: true
}
},
scene: {
preload: preload,
create: create,
update: update
}
};
Add physics sprite
Description:adds a sprite for which physics will be applied
Example:this.physics.add.image(400, 300, 'ball');
set velocity
Description:set velocity for a sprite
Example:sprite.setVelocity(100, 200)
set bounce
Description:sets the bounce for a sprite
Example:sprite.setBounce(1, 1);
collide with world bounds
Description:will collide with sides of game if set to true
Example:sprite.setCollideWorldBounds(true);
set gravity
Description:sets the gravity on a sprite
Example:sprite.setGravityY(200);
set collider
Description:allows a group and a sprite to collide with each other
Example:this.physics.add.collider(sprite, group);
set immovable
Description:sets a sprite to not move when a collision occurs. Great for floors and walls.
Example:sprite.setImmovable();
collision function
Description:calls a function when two objects collide
Example:this.physics.world.collide(wall, char, this.hitTheWall);
Move to
Description:moves an object to a target location
Example:moveTo(gameObject, x, y [, speed] [, maxTime])
Accelerate To
Description:accelerates an object to a target location
Example:accelerateTo(gameObject, x, y [, speed] [, xSpeedMax] [, ySpeedMax])
Convert Radians to Angles
Description:converts radians to degrees
Example:angle * (180 / Math.PI);
set camera size
Description:sets the size of the camera's view
Example:this.cameras.main.setBounds(0, 0, w, h);
Camera follow
Description:has the camera follow the game object
Example:this.cameras.main.startFollow(gameObject, true);
get x and y from angle
Description:gets and x and y direction from an angle
Example: var rads = this.ship.angle*Math.PI/180;
var tx = Math.cos(rads);
var ty = Math.sin(rads);
add a group of objects
Description:gets and x and y direction from an angle
Example:this.myGroup= this.physics.add.group({
key: 'key',
frame: [0,1,2],
frameQuantity: 20,
bounceX: 1,
bounceY: 1,
angularVelocity: 1,
collideWorldBounds: true
});
degrees to radians
Description:converts degrees to radians
Example:radians=degrees*Math.PI/180;
direction from angle
Description:converts degrees to radians
Example:radians=degrees*Math.PI/180;
var tx = Math.cos(radians);
var ty = Math.sin(radians);