Reference an image point's X and Y

0 favourites
  • 8 posts
From the Asset Store
Connect the dots in the correct order and draw happy animals!
  • Hi all, im having some trouble trying to reference an image point.

    eg.) Set bullet angle to Player.ImagepointX - I have got this far but cant seem to figure out what to do with it now.

    My image point I want to reference is called "image"

    Ive tried so many combinations but cant seem to get it!

    I know I have seen it in some example but i cant seem to find it - or a related post!

    If anyone knows off the top of their head I would appreciate it!

  • mySprite.ImagePointX(mySprite.myImagePoint)

  • Thanks for the quick reply Wgfunstorm,

    Maybe I should be more specific - I want to send a bullet towards an image point on my "Boss" sprite. The image point is renamed to "Top".

    I couldnt figure out how to implement what you did. I tried : Boss.imagepointX(Boss.Top)

    I ended up trying Boss.imagepointX(1) aswell with little success.

    Anyone?

  • Player.imagepointX("image") and Player.imagepointY("image") should return the coordinates of this point.

    But that's maybe not the problem here. What are you trying to do exactly ?

    Set the bullet angle to a X position makes little sense.

    Something like

    Set bullet angle angle(Player.imagepointX("image"), Player.imagepointY("image"), Bullet.x, Bullet.y)

    would give you the angle between the bullet and the player's image point.

    This depends of course on the position of the bullet.

    If the angle is still not what you expect, try switching Player and bullet in the expression above.

    angle(Bullet.x, Bullet.y, Player.imagepointX("image"), Player.imagepointY("image"))
  • It is allways a good idea to post the CAPX

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Weishaupt you are absolutely right - I apologise guys. (From now on i will always have a capx!)

    I was doing the the example up quick as a new cap.x and quickly found that using boss.imagepointX(1) and Boss.imagepointY(1) did work.

    If you are still interested what i was talking about it was this:

    dl.dropbox.com/u/13312935/ImSORRYguys.capx

    The image point I was aiming for is called Top - I was only able to get it to work by using the number.

  • I am getting the same result. Using the index of the image point works, using imagepointX("IMAGE_POINT_NAME") does not. Will be harder to manage something with several image points in this manner, but so far have not seen any need to do that.

  • Hey Helto, I remember making this post a long time ago. Sorry I should have tied up this loose end.

    I cant remember exactly what my problem was, most likely being the result of a long night of learning lol.

    If your sprite is called (Monster) and the image point you want is called (MonsterLeg), then the proper way to reference it is by simply typing "MonsterLeg" in the section for optional image points. Notice you need to use the quotation marks.

    Let me know if you still have problems.

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