Class: Bullet

Phaser. Bullet

Phaser.Bullet

new Bullet(game, x, y, key, frame)

Warning: Bullet is an experimental object that we don't advise using for now.

A Bullet is like a stripped-down Sprite, useful for when you just need to get something moving around the screen quickly with little of the extra features that a Sprite supports. Bullet is MISSING the following:

animation, all input events, crop support, health/damage, loadTexture

Parameters:
Name Type Description
game Phaser.Game

Current game instance.

x number

X position of the new bullet.

y number

Y position of the new bullet.

key string | Phaser.RenderTexture | PIXI.Texture

This is the image or texture used by the Sprite during rendering. It can be a string which is a reference to the Cache entry, or an instance of a RenderTexture or PIXI.Texture.

frame string | number

If this Sprite is using part of a sprite sheet or texture atlas you can specify the exact frame to use by giving a string or numeric index.

Source:

Members

alive

Properties:
Name Type Description
alive boolean

This is a handy little var your game can use to determine if a sprite is alive or not, it doesn't effect rendering.

Default Value:
  • true
Source:

anchor

The anchor sets the origin point of the texture. The default is 0,0 this means the textures origin is the top left Setting than anchor to 0.5,0.5 means the textures origin is centered Setting the anchor to 1,1 would mean the textures origin points will be the bottom right

Properties:
Name Type Description
anchor Phaser.Point
Source:

angle

Indicates the rotation of the Bullet, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation. Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90. If you wish to work in radians instead of degrees use the property Bullet.rotation instead.

Properties:
Name Type Description
angle number

Gets or sets the Bullets angle of rotation in degrees.

Source:

autoCull

Should this Sprite be automatically culled if out of range of the camera? A culled sprite has its visible property set to 'false'. Note that this check doesn't look at this Sprites children, which may still be in camera range. So you should set autoCull to false if the Sprite will have children likely to still be in camera range.

Properties:
Name Type Description
autoCull boolean
Default Value:
  • false
Source:

body

Properties:
Name Type Description
body Phaser.Physics.Arcade.Body

Set-up the physics body.

Source:

bottomLeft

Properties:
Name Type Description
bottomLeft Phaser.Point

Description.

Source:

bottomRight

Properties:
Name Type Description
bottomRight Phaser.Point

Description.

Source:

bounds

Properties:
Name Type Description
bounds Phaser.Rectangle

Description.

Source:

center

Properties:
Name Type Description
center Phaser.Point

Description.

Source:

events

Properties:
Name Type Description
events Events

The Signals you can subscribe to that are dispatched when certain things happen on this Sprite or its components

Source:

exists

Properties:
Name Type Description
exists boolean

If exists = false then the Sprite isn't updated by the core game loop or physics subsystem at all.

Default Value:
  • true
Source:

fixedToCamera

A Sprite that is fixed to the camera ignores the position of any ancestors in the display list and uses its x/y coordinates as offsets from the top left of the camera.

Properties:
Name Type Description
fixedToCamera boolean

Fixes this Sprite to the Camera.

Default Value:
  • false
Source:

game

Properties:
Name Type Description
game Phaser.Game

A reference to the currently running Game.

Source:

group

Properties:
Name Type Description
group Description

Description.

Default Value:
  • null
Source:

inWorld

Properties:
Name Type Description
inWorld Description

World bounds check.

Source:

inWorldThreshold

Properties:
Name Type Description
inWorldThreshold number

World bounds check.

Default Value:
  • 0
Source:

key

Properties:
Name Type Description
key Description

Description.

Source:

lifespan

If you would like the Sprite to have a lifespan once 'born' you can set this to a positive value. Handy for particles, bullets, etc. The lifespan is decremented by game.time.elapsed each update, once it reaches zero the kill() function is called.

Properties:
Name Type Description
lifespan number
Default Value:
  • 0
Source:

name

Properties:
Name Type Description
name string

The user defined name given to this Sprite.

Source:

offset

Properties:
Name Type Description
offset Phaser.Point

Corner point defaults.

Source:

outOfBoundsKill

Properties:
Name Type Description
outOfBoundsKill boolean

Kills this sprite as soon as it goes outside of the World bounds.

Default Value:
  • false
Source:

renderOrderID

Properties:
Name Type Description
renderOrderID number

Description.

Source:

scale

Properties:
Name Type Description
scale Phaser.Point

Replaces the PIXI.Point with a slightly more flexible one.

Source:

topLeft

Properties:
Name Type Description
topLeft Phaser.Point

Description.

Source:

topRight

Properties:
Name Type Description
topRight Phaser.Point

Description.

Source:

type

Properties:
Name Type Description
type Description

Description.

Source:

x

Properties:
Name Type Description
x number

Description.

Source:

y

Properties:
Name Type Description
y number

Description.

Source:

Methods

bringToTop()

Description.

Source:

destroy()

Description.

Source:

getLocalPosition(p, x, y) → {Description}

Description.

Parameters:
Name Type Description
p Description

Description.

x number

Description.

y number

Description.

Source:
Returns:

Description.

Type
Description

kill()

Description.

Source:

revive()

Description.

Source:
Phaser Copyright © 2012-2013 Photon Storm Ltd.
Documentation generated by JSDoc 3.3.0-dev on Fri Oct 25 2013 17:05:25 GMT+0100 (BST) using the DocStrap template.