PDA

View Full Version : Possible to move a text?



Loveboy
2nd October 2013, 17:13
Hello Guys!
Is it possible to move a text?

I tested it:

as first i precached the text in tdm.gsc



precacheString(&"Test");


Then called a thread in Callback_StartGametype()



thread test();


Then i created down a new thread and here is it:



untendertext()
{
level.text = newHudElem();
level.text.x = 60; //630
level.text.y = 450; //475
level.text.alignX = "left";
level.text.alignY = "middle";
level.text.sort = 1; //-3
level.text.alpha = 1;
level.text.fontScale = 0.9;
level.text.archived = true;
level.text setText(&"Test);

// Now it's possible to move the text? I tested it!
level.text movex(-320,1);
// and hide and show too?
while(1)
{
level.text hide();
wait 1;
level.text show();
}


Now i have get this error:



not an entity: (file 'maps/mp/gametypes/tdm.gsc', line 1614)
level.text movex(-320,1);


So I see it's not possible.
But there is another way to move it?

Would be nice if you help me :)
Thank you!

Ni3ls
2nd October 2013, 17:23
You need to use moveovertime(time);

RobsoN
2nd October 2013, 17:23
1. http://zeroy.com/script/
2. HUD
3. MoveOverTime


If you want to move your hud to x = 20, code should looks like:



time = 1;
self.hud MoveOverTime(time);
self.hud.x = 20;



Of course you can link together y and x in on one time:



time = 1;
self.hud MoveOverTime(time);
self.hud.x = 20;
self.hud.y = 120;


Now, your hud in 1 second move to x = 20, and y = 120.

Loveboy
2nd October 2013, 17:33
Thank you! Btw which of the things will show the text front?



level.text = newHudElem();
level.text.x = 60; //630
level.text.y = 450; //475
level.text.alignX = "left";
level.text.alignY = "middle";
level.text.sort = 1; //-3
level.text.alpha = 1;
level.text.fontScale = 0.9;
level.text.archived = true;
level.text setText(&"Test);

Ni3ls
2nd October 2013, 17:57
what do you mean with text front?

Loveboy
2nd October 2013, 18:06
So that the text is front of all, it's at the moment behind all ( behind the compass )

serthy
2nd October 2013, 19:13
So that the text is front of all, it's at the moment behind all ( behind the compass )

hud.sort = -1;
hud.foreground = true;

IzNoGoD
2nd October 2013, 20:06
first set an origin (.x and .y) of your hud, then call moveovertime(time) and right after set another .x and .y of your hud to make it move.