Game Development Community

Animated GUI objects

by Bill Henderson · in Torque Game Engine · 04/23/2002 (12:37 pm) · 8 replies

I am wondering what would be the best way to have GUI objects smoothly move around the screen.

I was thinking of just writing a script that takes the beggining and end points of the translation and changes the GUI's coordinates over time.

Is there a better way to do this?

#1
04/23/2002 (1:52 pm)
I wrote an actual gui component for TSRR that does this. I keep meaning to clean it up and submit it as a resource...
#2
04/23/2002 (2:20 pm)
Could you send it to me?
Send it to Monkey_Drone@hotmail.com

Ill see if I can clean it up a bit.
#3
08/07/2002 (2:47 pm)
I too would be interested in making GUI elements move around the screen smoothly.
I would be most grateful for any help/tips on doing this.

Did the component mentioned ever get cleaned up?
#4
08/07/2002 (4:03 pm)
I have just been having a go myself and I have managed to get a GUI control so I can set the coordinates that I wish it to be displayed at.

I added 2 dynamic fields, 'x' and 'y' and then just used
.position = (.x -257)+" "+.y;

e.g. movingGUICtrl.position = (movingGUICtrl.x-257)+" "+movingGUICtrl.y;

This probably isn't the best way of doing it and I shall keep plugging away to see if there is a better way. The fact I have to subtract 257 from the x coordinate puzzles me. Looking at the engine it looks like it does a modulo on the coordinates, but I am puzzled why it only affects the x coordinate. Anyone shed any light on this? (It's probably something simple that I am just not seeing as I am tired)
#5
08/07/2002 (4:31 pm)
Guys,

If youre going to submit a useful resource like this, can you do me a favour and add in spline path support for it (not just point A to point B interpolation).

Ok, not if you dont feel like it, but it'd be spankingly cool if you did.

Phil.
#6
08/09/2002 (1:13 am)
I finally got the component moving function sorted. I was using + as a string concatenator instead of the proper @.

function moveGUICtrl(%guiHandle, %gui_x, %gui_y) {
// Move GUI Control to x,y
%guiHandle.x = %gui_x;
%guiHandle.y = %gui_y;
%guiHandle.position = %gui_x@" "@%gui_y;
}

Strictly speaking, I don't need to update %guiHandle.x and %guiHandle.y but I do so in case I need to grab the value of any coordinate.

I am working on a function that will get called every processTimeEvent which will move any GUI control that needs moving. At the moment I have it bouncing a control around the screen like a Pong ball :)
#7
08/09/2002 (11:40 am)
I've just finished up writing up a working version of a gui control that does this smoothly across the screen. A few bugs still need to be worked out and i regret to inform you that it will probably be tommorow before i'm able to release this as a resource, i'm about to head off for work right now :(

At any rate it's a neat control, I went ahead and added in Spline path support for you Phil :o and you may also use a simple point a to point b line path.

Just wanted to let you guys know that it's almost done and i'll submit it soon.
#8
08/09/2002 (12:13 pm)
That sounds pretty cool Justin.
I anxiously await its release :)