GameObj.destroy - HermesPasser/Ramu GitHub Wiki

GameObj.destroy()

Description

Remove the GameObj from the game loop.

Note: if the start method was not called then this will do nothing.

You can test this snippet of code here.

let txt = new Text("not destroyed", 10, 10, 100);
let time = 0;

new GameObj().update = function(){
   if (time > 5){
      txt.destroy();
   }
   time += Ramu.time.delta;
};

Ramu.init();