|
I'm building a japanese study game and using buttons as the primary mode of movement between scenes. I'm working on a fade in. How do you make buttons move in from the sides?
(comments are locked)
|
|
Make a variable which changes as you want the button to move, and have the button appear off-screen. Here is an example (in Javascript). The coding for however you want the button to move is elsewhere in the script. This is done by changing the values of buttonx and buttony in any way you want until you reach the button's destination. To change the position of the button, continually change the value of buttonx and buttony in the Update() function, like you mentioned below. Here is an example:
(comments are locked)
|
|
Would you then change the buttonx and buttony values in the update function? And how will it make a smooth transition instead of simply moving to the new location? Please use the comment button for comments. If it does not show up, navigate back to your user profile and click on your question(this should reset the buttons). Thanks
May 25 '12 at 05:28 AM
hijinxbassist
(comments are locked)
|
|
Would you then change the buttonx and buttony values in the update() function? How do you move it smoothly rather than simply jumping to the new coordinates? I updated my answer to the question. Also, please post comments using the "add new comment" button under an answer or a question, as @hijinxbassist suggested. It makes the question post clearer when it comes to others finding answers.
May 25 '12 at 02:51 PM
You!
I couldn't see the comment I made, so I double posted. sorry
May 25 '12 at 06:56 PM
pborg
(comments are locked)
|

Are they GameObjects or GUI-buttons?
Store a Vector2 variable that interpolates from off-screen to in-screen in screenspace coordinates, in the Update() function. Then in the OnGUI() function, use that variable to position the button.
All of my buttons are 3d objects parented to my camera, and all my UI text are text meshes. I move them around like I'd move around anything else. There must be some benefit to using the 2d GUI functionality- since most people do- but I'm not seeing it, and I seem to be avoiding a lot of the scaling and positioning problems that others have.
@Unitard That sounds like an answer. Please convert your comment to an answer so you can get more credit for it!