Spritesheet.setPosition - HermesPasser/Ramu GitHub Wiki

Spritesheet.setPosition()

Description

Set 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 (!Ramu.Utils.isEmpty(Ramu.lastKeysPressed)){
      this.setPosition(this.x + 20, this.y + 20);
   }
};