[Solved] Tween timing taking too long & [Solved] Control direction of angle tween

Hi everybody, is there any way of controlling which direction an angle tween takes? I assumed it would take the shortest path, but for me it’s taking the longest path. I have a figure that should tween position down on the y axis and at the same time its arms should angle tween from out to the side to almost straight up. But the arms take the long way round, haha and look crazy. Here’s a quick drawing of what I mean. On the left is the starting position and on the right the end position (Y movement not shown). So the left arm should go clockwise but instead it goes anti clockwise and the right arm goes the long/wrong way too. I had a look in the angle field of the tween at Object but didn’t find anything suitable or that made sense (to me).

Update, just saw I had a tween naming error in the reset event. I fixed it, but it makes no difference to the problem.

Update number 2. I also found a timing mistake in the angle tween, I forgot to make it the same as the y position tween. Fixed it, but problem remains.

Hi, you can rotate in the opposite direction if you use negative degrees.

1 Like

I tried that, so for the left arm, I changed 75 to -75 and it still went in the wrong direction but went to about ‘7 o’clock’ instead of ‘11 o’clock’. The angle seems to be relative to the position of the object, not an absolute value.

What is the basic alignment of your arm sprites when you load them into the object list? If rotation should work properly they have to be set horizontally or to 0, like here:
Capture_rotate2

Capture_rotate

Edit: I just saw that your right arm looks okay, but your left arm has to be set up in the same way. You can change its rotation on the player in the editor or through events.

1 Like

Have you enabled the motor setting on your revolute joint? If so, have you tried a negative motor value?

1 Like

It was a bit confusing for me at first, but it’s working perfectly now. Drona, you were right that there was a problem with the left arm. Instead of having its initial rotation as 355, I changed it to -5.
And the negative number thing worked perfectly for the right arm. And for the left arm, a positive number worked. With the same actual rotation value for both. And the animation looks soooo gooooood, I can’t stop looking at it, haha.

MrMen, I had this angle tween working perfectly in a test game and had no motors. But I didn’t use actual proper images, just blocks and I must have fluked getting it working properly as when I went back and looked at it for guidance, the blocks were rotated all sorts of strange ways which is why non matching numbers with the same sign must have worked.

1 Like

I have another problem with this now.

I have a boolean variable with an initial state of false.
When the start/reset button is clicked, it toggles the state of this boolean variable.
When the boolean variable is true the tweens in y and angle begin.

But, the tween takes approximately 5 times longer than it should. So, for example, a 2000ms tween takes about 10 seconds or 10000ms

The same thing happens if I make clicking the start button change a variable to 1 and then
when variable is 1, start the tween.

But if I make the button clicking action directly activate the tween, it works in the correct time of 2000ms.
It also works correctly if I make the trigger a keyboard press.

So I tested activating the angle tween in my previously mentioned test game with a variable and same result, 5 times longer til the tween finishes. This test game has no conflicting distractions or other complications. Pure tween. I originally had space bar is pressed to activate it and that worked in the correct time.

Here are the events for the simple version. As with the real version above, the arms have a physics and tween behavior.

Having a simplified version may not help. For example, you don’t have a trigger once on the last event (or check if the tween already exists), so the create tween is being run every frame until TestSwitch is no longer 1. Are you doing this in the real version?

1 Like

Oh my goodness, am I yet another victim of Trigger once deficiency disease?

If I add Trigger once, then yes, you’re right, :smiley: the tween takes the correct amount of time. I think I did have a trigger once in there a few days ago and removed it, because when the character reached the bottom position of the tween, it popped back up again to the initial position. And I want it to stay in the new position.

I hadn’t added any extra tween conditions or actions because apart from the timing, it seemed to be working. But I have now added tween existence checkers just to see and it didn’t change the return to original position problem.

Here is the proper version with the new things highlighted. Also shown with red arrows is one of my attempts to fix the return to initial position problem. It works but I don’t like it. And it will probably mean extra also unlikeable steps for the reset tween.

That attempt will never work. The “Tween ‘sink’ on Player has finished playing” is a subevent of the condition “Tween ‘sink’ doesn’t exist on Player”. So if it doesn’t exist, it can never be finished playing.

Yes, you’re right, I had already moved it to be its own event to get it working while writing my reply to you and forgot to delete that screenshot and paste in the new one. So is that the best way to do it? It seems awkward to have to tell it to stay in that position by manually setting the y value again.

Update, if I leave it that way, then because the tween has finished playing and stays in that state, the reset tween doesn’t work. Will leave it until my brain is fresher.

Another update:
Please see down at post number 26 for the final result. What lies between is a very nice series of posts with a story development unrelated to tweening or angles.

This is probably worthless, but I had fun making it:

Arms Up

2 Likes

I looooooove it. DirtBody. Yes. DirtBody is your next game hero, Epicsleeper. It leaves trails of dirt everywhere, no one wants to hug it, life can be tough when you’re just dirt.

Yes, thank you, I’ll add torque to my candidates for getting it to work properly, it’s always interesting to see the different ways of achieving the same thing.

1 Like

Haha :laughing: I love the story you created for DirtBody. Feel free to use him, he is now public domain :stuck_out_tongue: DirtBody is everybody’s buddy.

1 Like

Except for plant girl? But every time she touches him, his nutrient and moisture levels decrease. Avoid her at all costs, or DirtBody (DirtBoy?) will wither away .

2 Likes

Hello world, the start was right here at this moment.


Ooh haha, nice thinking :potted_plant:
But that’s actually really interesting because not only will DirtBoy suffer from contact with PlantGirl, but so too will PlantGirl suffer if DirtBoy successfully evades her. There can never be a state where they both are happy.

I sense a hollywood film in the making here, all based on a best selling video game. A tragic love story not even Shakespeare could have conjured up. The plot is complicated even further by the appearance of WormGuy.

Haha, yes! And I was thinking of their quest to find a good source of FertiliserPotion so that they can live happily together. They can find small amounts sometimes to power them for their travels seeking the magical potion. But as soon as it runs out they have to separate which makes travel and communication much more difficult. I haven’t thought what role WormGuy plays in this.

1 Like

What about Stan The Quicksand Man, might be a good final boss.

Both PlantGirl and DirtBoy seek the attention/help of CompostKid.

PlanfGirl is often beseiged by the BugBandits that thrive off her (aphids, caterpillars, snails etc).

Meanwhile DirtBoy has to avoid the The DirtyDiggers (cats, dogs, rabbits etc).

If the two are low on energy, they can top up in the ShedOfGarden (as long as the aid is not past it’s best by date).