problems with rotating the layer

0 favourites
  • 8 posts
  • I have some problems with seting my entire layer to rotate on keyboard.

    1. I'w managed to create rotation per 45� in arrow keys but i have problem if key is pressed again until first 45� transitiion is not yet finished... than mine 45� become eg. 45�+ 15� and everything falls apart.

    im usnig this formula:

    left arrow: set rotate to target angle to (immage.Angle + 45) % 360 , clockwise

    right arrow: set rotate to target angle to (immage.Angle - 45) % 360 , clockwise

    how can i make that mine arrow key rotates immage 45� and if pressed twice it wont apply rotation again untill reached exactly 45th degree?

    2. i cant make my particles rotate (once they are created) along with rest of the screen? I'm assuming that i can only rotate point of origin and not each particle on the fly... is that correct?

    Can particle rotation be even achieved at all in this manner?

    Thank you!

  • 1) Create a Global Variable called Rotating. Set the initial Value to 0

    When the key is pressed, set the variable to one. When the layout has finnished rotating, set the variable to 0 again.

    In the condition where the key is pressed, add another condition "System: Compare Variable: Rotating = 0" That way, the event wont be triggered while the thing is rotating. If you want a qued system, where it waits untill the rotation has finnished, let me know, that may take a little more explaining.

    2) As far as I know, you can only rotate the point of origin. You can do this using the Angle actions in the particle that you want to rotate.

    Hope this helps :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hm... its not working.

    how exactly to:

    When the layout has finnished rotating, set the variable to 0 again

    Couse i think im making error on this point.

  • Can you post a screen shot of your events please?

  • This is how it looks now.

    dropbox.com/s/qiyonvox97hfiky/rotation.jpg

  • Ok what you need to do is:

    For the Right Arrow pressed event, add the same "rotLay = 0" condition as you did for Left Arrow Pressed.

    At the END of the Left Arrow Pressed event AND the Right Arrow Pressed event, add an action "Set rotLay to 0"

    At the start of the Right Arrow Pressed event, add an action "Set rotLay to 1"

    That should work then.

  • its not working... :(

    dropbox.com/s/tb73bqzkkk4set7/test.capx

  • Im trying now with

    System: set layer angle

    anglerotate(LayerAngle(0), LayerAngle(0)-45, 45)

    This is better becouse it rotates particles too but i dont know how to set nice smooth transition... it just jumps by 45? :(

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