Spritesheet.setSheet - HermesPasser/Ramu GitHub Wiki

Spritesheet.setSheet()

Description

Set the sheet of the Spritesheet position.

You can test this snippet of code here.

let img = Ramu.Utils.getImage("https://i.imgur.com/E0Z8YMr.png");
let rec = new Rect(0, 50, 59, 20);
let sh = new Spritesheet(img, rec, 10, 10, 59, 50, true);

sh.update = function(){
   if (keyCode.w in Ramu.lastKeysPressed){
      this.setSheet(new Rect(0,0,59,70));
   }
};