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
-
- Default Value:
- true
- Source:
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.
-
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
- Source:
Properties:
Name Type Description anchor
Phaser.Point -
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.
- Source:
Properties:
Name Type Description angle
number Gets or sets the Bullets angle of rotation in degrees.
-
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.
- Default Value:
- false
- Source:
Properties:
Name Type Description autoCull
boolean -
body
-
- Source:
Properties:
Name Type Description body
Phaser.Physics.Arcade.Body Set-up the physics body.
-
bottomLeft
-
- Source:
Properties:
Name Type Description bottomLeft
Phaser.Point Description.
-
bottomRight
-
- Source:
Properties:
Name Type Description bottomRight
Phaser.Point Description.
-
bounds
-
- Source:
Properties:
Name Type Description bounds
Phaser.Rectangle Description.
-
center
-
- Source:
Properties:
Name Type Description center
Phaser.Point Description.
-
events
-
- Source:
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
-
exists
-
- Default Value:
- true
- Source:
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.
-
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.
- Default Value:
- false
- Source:
Properties:
Name Type Description fixedToCamera
boolean Fixes this Sprite to the Camera.
-
game
-
- Source:
Properties:
Name Type Description game
Phaser.Game A reference to the currently running Game.
-
group
-
- Default Value:
- null
- Source:
Properties:
Name Type Description group
Description Description.
-
inWorld
-
- Source:
Properties:
Name Type Description inWorld
Description World bounds check.
-
inWorldThreshold
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description inWorldThreshold
number World bounds check.
-
key
-
- Source:
Properties:
Name Type Description key
Description Description.
-
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.
- Default Value:
- 0
- Source:
Properties:
Name Type Description lifespan
number -
name
-
- Source:
Properties:
Name Type Description name
string The user defined name given to this Sprite.
-
offset
-
- Source:
Properties:
Name Type Description offset
Phaser.Point Corner point defaults.
-
outOfBoundsKill
-
- Default Value:
- false
- Source:
Properties:
Name Type Description outOfBoundsKill
boolean Kills this sprite as soon as it goes outside of the World bounds.
-
renderOrderID
-
- Source:
Properties:
Name Type Description renderOrderID
number Description.
-
scale
-
- Source:
Properties:
Name Type Description scale
Phaser.Point Replaces the PIXI.Point with a slightly more flexible one.
-
topLeft
-
- Source:
Properties:
Name Type Description topLeft
Phaser.Point Description.
-
topRight
-
- Source:
Properties:
Name Type Description topRight
Phaser.Point Description.
-
type
-
- Source:
Properties:
Name Type Description type
Description Description.
-
x
-
- Source:
Properties:
Name Type Description x
number Description.
-
y
-
- Source:
Properties:
Name Type Description y
number Description.
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: