Rotate object at angle - ADVANCED

Get help using Construct 2

Post » Mon Jul 02, 2012 3:21 am

Ok, it's me again. Guess I couldn't wait to mess up again!

I put advanced in the subject because this problem goes way beyond just telling an object to rotate and then stop on a certain angle.

What I need to do is on the menu layout, the needle for the guitar tuner needs to rotate left or right based on certain conditions. This gets complicated, but I'll try my best to explain...

In my interactive graphic novel, the reader is given choices that determine whether the main character does something merciful or unmerciful and cooperative or uncooperative. For instance, you have the decision to knock someone out or kill them; that would be merciful or unmerciful, respectively. Or you have the option to come along quietly with authorities or you can try to escape; that would be cooperative or uncooperative, respectively. You can probably see where I'm going with this (think the Paragon/Renegade decisions in Mass Effect). The overall outcome of these decisions determine which ending the comic will have.

Anyway, each time the reader selects merciful, the needle should go about 8 degrees to the right of the center of the tuner. This is also the case with each time the reader chooses cooperative. However, the needle needs to move left 8 degrees for each negative choice as well. For instance, if the reader has chosen (in this order) to be merciful, cooperative and then merciful, the needle should be 24 degrees to the right of center. If the reader then chooses a negative choice (in the way of unmerciful or uncooperative) then the needle will move to the left 8 degrees and thus it will rest at 16 degrees to the right of center until the next choice. Still with me?

I'm having a really, really hard time figuring out how to do this...pretty much all day working on it. Everything seems to break when I try it...sine, custom movement, regular movement, setting angles, rotating to angle, using instance variables and global variables...blah!

I don't get it. I'm much better with the design stuff. Any ideas?

http://philipcomposer.com/comic/sax.capx
B
14
S
5
G
4
Posts: 121
Reputation: 3,938

Post » Mon Jul 02, 2012 7:03 am

Have you tried storing a global variable which gets updated, and then on every tick match the angle of the object to it?

Don't use instance variables as they will reset.

I haven't looked at the code, but it sounds like it would work to me.
B
22
S
7
G
3
Posts: 189
Reputation: 4,270

Post » Mon Jul 02, 2012 12:41 pm

Yeah, have a global variable called Karma or something then each time the reader selects an option, add or subtract 'Karma Points' from the global variable then set the angle to: 90 - Karma.

That way if the player has negative Karma, the needle will swing to the left (between 90 degrees and 180) or if they have positive karma the needle will swing to the right (between 90 degrees and 0)
B
6
S
1
Posts: 5
Reputation: 810

Post » Mon Jul 02, 2012 1:40 pm

The above suggestions are the way to go, I made a quick example for you to illustrate:

AlignmentDial.capx (r97)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Mon Jul 02, 2012 11:18 pm

Thanks again guys. Confirmed to work with a slight modification to account for being on more than one layout.
B
14
S
5
G
4
Posts: 121
Reputation: 3,938


Return to How do I....?

Who is online

Users browsing this forum: chcteacher, Televangelist and 26 guests