corvex seine sachen drauf + hitmarker test
This commit is contained in:
40
ReallifeGamemode.Client/util/hitmarker.ts
Normal file
40
ReallifeGamemode.Client/util/hitmarker.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
class HitObject {
|
||||
amount: number;
|
||||
position: Vector3Mp;
|
||||
count: number = 0;
|
||||
|
||||
constructor(amount: number, position: Vector3Mp) {
|
||||
this.amount = amount;
|
||||
this.position = position;
|
||||
}
|
||||
}
|
||||
|
||||
class HitText {
|
||||
list: HitObject[] = [];
|
||||
|
||||
add(amount: number, position: Vector3Mp) {
|
||||
this.list.push(new HitObject(amount, position));
|
||||
}
|
||||
|
||||
render() {
|
||||
this.list.forEach((element: HitObject) => {
|
||||
|
||||
mp.game.graphics.drawText(element.amount.toString(), [element.position.x, element.position.y, element.position.z + 1.4], { font: 2, centre: true, color: [255, 255, 255, 155 - element.count], scale: [0.3, 0.3], outline: true });
|
||||
element.count += 3;
|
||||
element.position.z += 0.03;
|
||||
|
||||
if (element.count > 155) {
|
||||
var find = Hits.list.findIndex(elemen => elemen == element);
|
||||
|
||||
Hits.list.splice(find, 1);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var Hits = new HitText();
|
||||
|
||||
mp.events.add(RageEnums.EventKey.RENDER, () => {
|
||||
Hits.render();
|
||||
});
|
||||
Reference in New Issue
Block a user