How to stop rotating object

  1. 3 months ago

    Hello I am constantly having a object keep rotating, it does not come back and stay where I finish it.
    On the second click it starts where it left off and keeps going. How do I complete the rotation so that when tapped again it does the same rotation. I'm very new thank you

  2. 2 months ago

    Hello has anyone have a possible solution.

  3. Angelo S

    Apr 23 Administrator

    Hello,
    the rotate action is always in "delta", meaning it rotates from the actual position.
    To achieve the behavior you want you need to add a "Run Javascript" action before the rotate action using the one-line code below:

    $(pubcoder.objects.myObject).rotate(0)

    Please replace "myObject" with your the object alias, that you can set in the inspector after selecting the object itself

  4. Hello I am not code friendly. I'm not even sure where to input this information.
    Is there no way in the interactivity panel to set the rotation back to the original position.
    So that the movement when clicked on does the same rotation sequence every time.
    Like a loop.
    Thank you for your assistance.

  5. If possible could you take a screen shot of the steps. I'm a visual learner I'm afraid.

  6. Angelo S

    May 6 Administrator
    • in the "selection" panel, with your object selected, insert "myObject" as alias of the object
    • in the interactivity panel, add a "run javascript" action and drag it before your "rotate" action
    • Doubleclick the "run javascript" action and paste the code provided
  7. 4 days ago

    Hey there! I'm relatively new to game development too, so I can definitely sympathize with frustrating rotations. It sounds like you're accumulating rotation values over time without resetting. One approach could be to calculate the total rotation needed for each tap and apply it over a set duration. Maybe think of it like winding up a toy car, like the adorable Eggy Car , each tap starts a new winding. Good luck debugging! I hope this is helpful

 

or Sign Up to reply!