Patrolling guard and positioning...what am I doing wrong?

0 favourites
  • 7 posts
From the Asset Store
Guard Pal design For programming and publishing to other platforms
  • So, the purple box is the "mask" for the patrolling guard (turquoise dude). They're not lined up, despite having an Every Tick event positioning the sprite over the box:

    The second problem, see those yellow boxes? Those are waypoints that are supposed to mark the patrol path. The guard starts on the yellow box at the far right, but some reason, comes up a full grid square, so it never touches the other squares and keeps going left.

    My first thought was that changing the angle of the "mask" was the problem, except disabling those lines actually sends the box up even farther.

    So, I'm at a loss. What am I doing wrong here?

  • Why do you have two actions for set position?

    If the guard doesn't touch any yellow squares and the default is left then he will keep moving left.

  • If you are setting one sprite to anothers .x and .y and they arent lining up visually I would guess, it's one of 2 things.

    Origin: This is a X,Y coordinate that is the home to your sprite. Some times manipulating a Sprites size will leave you with an Origin that is not where you expected it to be. You should check both your Sprite and Mask to verify they have the same size Sprite with the same Origin.

    Layers: Parallax or Scaling (And probably other properties) can have X,Y on 1 layer not match up with the X,Y of another layer.

  • Why do you have two actions for set position?

    If the guard doesn't touch any yellow squares and the default is left then he will keep moving left.

    The the first set position is a different mask for a different sprite.

    The default is to do nothing, so the mask IS touching the first yellow square...but then moves up for some reason that I don't understand.

  • If you are setting one sprite to anothers .x and .y and they arent lining up visually I would guess, it's one of 2 things.

    Origin: This is a X,Y coordinate that is the home to your sprite. Some times manipulating a Sprites size will leave you with an Origin that is not where you expected it to be. You should check both your Sprite and Mask to verify they have the same size Sprite with the same Origin.

    Layers: Parallax or Scaling (And probably other properties) can have X,Y on 1 layer not match up with the X,Y of another layer.

    At the moment I only have one layer.

    All three objects are 16x16, origin point in the top left corner. I can overlap all three perfectly in the layout editor.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I think better to share the project file. Fixing the position first will help, as mentioned above check the origin on the blue sprite. That is a separate issue though because the overlap is done with the purple sprite. Look in debug view at the variables I guess.

  • I think better to share the project file. Fixing the position first will help, as mentioned above check the origin on the blue sprite. That is a separate issue though because the overlap is done with the purple sprite. Look in debug view at the variables I guess.

    ....and I fixed it. For some reason, at some point, I gave the guard sprite the Solid behavior, which seems to be the cause of the Set Position issues. Not sure why, though, since the mask was not Solid.

    The mask bypassing the waypoints is related to the 8-Direction behavior, which I guess is going to need some tweaking.

    Thank you everyone for your suggestions.

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