problems with getting object angle

For questions about using Classic.

Post » Wed May 04, 2011 9:01 pm

hi guys.

once again,ive run into a problem i cant seem to solve by myself.
trying to keep it short:
my character gets pushed down the stairs and the player needs to hold down a button to get back up. im using a separate ragdoll character,when the player gets pushed down. im trying to make it so that when the ragdoll character gets all the way back up,its destroyed and the original,playable character takes its place at a correct position. ive run into a problem,where im supposed to trigger an event when the ragdoll character's feet angle equals 0,but it doesnt work. somehow it doesnt detect the angle at all and nothing happens. is there any reason for it?

could someone help or give some hints?

here's the .cap to make myself more clear:

[url:10ygkabi]http://dl.dropbox.com/u/11157144/ragdoll.cap[/url:10ygkabi]

in short,when the ragdoll is standing up by pressing space,it should be destroyed and the original,movable character should should be spawned to take it's place.
B
4
S
2
G
2
Posts: 109
Reputation: 1,318

Post » Wed May 04, 2011 10:09 pm

It looks like the feet never perfectly reach that value, maybe try checking for the angle being between -10 and +10 degrees. I'll try that out and edit this post if I get it to work.

Edit: Yup, that worked all too well. I tried limiting the range to between +1 and -1 and it is much better now. Here's the cap: [url:1duypnzt]http://dl.dropbox.com/u/4714446/ragdoll%20stairs.cap[/url:1duypnzt]
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009

Post » Thu May 05, 2011 12:32 pm

brilliant! thats exactly what i had in mind this morning, it works just as i want now.
thanks, much appreciated.

im a little embarrased i couldnt figure out something so simple earlier :/
i wonder why it doesnt detect the exact angle though, not that it matters now.
B
4
S
2
G
2
Posts: 109
Reputation: 1,318

Post » Thu May 05, 2011 8:34 pm

I think it's because the angle is never exactly 0 degrees when the tick that checks it begins. I've often rotated things in the editor and gotten some obscure value like "90.0019" or something. If you want it to detect something more accurately, you can try rounding the object angle to 0 like this:
[code:2j49zvoe]Round(Sprite.Angle)[/code:2j49zvoe]
"Construct 4 lets YOU make advanced games! (maybe)" Construct Classic - Examples Kit
B
86
S
28
G
13
Posts: 2,092
Reputation: 15,009


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests