SimpleRectCollisor - HermesPasser/Ramu GitHub Wiki

class SimpleRectCollisor: Collisor

Description

Rectangle collisor.

Constructor Parameters

  • int x: Position in x.
  • int y: Position in y.
  • int width: Width.
  • int height: 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;
   }
};

Inherited Members