You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/gameobjects/blitter/Blitter.js
+99-11Lines changed: 99 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,6 @@ var DisplayList = require('../DisplayList');
6
6
varFrame=require('../../textures/Frame');
7
7
varGameObject=require('../GameObject');
8
8
9
-
/**
10
-
* A Blitter Game Object.
11
-
*
12
-
* The Blitter Game Object is a special type of Container, that contains Blitter.Bob objects.
13
-
* These objects can be thought of as just texture frames with a position and nothing more.
14
-
* Bobs don't have any update methods, or the ability to have children, or any kind of special effects.
15
-
* They are essentially just super-fast texture frame renderers, and the Blitter object creates and manages them.
16
-
*/
17
-
18
9
varBlitter=newClass({
19
10
20
11
Extends: GameObject,
@@ -33,22 +24,70 @@ var Blitter = new Class({
33
24
34
25
initialize:
35
26
27
+
/**
28
+
* A Blitter Game Object.
29
+
*
30
+
* The Blitter Game Object is a special type of Container, that contains Blitter.Bob objects.
31
+
* These objects can be thought of as just texture frames with a position and nothing more.
32
+
* Bobs don't have any update methods, or the ability to have children, or any kind of special effects.
33
+
* They are essentially just super-fast texture frame renderers, and the Blitter object creates and manages them.
34
+
*
35
+
* @class Blitter
36
+
* @extends Phaser.GameObjects.GameObject
37
+
* @memberOf Phaser.GameObjects
38
+
* @constructor
39
+
* @since 3.0.0
40
+
*
41
+
* @mixes Phaser.GameObjects.Components.Alpha
42
+
*
43
+
* @param {Phaser.Scene} scene - The Scene to which this Game Object belongs. It can only belong to one Scene at any given time.
44
+
* @param {number} [x==] - The x coordinate of this Game Object in world space.
45
+
* @param {number} [y=0] - The y coordinate of this Game Object in world space.
46
+
* @param {string} [texture='__DEFAULT'] - The key of the texture this Game Object will use for rendering. The Texture must already exist in the Texture Manager.
47
+
* @param {string|integer} [frame=0] - The Frame of the Texture that this Game Object will use. Only set if the Texture has multiple frames, such as a Texture Atlas or Sprite Sheet.
48
+
*/
36
49
functionBlitter(scene,x,y,texture,frame)
37
50
{
38
51
GameObject.call(this,scene,'Blitter');
39
52
40
53
this.setTexture(texture,frame);
54
+
41
55
this.setPosition(x,y);
42
56
57
+
/**
58
+
* [description]
59
+
*
60
+
* @property {Phaser.GameObjects.DisplayList} children
61
+
* @since 3.0.0
62
+
*/
43
63
this.children=newDisplayList();
44
64
65
+
/**
66
+
* [description]
67
+
*
68
+
* @property {array} renderList
69
+
* @default []
70
+
* @since 3.0.0
71
+
*/
45
72
this.renderList=[];
46
73
47
74
this.dirty=false;
48
75
},
49
76
50
-
// frame MUST be part of the Blitter texture
51
-
// and can be either a Frame object or a string
77
+
/**
78
+
* [description]
79
+
*
80
+
* @method Phaser.GameObjects.Blitter#create
81
+
* @since 3.0.0
82
+
*
83
+
* @param {number} x - The x position of the Bob. Bob coordinate are relative to the position of the Blitter object.
84
+
* @param {number} y - The y position of the Bob. Bob coordinate are relative to the position of the Blitter object.
85
+
* @param {string|integer|Phaser.Textures.Frame} [frame] - The Frame the Bob will use. It _must_ be part of the Texture the parent Blitter object is using.
86
+
* @param {boolean} [visible=true] - Should the created Bob render or not?
87
+
* @param {integer} [index] - The position in the Blitters Display List to add the new Bob at. Defaults to the top of the list.
88
+
*
89
+
* @return {Phaser.GameObjects.Blitter.Bob} The newly created Bob object.
* @param {float} [topLeft=1] - The alpha value used for the top-left of the Game Object. If this is the only value given it's applied across the whole Game Object.
44
+
* @param {float} [topRight] - The alpha value used for the top-right of the Game Object.
45
+
* @param {float} [bottomLeft] - The alpha value used for the bottom-left of the Game Object.
46
+
* @param {float} [bottomRight] - The alpha value used for the bottom-right of the Game Object.
47
+
*
48
+
* @return {Phaser.GameObjects.GameObject} This Game Object instance.
0 commit comments