Hello readers,
So I'm having a bit of a problem, but first I'll explain what I'm trying to do. Basically I've created something that functions like a radial menu (think a pie slices into 5 pieces, each piece being an option you can select). Since the art I'm working with isn't very GUI friendly, I thought I'd do it in 2Dtoolkit. Basically I plan to have it cycle around, then based on what frame it's on when you press the select key, it will do whatever is shown.
The problem is, is that it just doesn't work. I'm starting small, with a three section radial. It starts on one frame, and if you press one key, it should scroll to the left, and to the right with the other key. Except it barely ever seems to do that. Sometimes I can get it to work going to the proper frame from to the left or right once from the starting point, but that's it. I've looked and tried a lot of things on this forum, but I haven't been able to find something that works. Here's my current strategy:
anim.Play ("Radial1");
anim.Pause();
if(Input.GetKeyUp(KeyCode.U) && currentFrame == 0){
anim.SetFrame(1);
currentFrame = 1;
}
if(Input.GetKeyUp(KeyCode.O) && currentFrame == 0){
anim.SetFrame(2);
currentFrame = 2;
}
if(Input.GetKeyUp(KeyCode.U) && currentFrame == 1){
anim.SetFrame(2);
currentFrame = 2;
}
if(Input.GetKeyUp(KeyCode.O) && currentFrame == 1){
anim.SetFrame(0);
currentFrame = 0;
}
if(Input.GetKeyUp(KeyCode.U) && currentFrame == 2){
anim.SetFrame(0);
currentFrame = 0;
}
if(Input.GetKeyUp(KeyCode.O) && currentFrame == 2){
anim.SetFrame(1);
currentFrame = 1;
}
Looks pretty simple, but nothing ever seems to work right. I don't even know if the first frame in the animation counts as frame 1 or 0, but whatever number I put in doesn't seem to matter. I just have the three images of the radial set up in an animation. If anyone has any suggestions or better ways to do this, I would be really thankful. I only have a few days left to get this working.
Thanks for reading !