How do I rotate smothly my layout to 180?

0 favourites
  • 6 posts
From the Asset Store
2D Pack of 180 pixel art vehicles to make top view game. ( Cars, trucks, motorbikes, trains, boats ).
  • How do I rotate smothly my layout to 180 degree?

    I already do something like : keyboard check rotate layout number to 189 degree but my goal is to make it rotate smothly not automatically. Someone can help me? I'm trying for days.

  • I'm trying for days.

    You should've asked earlier!

    Two methods:

    1.

    On every tick
    LayoutAngle<180
     -> Set layout angle to min(layoutAngle+90*dt, 180)
    

    2. Add Tween behavior to any sprite.

    On start of layout
     -> Sprite: Tween "ang" value from 0 to 180 in 2 seconds
    
    Sprite: Is Tween "ang" playing
     -> System: Set layout angle to Sprite.Tween.Value("ang")
    

    With tween you can select cool easing effects.

  • Thanks. But how to do that? Every tick how? I don't need to rotate sprite. Just want to be sure about how to do the process. Where to put the code?

  • "Every tick" is a System event, you add it on the event sheet.

    Try just copying+pasting this code to your event sheet:

    {"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"every-tick","objectClass":"System"},{"id":"evaluate-expression","objectClass":"System","parameters":{"value":"LayoutAngle<180"}}],"actions":[{"id":"set-layout-angle","objectClass":"System","parameters":{"angle":"min(layoutAngle+90*dt, 180)"}}]}]}
    
    

    I don't need to rotate sprite.

    It will rotate the layout, not a sprite. I suggest trying the second method with Tween behavior.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • sorry i dont understand where to put this line of code. i can see Every stick on System function but dont realy understand where to put all this code. is not clear for me.

  • Have you tried simply copying this line (Ctrl+C) and pasting it onto the event sheet (Ctrl+V)?

    {"is-c3-clipboard-data":true,"type":"events","items":[{"eventType":"block","conditions":[{"id":"every-tick","objectClass":"System"},{"id":"evaluate-expression","objectClass":"System","parameters":{"value":"LayoutAngle<180"}}],"actions":[{"id":"set-layout-angle","objectClass":"System","parameters":{"angle":"min(layoutAngle+90*dt, 180)"}}]}]}
    

    It should add the event. Then you will be able to study it.

    Also I suggest starting with some tutorials, looks like you need to learn the basics of programming in C3.

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