本文整理汇总了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");
}