Object's Custom-Made Boundaries Not Working

  • .c3p file: dropbox.com/s/o0wuhllutq7uxsr/The%20Getaway%20v3.c3p

    I have a 3-object enemy (by way of a container) which is meant to patrol a designated area, marked by another object, the "District_Area".

    Using the Bullet behavior, I make the Enemy_Heli_Move object (contained with the Enemy_Heli_Blade and Enemy_Heli objects and pinned together) patrol the designated District_Area. At the start of the layout, I assign the District_Area UID # to an instance variable in Enemy_Heli_Move object.

    I then pick the District_Area according to the value of the Heli's instance variable and check if the Heli is overlapping that select District_Area or not.

    If not, I tell it to rotate its angle (with Bullet behavior "Set Angle (of Motion)" checked in the properties window) back to the District_Area it's assigned to.

    The problem I'm having is that the UID of the District_Area is not being properly assigned from the beginning and I cannot understand why. I've done things like this before and it worked fine.

    Here is what I have for the setup and the workflow for the Heli.

    Thanks for your help!

    START OF LAYOUT:

    ENEMY PATROL CHECK:

  • It's because you have some logic under the on start of layout events where you set the enemy_heli_move instance variable to the district area you are overlapping therefore the heli is always in its correct district therefore it will never rotate to face any other district.

    edit: just realised you are saying the problem is that the variables are not assigned correctly, looks fine to me.

  • Yeah, that's the problem - the Enemy_Text object contained with each Heli verifies that none of the UIDs assigned to each Heli are correct.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Looks like it's a problem to do with the scaled layer. If you set it back to default 1 then it's fine, must think the heli is in a different place. Probably better to use scaled layers for visual effects and not overlap checks.

  • Aaaaah! Well, if that's the case, I can work around that. Thanks for your help!

  • ...YUP! That did it. Thank you again for the find. Things are working now.

  • Not sure if you tried a different method but a workaround could be to duplicate the districts layer and scale it up in the same way but make it invisible. A bit of fiddling around I suppose.

  • Actually, yeah, that's just about what I had in mind.

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