How do I rotate the Layout? (Layout+Gravity)

0 favourites
  • 15 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • I'm trying to make a game that rotates the Layout 90º if you press a key and rotates -90º if you press another key.

    How can I rotate the Layout and the gravity?

    When the Layout rotates you can see how it rotates, is not instantly.

    Thanks in advantage. ^-^

  • Your suggesting turning everything in the layout including gravity?

    This is a really interesting concept I haven't tried... Might take a crack at it this week...

  • Is it like a Platformer/Mario style game? or what kind of game is it?

  • Yes, including gravity, at once, like the world rotating.

    Its for a platformer game.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have you looked at the rotating platformer example shipped with Construct2?

  • Have you looked at the rotating platformer example shipped with Construct2?

    Yeah, I did it, but is not exactly what I want. The example rotates every tick towards the player. I want to rotate the Layout 90º when a key is pressed and you can see how it rotates. I mean: LayouAngle(0) += 1 until LayoutAngle(0) = LayoutAngle(0) + 90.

    Incrementing the layout angle in 1 until 90, 180, 270, 360. And if its >= 360, put it on 0.

    I have the idea in code, but not in Events xD

  • Something like this?

    Global variable "LayoutNewAngle"

    on key pressed

    _ System add 90 to "LayoutNewAngle"

    system compare two values LayoutAngle not equal to LayoutNewAngle

    System set LayoutAngle : LayoutAngle+1

  • I'll try this, many thanks .

    I will tell later if it doesnt works

  • It works, but it doesn't stop when LayoutAngle is grater than 270º. Any idea?

  • I'm not really sure what you mean..

    Do you want to add an extra condition to the button event?

    Something like:

    System compare two values LayoutAngle < 270

  • I'm not really sure what you mean..

    Do you want to add an extra condition to the button event?

    Something like:

    System compare two values LayoutAngle < 270

    I mean this: When is press a key, the Layout rotates 90º (LayoutAngle = 90) and the rotation stops. If i press it again the Layout rotates 90º more(LayoutAngle = 180). then I press again and 90º more(LayoutAngle = 270). When I press it again, it never stops rotating(Loop).

    Here the code for that:

    newAngle is a GlobalVar initialized to 0.

  • > I'm not really sure what you mean..

    >

    > Do you want to add an extra condition to the button event?

    >

    > Something like:

    > System compare two values LayoutAngle < 270

    >

    I mean this: When is press a key, the Layout rotates 90º (LayoutAngle = 90) and the rotation stops. If i press it again the Layout rotates 90º more(LayoutAngle = 180). then I press again and 90º more(LayoutAngle = 270). When I press it again, it never stops rotating(Loop).

    Here the code for that:

    newAngle is a GlobalVar initialized to 0.

    Well that's because C2 works with 360 degrees..

    if you add 90 to 270 it will become 360, but 360 is 0 in C2, so the layoutangle goes from 359 to 0, always being lower than 360 and as such always rotating..

  • Hmm..true, I will be testing some things to see if i get something-

    Thank you very much for your help

  • Okay, I get this, I think is good, but it doesn't stops..

    rotarIz -> rotateLeft

    rotarDer -> rotateRight

    velRot -> Rotate speed

  • system set rotarzl = 0

    system set rotarDer = 0

    because if you add 0 to your variables, your variable still = 1 and your layout still rotates

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