Jump to content

Python rotation funkcio help


Recommended Posts

Hy!

bye would be a problem to have a rotation feature that is key, and is connected to the rotating characters,

The function here

 

    def __OnClickPrevRotate(self):
        self.Rotation = self.Rotation - 1
        chr.SetRotation(self.Rotation)

 


My question to be solved long as you hold the button to the characters constantly spinning when you release the button used to rotation

Thank you in advance for your answers

Link to comment
Share on other sites

  • Bronze

Try this:

self.isActiveRotation = False
self.button.SetMouseClickEvent(self.ActiveRotation)
self.button.SetMouseButtonUpEvent(self.DeactiveRotation)

def ActiveRotation(self):
    self.isActiveRotation = True
    
def DeactiveRotation(self):
    self.isActiveRotation = False
    
def OnUpdate(self):
    if self.isActiveRotation:
        self.Rotation -= 1
        chr.SetRotation(self.Rotation)

  • Love 1
Link to comment
Share on other sites

  • 2 weeks later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.