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

0 favourites
  • 5 posts
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • 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.

  • 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.

  • 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?

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • FragFather,

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

    Thank you, friend.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)