Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do one thing one after the other (Lua) #10089

Closed
EvanOrSomething opened this issue Aug 7, 2022 · 31 comments
Closed

Do one thing one after the other (Lua) #10089

EvanOrSomething opened this issue Aug 7, 2022 · 31 comments
Labels
help wanted Extra attention is needed

Comments

@EvanOrSomething
Copy link

Describe your problem here.

I want to rotate gf left, then rotate her right. But I'm not sure how to make the game wait for her to finish rotating in one direction before rotating in the other.

Are you modding a build from source or with Lua?

Lua

What is your build target?

Windows x64

Did you edit anything in this build? If so, mention or summarize your changes.

No response

@EvanOrSomething EvanOrSomething added the help wanted Extra attention is needed label Aug 7, 2022
@frantastic24
Copy link

function onTweenCompleted(tag)

@EvanOrSomething
Copy link
Author

What would you put in the (tag)? Like the name of the tween?

@frantastic24
Copy link

tag is just a variable name, it returns the tag of a tween when it finishes

@EvanOrSomething
Copy link
Author

It doesn't seem to be working, maybe it's because my first tween is under function onStepHit()

@EvanOrSomething
Copy link
Author

EvanOrSomething commented Aug 7, 2022

Here's what the tweens look like
image

@frantastic24
Copy link

You are doing a tween every step and doing two tweens at once

@EvanOrSomething
Copy link
Author

I know I am, but I don't know how to fix it

@frantastic24
Copy link

Make one tween and loop it with the function I mentioned

@EvanOrSomething
Copy link
Author

How? (sorry, I'm not smart)

@frantastic24
Copy link

make one tween, under the new function you can check the current angle and do the other tween to create the loop

@EvanOrSomething
Copy link
Author

How do you check the current angle?

@frantastic24
Copy link

getProperty('object.angle')

@EvanOrSomething
Copy link
Author

so just like this?
image

@EvanOrSomething
Copy link
Author

EvanOrSomething commented Aug 7, 2022

Nope, just checked

@frantastic24
Copy link

you need at least one if and the function shouldn't be inside another one

@Itz-Miles
Copy link

I think you also need to put "gfRotateL" in onTweenCompleted().

@EvanOrSomething
Copy link
Author

So like?
image

@frantastic24
Copy link

it's getting there but you're not checking the angle value

@EvanOrSomething
Copy link
Author

How do you do that? Like this? idk
image

@Itz-Miles
Copy link

Itz-Miles commented Aug 7, 2022

doTweenAngle("gfRotateL", "gf", -15, 0.14, "expoIn")
if getProperty("gf.angle") = `your desired angle` then
doTweenAngle("gfRotateR", "gf", 15, 0.14, "expoIn")
end

check to see if this works.

@EvanOrSomething
Copy link
Author

does the desired angle go in quotations?

@Itz-Miles
Copy link

alternatively:

doTweenAngle("gfRotateL", "gf", -15, 0.14, "expoIn")
function onTweenCompleted("gfRotateL")
doTweenAngle("gfRotateR", "gf", 15, 0.14, "expoIn")
end

@frantastic24
Copy link

frantastic24 commented Aug 7, 2022

Like this? idk

yeah that's correct, now you need to add the other tween using else
also note that with the way you coded this, any tween will trigger this since you didn't check for the tag

@EvanOrSomething
Copy link
Author

She still won't rotate to the right

@EvanOrSomething
Copy link
Author

Maybe it's because it's waiting for the 2 really long tweens I have to finish instead of the angle tween

@Itz-Miles
Copy link

If you were talking about the snippet I pasted, I forgot to change "gfRotateL" to "gfRotateR",

@EvanOrSomething
Copy link
Author

which "gfRotateL"?

@EvanOrSomething
Copy link
Author

Is there a way to maybe instead of making it wait for the tween to finish, just waiting like 50 steps and then playing the next one, and then waiting again

@EvanOrSomething
Copy link
Author

If it's ok I'm just gonna work on this some other time, because this is making my brain hurt.

@Itz-Miles
Copy link

doTweenAngle("gfRotateL", "gf", -15, 0.14, "expoIn")
if getProperty("gf.angle") = `your desired angle` then
doTweenAngle("gfRotateL", "gf", 15, 0.14, "expoIn")
end

@EvanOrSomething
Copy link
Author

Ended up fixing it on my own. I instead made 2 different scripts and put them in the same song, one for just them floating, and one for gf rotating
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants