How do I use "wait" followed by a movement?

Get help using Construct 2

Post » Mon Jul 14, 2014 7:21 pm

Excuse my english please. I'll try to explain best I can.

I don't know if this is a bug or not. I need that the object gets inclined (or rotate its angle) a little in a smooth way. I am using three events separated by 0.05 secs each one, rotating -5 grades everytime to get a smooth movement. But it is impossible if you hold pressed a key or the analog stick in gamepad, both inputs fails.

Could you take a look on the attached capx and help me, please?

Thanks in advance.
Greetings.
You do not have the required permissions to view the files attached to this post.
B
25
S
3
G
1
Posts: 53
Reputation: 1,417

Post » Mon Jul 14, 2014 9:29 pm

This should fix the issue for you.

Part of the reason your controls were failing is, the keyboard and D-pad were fighting against each other. The D-pad x-axis was 0 so even though you pressed the keyboard arrow key, the angle was set back, etc... I combined some of the controls into a single event so they wouldn't fight and the 2 events for setting the piece idle, I placed before the ones that set it to rotating.

Here are a couple other things I did to get it working:

I pulled out the amount you are rotating by and placed it in a global variable. That way if you decide to change the value, you only have to change it 1 place. I added a global variable called state with 3 valid options: -1 for rotate left, 0 for idle and 1 for rotate right. Using a variable to represent state can make changes over time a little easier to work with. I used the state to define when the sprite is rotating and which direction. Finally, to create the smooth transition back to the original state, I checked to see if the left and right buttons were released and if the controller x-axis was 0. If so, I set the state back to 0 for idle. When the state is 0, I transition the sprite back to 0 rotation.

I hope that helps and good luck with you project.
You do not have the required permissions to view the files attached to this post.
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Tue Jul 15, 2014 5:54 pm

Thank you FragFather!! Your capx is smoother than mine (light years indeed XD).
I have two more doubts about this.
1) There is a little bug in the movement I cannot understand. If the player press the opposite direction to move the sprite from left to right quickly, the sprite holds its position freezed on the last angle. I dont know if I'am explaining well. Imagine you go left and have decided you are in a wrong way and press right inmediately. As you can see, the sprite hold the angle that it took fancing left.

2) I have noticed you have a good comprenhension about degrees in Construct2. What I know is Construct2 start 0 degrees from right, but what afte that? How it figures a sphere? I have attached an image here, but I can't point to the negative values in a degrees sphere (I suppose its the counterclockwise). Can you redraw it please?
You do not have the required permissions to view the files attached to this post.
B
25
S
3
G
1
Posts: 53
Reputation: 1,417

Post » Tue Jul 15, 2014 6:55 pm

When it comes to negative degrees, -90 degrees is the same thing as 270 degrees which is the same as 630 degrees (1 full rotation plus 270). Because you can continue going around a circle, you can consider a given angle in the circle as the angle +/- 360. It will always be equivalent. I hope that answers your question.

As for the bug, it is caused by the check if the angle is between -25 and 25. As with almost all issues, there are multiple fixes for it. Attached are 2.
You do not have the required permissions to view the files attached to this post.
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Tue Jul 15, 2014 7:54 pm

FragFather,

your answer, your capx's, and your help... amazing.

Thank you, friend.
B
25
S
3
G
1
Posts: 53
Reputation: 1,417


Return to How do I....?

Who is online

Users browsing this forum: bluesun66 and 10 guests