$.makeBoxCollider( x, y, w, h)

Returns a box collider

  • x : number //Horizontal Position
  • y : number //Vertical Position
  • w : number //width of the new collider
  • h : number //height of the new collider

Examples


const example = $.makeBoxCollider(0,$.h/2,50,50);
function update() {
    example.x += 1;
    if(example.x > $.w) {
    example.x = 0;
}
example.draw();
}