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 aliveboolean 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 anchorPhaser.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 anglenumber 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 autoCullboolean -
body
-
- Source:
Properties:
Name Type Description bodyPhaser.Physics.Arcade.Body Set-up the physics body.
-
bottomLeft
-
- Source:
Properties:
Name Type Description bottomLeftPhaser.Point Description.
-
bottomRight
-
- Source:
Properties:
Name Type Description bottomRightPhaser.Point Description.
-
bounds
-
- Source:
Properties:
Name Type Description boundsPhaser.Rectangle Description.
-
center
-
- Source:
Properties:
Name Type Description centerPhaser.Point Description.
-
events
-
- Source:
Properties:
Name Type Description eventsEvents 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 existsboolean 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 fixedToCameraboolean Fixes this Sprite to the Camera.
-
game
-
- Source:
Properties:
Name Type Description gamePhaser.Game A reference to the currently running Game.
-
group
-
- Default Value:
- null
- Source:
Properties:
Name Type Description groupDescription Description.
-
inWorld
-
- Source:
Properties:
Name Type Description inWorldDescription World bounds check.
-
inWorldThreshold
-
- Default Value:
- 0
- Source:
Properties:
Name Type Description inWorldThresholdnumber World bounds check.
-
key
-
- Source:
Properties:
Name Type Description keyDescription 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 lifespannumber -
name
-
- Source:
Properties:
Name Type Description namestring The user defined name given to this Sprite.
-
offset
-
- Source:
Properties:
Name Type Description offsetPhaser.Point Corner point defaults.
-
outOfBoundsKill
-
- Default Value:
- false
- Source:
Properties:
Name Type Description outOfBoundsKillboolean Kills this sprite as soon as it goes outside of the World bounds.
-
renderOrderID
-
- Source:
Properties:
Name Type Description renderOrderIDnumber Description.
-
scale
-
- Source:
Properties:
Name Type Description scalePhaser.Point Replaces the PIXI.Point with a slightly more flexible one.
-
topLeft
-
- Source:
Properties:
Name Type Description topLeftPhaser.Point Description.
-
topRight
-
- Source:
Properties:
Name Type Description topRightPhaser.Point Description.
-
type
-
- Source:
Properties:
Name Type Description typeDescription Description.
-
x
-
- Source:
Properties:
Name Type Description xnumber Description.
-
y
-
- Source:
Properties:
Name Type Description ynumber Description.
Methods
-
bringToTop()
-
Description.
- Source:
-
destroy()
-
Description.
- Source:
-
getLocalPosition(p, x, y) → {Description}
-
Description.
Parameters:
Name Type Description pDescription Description.
xnumber Description.
ynumber Description.
- Source:
Returns:
Description.
- Type
- Description
-
kill()
-
Description.
- Source:
-
revive()
-
Description.
- Source: