Skip to content

Instantly share code, notes, and snippets.

@flushpot1125
Created September 6, 2020 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flushpot1125/2ccec5924e45391baac1c8e40f65d87a to your computer and use it in GitHub Desktop.
Save flushpot1125/2ccec5924e45391baac1c8e40f65d87a to your computer and use it in GitHub Desktop.
import {addScore} from "./HUD";
//part of full code
export default class block extends Mesh {
public onUpdate(): void {
if ((this.intersectsMesh(this._ball)) && this.callFlag== false){
this.callFlag=true;
this.blockDispose();
}
}
private async blockDispose():Promise<void>{
const sleep = (second) => new Promise(resolve => setTimeout(resolve, second ));
await sleep(200);
this.dispose();
addScore();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment