Picture Rotation Animation with Certain Angle

Started by Stray, June 03, 2013, 03:38:15 pm

Previous topic - Next topic

Stray

June 03, 2013, 03:38:15 pm Last Edit: June 03, 2013, 03:43:59 pm by Blizzard
Is there a script for pictures, making them rotate in a certain angle?

I only found this script call:
$game_screen.pictures[picture number].angle = angle

It only is shows the pic. But i want it to rotate continuously to it's new angle.
I'm very grateful to you all for your great help.

Blizzard

You have to keep calling this code repeatedly and increasing the angle every time. You can use a variable for that, it makes things simpler.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Stray

Unfortunaltely I don't know how to put a variable in a script. :^_^':
I'm very grateful to you all for your great help.

Blizzard

$game_screen.pictures[picture number].angle = $game_variables[variable ID]

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Stray

Is it possible to make a normal movement, too?
I'm very grateful to you all for your great help.

Blizzard

What exactly do you mean? Moving the picture around? Yes, it is.

$game_screen.pictures[picture number].x = $game_variables[variable 1 ID]
$game_screen.pictures[picture number].y = $game_variables[variable 2 ID]

Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

Stray

Ok, that's good, too. But I meant something different:
The picture should move within a specific time from its actual angle to a new angle, released by a single script call. I don't want to animate it like this:
> Wait for 1 second
> Angle +1
> Wait for 1 second
> Angle +1
> Wait for...


I want it to be like:
> Rotate from actual angle to new angle within 10 seconds
I'm very grateful to you all for your great help.

KK20

It would require a Real (decimal number) to keep track of the increments. But it's basically

  • Get current angle and target angle and find their difference

  • Divide this difference by (time_in_seconds * 40)

  • Every frame, add/subtract the current angle by the amount you calculated above



I guess you could also event it, although it won't be perfect, by doing

  • Get current angle and target angle and find their difference => Store in Variable 1

  • Calculate how long it should take in frames (time_in_seconds * 40) => Store in Variable 2

  • Divide variable 2 with variable 1

  • Create Variable 3 and set it equal to Variable 2

  • Parallel Process: Decrease Variable 3 by one. Conditional Branch: if Variable 3 is less than or equal to zero, set Variable 3 to Variable 2 and increase/decrease picture's angle by one

  • Repeat until desired angle, then stop


Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!