Reference an image point's X and Y

Get help using Construct 2

Post » Wed Feb 08, 2012 3:22 pm

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! GenkiGenga2012-02-08 15:23:35
ImageImage
B
73
S
16
G
6
Posts: 1,038
Reputation: 10,473

Post » Wed Feb 08, 2012 3:32 pm

mySprite.ImagePointX(mySprite.myImagePoint)
B
22
S
9
G
5
Posts: 122
Reputation: 5,386

Post » Wed Feb 08, 2012 3:48 pm

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?GenkiGenga2012-02-08 16:03:28
ImageImage
B
73
S
16
G
6
Posts: 1,038
Reputation: 10,473

Post » Wed Feb 08, 2012 4:14 pm

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
[code]Set bullet angle angle(Player.imagepointX("image"), Player.imagepointY("image"), Bullet.x, Bullet.y)[/code]
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.
[code]angle(Bullet.x, Bullet.y, Player.imagepointX("image"), Player.imagepointY("image"))[/code]
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Wed Feb 08, 2012 4:14 pm

It is allways a good idea to post the CAPX
B
42
S
19
G
12
Posts: 723
Reputation: 13,911

Post » Wed Feb 08, 2012 4:33 pm

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:

http://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.GenkiGenga2012-02-08 16:42:02
ImageImage
B
73
S
16
G
6
Posts: 1,038
Reputation: 10,473

Post » Wed Aug 22, 2012 9:05 pm

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.
B
14
S
5
G
2
Posts: 20
Reputation: 2,378

Post » Thu Aug 23, 2012 1:27 pm

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.

GenkiGenga2012-08-23 13:28:14
ImageImage
B
73
S
16
G
6
Posts: 1,038
Reputation: 10,473


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, jul, TELLES0808 and 23 guests