移动类至es模块

This commit is contained in:
YHH
2020-07-23 09:10:27 +08:00
parent 15c0844e29
commit 814234ca61
20 changed files with 1101 additions and 998 deletions
@@ -1,37 +1,37 @@
///<reference path="./TiledSpriteRenderer.ts"/>
class ScrollingSpriteRenderer extends TiledSpriteRenderer {
public scrollSpeedX = 15;
public scroolSpeedY = 0;
private _scrollX = 0;
private _scrollY = 0;
module es {
export class ScrollingSpriteRenderer extends TiledSpriteRenderer {
public scrollSpeedX = 15;
public scroolSpeedY = 0;
private _scrollX = 0;
private _scrollY = 0;
public update(){
this._scrollX += this.scrollSpeedX * Time.deltaTime;
this._scrollY += this.scroolSpeedY * Time.deltaTime;
this.sourceRect.x = this._scrollX;
this.sourceRect.y = this._scrollY;
public update(){
this._scrollX += this.scrollSpeedX * Time.deltaTime;
this._scrollY += this.scroolSpeedY * Time.deltaTime;
this.sourceRect.x = this._scrollX;
this.sourceRect.y = this._scrollY;
}
public render(camera: Camera) {
if (!this.sprite)
return;
super.render(camera);
let renderTexture = new egret.RenderTexture();
let cacheBitmap = new egret.DisplayObjectContainer();
cacheBitmap.removeChildren();
cacheBitmap.addChild(this.leftTexture);
cacheBitmap.addChild(this.rightTexture);
this.leftTexture.x = this.sourceRect.x;
this.rightTexture.x = this.sourceRect.x - this.sourceRect.width;
this.leftTexture.y = this.sourceRect.y;
this.rightTexture.y = this.sourceRect.y;
cacheBitmap.cacheAsBitmap = true;
renderTexture.drawToTexture(cacheBitmap, new egret.Rectangle(0, 0, this.sourceRect.width, this.sourceRect.height));
}
}
public render(camera: Camera) {
if (!this.sprite)
return;
super.render(camera);
let renderTexture = new egret.RenderTexture();
let cacheBitmap = new egret.DisplayObjectContainer();
cacheBitmap.removeChildren();
cacheBitmap.addChild(this.leftTexture);
cacheBitmap.addChild(this.rightTexture);
this.leftTexture.x = this.sourceRect.x;
this.rightTexture.x = this.sourceRect.x - this.sourceRect.width;
this.leftTexture.y = this.sourceRect.y;
this.rightTexture.y = this.sourceRect.y;
cacheBitmap.cacheAsBitmap = true;
renderTexture.drawToTexture(cacheBitmap, new egret.Rectangle(0, 0, this.sourceRect.width, this.sourceRect.height));
this.bitmap.texture = renderTexture;
}
}
}