0 Favourites

How to make an object move to another object's image point?

  • I'm trying to make a complex enemy that involves throwing their sword, then moving to that sword's position.

    My attempted method at doing this was have the enemy sprite spawn a sword sprite on them, and then have the sword sprite move to a separate image point on the enemy sprite. Doing it this way would just fix all the issues I'm having for the desired effect, and make the event tuning much less complicated. Can it be done?

    All I was able to do was make the sword sprite teleport instantly to the enemy sprite's image point, or have it rotate and set it's angle to the point.

  • Look up imagepoints. You can add them to sprites and refer to their X and Y positions. I would suggest to follow a beginners tutorial like the Ghost Shooter if you haven't already

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Edit: can't post links, yolo.

    sprite1.ImagePointX("pointA") is what you'd want to get from that. You'll have to set an acceleration or speed on the sword to actually get it to move from there, and figure out a way to make it stop after a certain distance or on collisions.

    Where pointA is the name of the imagepoint. By default this is named to an integer, but you can be more descriptive. You may have to change a few things with how the sword is bound to the enemy to get this to function properly. In other words, you can't use system>every tick anymore (I think). I'm new at this, but the simplest solution is to have a boolean toggle whether the sword is in the thrown state, and keep it bound to the enemy if it is not, and have it do the throw functions when it is.

  • That's exactly what I needed to know, thanks!

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
564 105,210
rexrainbow's avatar
rexrainbow
Unread hot topic
217 18,531
humanescape's avatar
humanescape
Unread hot topic
167 14,497
DMT2005's avatar
DMT2005