Hey, this is a general math question. It mainly has to do with rotating pictures along a radius. My problem is the menu rotates once correctly and then stops rotating properly.
I'm designing a spin menu using events and (mostly) event scripts. I want to release this to the public as a plug and play event.
First I establish our center point, which for this purpose is our screen center. I create a variable that stores the number of menu options we have, because I want that to be factored into the math. I also store the correct spacing in radians between each item. I use only 1 variable to manipulate each item's X and Y place. I also store the index.
That event script looks like this:
@options = 5@centerx = 258@centery = 208@itemx = @centerx@itemy = @centery@mindex = 1@rotate = 360/@options/20*Math:

I/180screen.pictures[0].show('Menu BG', 0, 0, 0,100, 100, 160, 0)
I show the background for the menu, and then draw all the pictures at the center X and Y.
From here I move all my pictures out to their proper spot, so they sort of burst from the center. It's simply aesthetic.
The formula here is done fine, and each item on the menu goes to it's proper x and Y coordinate.
I then establish button press checking via the standard loop, wait, conditional branch.
It register left, right, esc, and enter.
I have a problem with left/right rotating the wheel though. It seems to go the right amount the first time, but stops moving after 1 press. It's not frozen. I can hit esc and enter and left and right. Going the other direction rotates it a very tiny amount before stopping.
Also it's not discerning a difference between left and right rotation despite me subtracting the rotation variable instead of adding it.
Here is the code in text format:
@count = 0Loop @count += 1 @frame = 0 Loop @frame += 1 @dx = @itemx - @centerx @dy = @itemy - @centery @dist = Math.sqrt(@dx*@dx + @dy*@dy) @angle = Math.atan2(@dy, @dx) + @rotate n = @centerx+@dist*Math.cos(@angle) @itemx = n n = @centery+@dist*Math.sin(@angle) @itemy = n screen.pictures[@frame].move(0, @itemx, @itemy, 100, 100, 255, 0, 15) @dist = Math.sqrt(@dx*@dx + @dy*@dy) n = 360/@options*Math:

I/180 @angle = Math.atan2(@dy, @dx) + n n = @centerx+@dist*Math.cos(@angle) @itemx = n n = @centery+@dist*Math.sin(@angle) @itemy = n Conditional Branch: @frame >= @options Wait: 1 frame(s) Break Loop Branch End Repeat Above Conditional Branch @count > 20 Break Loop Branch EndRepeat AboveI know it's mostly scripting, which I have some basis in, but this is in an evented menu, not a script. I have no intentions of making it a script. I'd rather keep it a plug in-able Evented menu.
I know almost all this could be done with just events, the math stuff is the only thing you can't do without an Evented Script. I decided to go with scripts to avoid long conditional branches and tons of variables. I'll plug in a easy interface to the wheel once it's done.
This is a demo of where I'm stuck at now:
http://dl.dropbox.com/u/5536575/Custom%20Picture%20Menus.exe
Anyways, help appreciated! Apparently I'm doing something incorrectly.