How do I turn a layer

0 favourites
  • 8 posts
From the Asset Store
Create large maps with dynamic depth and precise sprite layering control in top-down games.
  • Hi!

    This may sound like a stupid question, but I want to turn a layout (90 degrees per turn).

    It works fine, but when it hits 360° it doesn't stop turning.

    I guess it's pretty simple, but I stuck here.

    Here you can download a capx file

    https://www.dropbox.com/s/gco1eyam7gjqfjp/turnLayer.capx?dl=1

    If you click the left button, the layer should turn left (-90° of the current angle). On the other side, if you click the right button it should turn right (+90° of the current angle).

    For this I'm using a variable called "PlatformAngle" (platforms is the name of the layer).

    Thank you guys!

  • Can't run your capx because of custom plugins

    I suggest you use the limiting expressions when increasing your variable

    Set variable "PlatformAngle" to min(PlatformAngle + 90, 360)

    Set variable "PlatformAngle" to max(PlatformAngle - 90, 0)

  • Can't run your capx because of custom plugins

    I suggest you use the limiting expressions when increasing your variable

    Set variable "PlatformAngle" to min(PlatformAngle + 90, 360)

    Set variable "PlatformAngle" to max(PlatformAngle - 90, 0)

    Hi!

    Thank you for your comment. I removed the custom plugin, now you should be able to open it.

    I tried your suggestions, but still on 360° it doesn't stop turning.

    THank you!

  • That problem happens because when something rotates to 360 degrees, C2 resets the angle to 0 (because 360º = 0º)

    My capx: https://dl.dropboxusercontent.com/u/395 ... 81%29.capx

    I fix this by saying "turn 90 degrees" instead of "turn until you reach the target angle" (because the target angle resets when it reaches 360)

  • You have the variable PlatformAngle and the expression LayerAngle("platforms") .

    At the same moment as PlatformAngle gets capped on 360 (not sure, events are a mess), the expression LayerAngle jumps from 360 to zero. 360° = 0 °. You cant read out the expression to turn, it goes a differend path then the variable. Thats one. On top you handle the right button with an else, and in this case even sunbaiting in Tinerife meets the else condition.

    Here you go:

    https://

    drive.google.com/open?id=0B1SSuCVV8v74Z0cwakw3OG0xU2c

  • lol 7Soul, beating me in a few minutes, mine is obsolute now.

  • That problem happens because when something rotates to 360 degrees, C2 resets the angle to 0 (because 360º = 0º)

    My capx: https://dl.dropboxusercontent.com/u/395 ... 81%29.capx

    I fix this by saying "turn 90 degrees" instead of "turn until you reach the target angle" (because the target angle resets when it reaches 360)

    That's great! Thank you for your quick help!

    Regards

    Andy

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You have the variable PlatformAngle and the expression LayerAngle("platforms") .

    At the same moment as PlatformAngle gets capped on 360 (not sure, events are a mess), the expression LayerAngle jumps from 360 to zero. 360° = 0 °. You cant read out the expression to turn, it goes a differend path then the variable. Thats one. On top you handle the right button with an else, and in this case even sunbaiting in Tinerife meets the else condition.

    Here you go:

    https://

    drive.google.com/open?id=0B1SSuCVV8v74Z0cwakw3OG0xU2c

    Thank you for your help! It's highly appreciated

    7Soul have fixed it already

    Thank you!

    Regards

    Andy

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