0 Favourites

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

  • 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.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Ashley

    Thank You

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
353 32,095
yojona's avatar
yojona
Unread sticky
192 1,337,445
Kyatric's avatar
Kyatric Construct Team Support
Unread hot topic
59 6,792
BUGStudio's avatar
BUGStudio