本文整理匯總了TypeScript中athenajs.SimpleText類的典型用法代碼示例。如果您正苦於以下問題:TypeScript SimpleText類的具體用法?TypeScript SimpleText怎麽用?TypeScript SimpleText使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了SimpleText類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: SimpleText
import { SimpleText } from 'athenajs';
const myText: SimpleText = new SimpleText('MyText', {
text: 'yop',
width: 100,
height: 200,
fontFace: 'Arial',
fontSize: '20px',
fontStyle: 'italic',
fontWeight: '300',
align: 'center',
color: 'white'
});
myText.setSize(100, 200);
myText.setText('Hi!');
myText.setColor('rgba(0,0,0,.4');
示例2: increaseScore
/**
* Updates the player's score using line number & current level
*
*/
increaseScore(lines: number) {
this.score +=
this.scoreTable[lines - 1] + this.level * this.scoreTable[lines - 1];
this.lines += lines;
this.linesString.setText("Lines: " + this.lines);
this.scoreString.setText("Score: " + this.score);
if (lines === 4) {
AM.play("lines_tetris");
} else {
AM.play("lines");
}
}
示例3: reset
reset() {
this.score = 0;
this.level = 0;
this.lines = 0;
this.timing = START_TIMING;
this.resetMap();
this.shape.moveToTop();
this.shape.setRandomShape();
this.nextShape.setRandomShape();
this.linesString.setText("Lines: " + this.lines);
this.scoreString.setText("Score: " + this.score);
this.levelString.setText("Level: " + this.level);
this.shape.movable = true;
this.shape.behavior.reset();
}
示例4: updateLevel
/**
* Updates level + level object's text
*/
updateLevel() {
const oldLevel = this.level;
this.level = Math.floor(this.lines / 10);
this.levelString.setText("Level: " + this.level);
this.timing = START_TIMING - this.level * LEVEL_TIMING;
this.shape.data['speed'] = this.timing;
oldLevel !== this.level && AM.play("level");
}