Jump to content
  • 0

Python rotation funkcio help


Ultor

Question

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

2 answers to this question

Recommended Posts

  • 0
  • 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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×
×
  • 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.