Question about runtime function

  • I'm trying to use the function

    runtime.testAndSelectCanvasPointOverlap(type, x, y, inverted)

    to test if a point is overlapping a solid. I'm having trouble with not knowing what is returned by this function and referencing the type variable.

    I gave up on using this function and used

    runtime.testOverlapSolid(inst)

    But this seems the wrong way to go about this.

    Any Help

  • var loccnt = 0;

    this.inst.y += this.Mazenavdistance;

    this.inst.set_bbox_changed();

    var collobj = this.runtime.testOverlapSolid(this.inst);

    if ( collobj )

    {

        loccnt += 1;

    }

    this.inst.y -= (this.Mazenavdistance*2);

    this.inst.set_bbox_changed();

    var collobj = this.runtime.testOverlapSolid(this.inst);

    if ( collobj )

    {

        loccnt += 2;

    }

    this.inst.y += this.Mazenavdistance;

    this.inst.x += this.Mazenavdistance;

    this.inst.set_bbox_changed();

    var collobj = this.runtime.testOverlapSolid(this.inst);

    if ( collobj )

    {

        loccnt += 4;

    }

    this.inst.x -= (this.Mazenavdistance*2);

    this.inst.set_bbox_changed();

    var collobj = this.runtime.testOverlapSolid(this.inst);

    if ( collobj )

    {

        loccnt += 8;

    }

    this.inst.x += this.Mazenavdistance;

    this.inst.set_bbox_changed();

    This is the code i'm using to check if there is a solid object in the up, down, right, and left direction. It seems slow to actually have to move the object to the location and then check to see if its overlapping. I would like to use the

    runtime.testAndSelectCanvasPointOverlap function, but every attempt has failed(javascript error). I did look at the mouse plugin, but it didn't help me solve the problem.

    Any help

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You should not use testAndSelectCanvasPointOverlap. It is used internally and modifies the picked objects, which you probably don't want to do. Moving an object then testing for collisions is fine; that's how the Platform behavior works.

  • Ashley

    Thank You

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)