@@ -218,89 +218,6 @@ module Phaser.Physics {
218218 return this . position . y - this . oldPosition . y ;
219219 }
220220
221-
222-
223-
224-
225-
226-
227-
228-
229-
230- // MOVE THESE TO A UTIL
231-
232- public render ( context :CanvasRenderingContext2D ) {
233-
234- context . beginPath ( ) ;
235- context . strokeStyle = 'rgb(0,255,0)' ;
236- context . strokeRect ( this . position . x - this . bounds . halfWidth , this . position . y - this . bounds . halfHeight , this . bounds . width , this . bounds . height ) ;
237- context . stroke ( ) ;
238- context . closePath ( ) ;
239-
240- // center point
241- context . fillStyle = 'rgb(0,255,0)' ;
242- context . fillRect ( this . position . x , this . position . y , 2 , 2 ) ;
243-
244- if ( this . touching & Phaser . Types . LEFT )
245- {
246- context . beginPath ( ) ;
247- context . strokeStyle = 'rgb(255,0,0)' ;
248- context . moveTo ( this . position . x - this . bounds . halfWidth , this . position . y - this . bounds . halfHeight ) ;
249- context . lineTo ( this . position . x - this . bounds . halfWidth , this . position . y + this . bounds . halfHeight ) ;
250- context . stroke ( ) ;
251- context . closePath ( ) ;
252- }
253- if ( this . touching & Phaser . Types . RIGHT )
254- {
255- context . beginPath ( ) ;
256- context . strokeStyle = 'rgb(255,0,0)' ;
257- context . moveTo ( this . position . x + this . bounds . halfWidth , this . position . y - this . bounds . halfHeight ) ;
258- context . lineTo ( this . position . x + this . bounds . halfWidth , this . position . y + this . bounds . halfHeight ) ;
259- context . stroke ( ) ;
260- context . closePath ( ) ;
261- }
262-
263- if ( this . touching & Phaser . Types . UP )
264- {
265- context . beginPath ( ) ;
266- context . strokeStyle = 'rgb(255,0,0)' ;
267- context . moveTo ( this . position . x - this . bounds . halfWidth , this . position . y - this . bounds . halfHeight ) ;
268- context . lineTo ( this . position . x + this . bounds . halfWidth , this . position . y - this . bounds . halfHeight ) ;
269- context . stroke ( ) ;
270- context . closePath ( ) ;
271- }
272- if ( this . touching & Phaser . Types . DOWN )
273- {
274- context . beginPath ( ) ;
275- context . strokeStyle = 'rgb(255,0,0)' ;
276- context . moveTo ( this . position . x - this . bounds . halfWidth , this . position . y + this . bounds . halfHeight ) ;
277- context . lineTo ( this . position . x + this . bounds . halfWidth , this . position . y + this . bounds . halfHeight ) ;
278- context . stroke ( ) ;
279- context . closePath ( ) ;
280- }
281-
282- }
283-
284-
285- /**
286- * Render debug infos. (including name, bounds info, position and some other properties)
287- * @param x {number} X position of the debug info to be rendered.
288- * @param y {number} Y position of the debug info to be rendered.
289- * @param [color] {number} color of the debug info to be rendered. (format is css color string)
290- */
291- public renderDebugInfo ( x : number , y : number , color : string = 'rgb(255,255,255)' ) {
292-
293- this . sprite . texture . context . fillStyle = color ;
294- this . sprite . texture . context . fillText ( 'Sprite: (' + this . sprite . width + ' x ' + this . sprite . height + ')' , x , y ) ;
295- //this.sprite.texture.context.fillText('x: ' + this._sprite.frameBounds.x.toFixed(1) + ' y: ' + this._sprite.frameBounds.y.toFixed(1) + ' rotation: ' + this._sprite.rotation.toFixed(1), x, y + 14);
296- this . sprite . texture . context . fillText ( 'x: ' + this . bounds . x . toFixed ( 1 ) + ' y: ' + this . bounds . y . toFixed ( 1 ) + ' rotation: ' + this . sprite . transform . rotation . toFixed ( 0 ) , x , y + 14 ) ;
297- this . sprite . texture . context . fillText ( 'vx: ' + this . velocity . x . toFixed ( 1 ) + ' vy: ' + this . velocity . y . toFixed ( 1 ) , x , y + 28 ) ;
298- this . sprite . texture . context . fillText ( 'acx: ' + this . acceleration . x . toFixed ( 1 ) + ' acy: ' + this . acceleration . y . toFixed ( 1 ) , x , y + 42 ) ;
299- this . sprite . texture . context . fillText ( 'angVx: ' + this . angularVelocity . toFixed ( 1 ) + ' angAc: ' + this . angularAcceleration . toFixed ( 1 ) , x , y + 56 ) ;
300-
301- }
302-
303-
304221 }
305222
306223}
0 commit comments