SimpleRectCollisor - HermesPasser/Ramu GitHub Wiki
class SimpleRectCollisor: Collisor
Description
Rectangle collisor.
Constructor Parameters
intx: Position in x.inty: Position in y.intwidth: Width.intheight: Height.
let rec = new SimpleRectCollisor(10, 10, 100, 100);
You can test this snippet of code here.
Ramu.init();
Ramu.debugMode = true;
let rec1 = new SimpleRectCollisor(10, 15, 100, 100);
let rec2 = new SimpleRectCollisor(15, 10, 50, 50);
new GameObj().update = function(){
if (keyCode.space in Ramu.lastKeysPressed){
rec1 .canCollide = !rec1.canCollide;
}
};