Pin sprite if overlapping another sprite

0 favourites
  • 9 posts
From the Asset Store
Pathfinding AI
$2 USD
80% off
Units do not overlap each other and use different ways if there are several free ways.
  • In my top down game I am trying get enemies to be pinned to the player at a specific image point, when an enemy is overlapping the player boundary box and a key is pressed. Using an instance variable, pressing the same key will unpin the enemy from the player.

    Not sure what I am doing wrong. Example in the capx below:

    [attachment=0:ufrh3rmr][/attachment:ufrh3rmr]

  • I have checked your work and found that you are trying to pin object point HOSTAGE to player. I cant see where is your hostage image point. work that one out and you be fine. You could use image animation frame number

  • After pinning the enemy to the player I'm trying to position the enemy sprite on the HOSTAGE image point which is the name of an image point on the player default animation (only has one frame).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No it should be on enemy because you are trying to pin enemy and not player

  • OK, leaving aside the image point, I'm still finding that the enemy won't pin to the player. I'm disabling the enemy bullet behavior before pinning to the player, but the enemy sprite won't stop moving. So I think there is something wrong with my event/function call.

  • It's working but you straight away turn it off again - event 5 calls the function and pins it correctly but event 6 straight away stops it. You can test this by changing the key required in event 6 from "E" to another key ("R" ?).

  • Thanks! Need to use the same key for toggling the pin behaviour so have added an if/else to set a boolean,

  • Coming back to my original issue, I can't get the enemy to attach to a specific imagepoint on the player. I am using set position on every tick to the imagepoint X, Y co-ordinates, but this doesn't seem to work. Any suggestions?

  • So when it overlaps but before you pin just move it to the correct point

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