Wiggle function
KatApps
Member, PRO Posts: 84
Hey all,
I'm trying to create a wiggle function for one of my games, which means a character will rotate slowly to the left and after .5 seconds rotate back the other way slowly to the right, and repeat, over and over. I'd like the character to be automatically wiggling upon entering a scene, and then after being touched will start to do something else (like fly away or some other action).
It seems like something simple, but I can't quite figure out how to get the wiggle thing to work. Can anyone help?
Thanks!
kat
I'm trying to create a wiggle function for one of my games, which means a character will rotate slowly to the left and after .5 seconds rotate back the other way slowly to the right, and repeat, over and over. I'd like the character to be automatically wiggling upon entering a scene, and then after being touched will start to do something else (like fly away or some other action).
It seems like something simple, but I can't quite figure out how to get the wiggle thing to work. Can anyone help?
Thanks!
kat
Comments
@KatApps Hi Kat, here's one way of getting the effect you're after; hopefully this'll help you out....
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
(except in this case we don't even need the CCC part)
Constrain rotation to: AAA*sin( game.Time *BBB)
AAA = range of rotation
BBB = speed of rotation
http://www.mediafire.com/?4hvjez20tz1lan2
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Hi @KatApps
As @Elfizm says: you'd have to duplicate the rules from the file I supplied, in you actor in your file.
Another way is to select all the rules in the yellow actor in the file supplied and then option drag across to the rules of your actor in your file, to copy the rules in one go. (Don't forget you'll still have to remake all the attributes used though....)
Hope you sort it/have sorted it. :-)
PS One finally thing to mention: the rules from When scene.Wiggle is false to the end, can all be replaced with the Constrain Attribute @Socks suggested, if you like; it does exactly the same thing, but obviously with less programming.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Did you try out my very simple wiggle above ?
With that you can either drag the actor from my project into yours, or just do as @gyroscope says and drag the rules over - it will copy trouble free as the wiggle is done without rules/attributes (etc).
@gyroscope .. I still have a lot to learn here so I guess recreating all those attributes is still a bit confusing :P
@socks .. I did end up using that file you sent and it seems to be moving me in the right direction. I now have a character that wiggles upon entering the scene!
The second part of this dilemma is now to get the actor to stop wiggling/moving after I've tapped it. The linked file shows this.. the actor wiggles, I tap it and it gets bigger and increases the score on the top right (which is what I want it to do).. and then I'd like it to freeze after this.. anyone know a way to accomplish this?
http://www.mediafire.com/?db47tma7flti3i1
This community is great. I really appreciate all the posts and look forward to getting better so I can contribute more
Kat
To keep it simple you could simply kill the old sun and replace it with a static version.
Like this: http://www.mediafire.com/?zswa8gj8hy5bc8d
@socks .. I tried the static version idea and it seems to work great!
I'm stoked to finally move forward on my app, thanks so much for following up on this, I greatly appreciate it
Good it's all moving forward for you, Kat. :-)
Here's yet another way to have your sun actor stop rotating when you click it:
Make a self boolean attribute, let's call it GoStop.
Put the Constrain Behaviour in a Rule: When self.GoStop is false
And finally put a Change Attribute GoStop to true in the touch rule, maybe just after the last interpolate behaviour there.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps