Calculating angle between two image points

Get help using Construct 2

Post » Tue Feb 05, 2013 4:36 am

I can't seem to get it to work.

I use:
angle(Player.ImagePointX("Center"), Player.ImagePointY("Center"), Player.ImagePointX("Angle"), Player.ImagePointY("Angle"))

Center and Angle are the 2 image points.

And in case the names don't work, ive tried

angle(Player.ImagePointX(2), Player.ImagePointY(2), Player.ImagePointX(1), Player.ImagePointY(1))

to no avail.

Events 55 and 56. I want it to calculate the angle on collision of the animation frame that it collided on. (there are only certain frames where the image points exist.)
Here's my .capx
https://www.dropbox.com/s/vzp43wr8sig2zn7/04-FEB-12%20-%20Possibly%20finalized%20hitbox%20AND%20angle%20%20check%20regular%20attack%20on%20sprite.capxbscarl882013-02-05 22:45:04
B
32
S
4
Posts: 405
Reputation: 3,219

Post » Tue Feb 05, 2013 7:05 am

Your project contains rex_rainbows container plugin, could not open it. Anyway, seems like your problem might be somewhere else than in imagepoint angle calculation, as this test I created seems to work as expected:

Imagepoint anglesvee412013-02-05 07:11:01
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Tue Feb 05, 2013 3:03 pm

crap, should I just delete that container i created and it will get fixed? I havent actually used it yet./
B
32
S
4
Posts: 405
Reputation: 3,219

Post » Tue Feb 05, 2013 5:02 pm

Sure, containers are in official release now so you probably won't need.. :)
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Tue Feb 05, 2013 10:45 pm

updated original post, as well as posting the link... ummmm...... HERE!

https://www.dropbox.com/s/vzp43wr8sig2zn7/04-FEB-12%20-%20Possibly%20finalized%20hitbox%20AND%20angle%20%20check%20regular%20attack%20on%20sprite.capx
B
32
S
4
Posts: 405
Reputation: 3,219

Post » Thu Feb 07, 2013 10:30 pm

anyone? ive been stuck on this for quite some time, everything should work but I can't figure out why it doesnt
B
32
S
4
Posts: 405
Reputation: 3,219

Post » Fri Feb 08, 2013 12:43 am

It looks to me like it's actually working. When I set the 2nd and 3rd image points to different positions for the basic attack animation (the kick) it launched the body in the correct direction every time. It's just that most of the other animations don't have any image points at all aside from the origin point. Do you really want to have different launch angles for every frame of every animation? It seems like a lot of extra work, especially if you want to change something later, you'd have to edit every frame of an animation all over again. Personally I would avoid using image points altogether and set the launch angle based on what animation is playing using a variable.
B
6
S
1
Posts: 40
Reputation: 917

Post » Fri Feb 08, 2013 5:10 am

hmmmm maybe you're right...   I guess I'm just confused why it wasnt updating the text
B
32
S
4
Posts: 405
Reputation: 3,219


Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider] and 31 guests