Rotate Angle and Scroll REVISIT

0 favourites
  • 7 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Ok, So I want to enter the competition. I started working on a rotate layer project, and found the issues that have been discussed here. I also downloaded Kyatric's "dirty fix", but I am still trying to get a grasp of what is actually happening so I can adapt a similar strategy to my project...

    Here is what is happening with me. I have Scroll To Object as a behavior on my player sprite. The Layer to be rotated has Sprites with {stay in place} physic behavior. The player sprite triggers rotate layer 60 deg. Everything on that layer rotates fine (all sprites maintain the 'solid' physic behavior at the correct angle and position of the rotated layer angle ect...) But as soon as I start moving, (because scroll behavior is active) the rotated layer moves at the wrong angle in comparison to the Player sprite (at a 60 deg angle to whichever direction I move). I need the rotated layer to stay put so it scrolls correctly in comparison to the bottom layer.

    When I remove the Scroll to Behavior and repeat the action, Only the IMAGES rotate, but the behaviors stay where they were... So it is like there is a physics mask at the position where the image was.

    It looks to me like the rotate angle works "better" when scroll to is active, however the math in the angles of the "scroll to" behavior for additional layers is screwed up.

    Because the physics move with the rotated items while "Scroll to" is active, I BELIEVE all I need is ?a formula to make the layer scroll with my sprite? Am I right? or is this more difficult than I realize? (And can someone help me figure this out.)

    Whew... My brain hurts...

  • I will provide Example in a few here: RotateFile CAPX

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am finding the lack of a System: Set Layer Scroll action a bit of an annoyance. Can anyone suggest a way around this? I really need help to continue working on this project.

    See my CAPX above to see what the issue is...    - Sorry for the bump, but if this is undo-able, just let me know and I will hush up.

  • In my opinion, layer rotation isn't robust enough yet to be used in something as complicated as rotation+scrolling.

    I think layer rotation does one interesting thing that is: rotating groups of objects. But here are the limitations I know :

    - you can't yet set a center of rotation

    - as you said you can't easily position a layer (where would be the origin?)

    - there are some annoying issues with collision (don't know if it's just with physics or all kind of collision)

    - when you group objects under the same layer you can't finely tweak zOrder regarding object outside this group

    And basically, to rotate a group of object, I would just use the same sprite to represent them and do a:

    Global Variable PivotX = what you want
    Global Variable PivotY = what you want
    Object: set X to PivotX + cos(angleOfRotation)*distance(Object.X,Object.Y,PivotX,PivotY)
    Object: set Y to PivotY + sin(angleOfRotation)*distance(Object.X,Object;Y,PivotX,PivotY)

    There you have control on what object you move and the position of the center of rotation (pivot).

    You avoid zOrder issues 'cause they stay at the same zOrder before and after the rotation. Same goes for collision issues.

    If there were families, you could even use the same code on a whole bunch of different objecttype.

    So for now, if I were to participate, I probably would just use layout angle. 'Cause THAT is a neat feature (:

  • I came up with a solution to work around my rotation issue, however once C2 gets its rotation and scrolling overhaul, I will try it again.

    I actually need that Sin/cos formula too Yann! Thanks again for coming to the rescue!

    It has been an enlightening day... I learned a LOT about rotation and scrolling today <img src="smileys/smiley1.gif" border="0" align="middle" />

  • I'm having the same problem...

    Yann, your first solution sounds good, but i don't know if it's going to be valid for the contest.

    And your second solutions involves moving the whole thing, and that doesn't work for me.

    So, the only way i figured 'till now is rotating the layout and then counter rotating the things that aren't suppose to rotate with your little formula. Thanks.

  • arandaschimpf

    As long as you use layout or layer angle it's valid. That's what I understood. And it shouldn't look like you added it just for the contest.

    But using layer angle instead of just rotating object around a custom pivot with math is just totally unproductive, more if (as some did) you rotate hidden collision masks on an unrotated layer with the aformentionned formula. You better just rotate the original object "normally".

    That's why I would probably just use layout angle if I were to participate in the contest.

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