View Full Version : dynamic text problem
omega10mg
02-08-2003, 02:23 PM
I'm making a game, and its almost done, but i need a way to show score..
the longer you survive the game the higher score..
so i was thinking that i want a dynamic text field to + 1 every second. know what i mean?
but how do i do this? i checked the help on dynamic text and so on.. but i cant figure it out.. plz help =)
binkyboo
02-08-2003, 02:33 PM
i = 0;
//test is the instance name of your dynamic textfield
_root.test.text = 1;
function addSeconds() {
_root.test.text++;
i++;
}
myInterval = setInterval(addSeconds, 1000);
omega10mg
02-08-2003, 02:39 PM
thanx m8! it worked!
hum.. one more problem.. how do i make it stop?
and can i copy the end value (the points you had when u died into another dynamic text)?
omega10mg
02-08-2003, 04:59 PM
i tryed to do this to copy the value:
_root.sco.text = _root.stat.text
but it did not work =(
and how do i make it stop?
CyanBlue
02-08-2003, 05:40 PM
Howdy... :)
I'm kinda lost track of your last thread...
See if you can do this...if (yourCharacter == dead)
clearInterval(myInterval);Which is basically stopping the execution of addSeconds() function, so you don't get to see the score going up..._root.sco.text = _root.stat.text;I am not sure what you are trying to do here, but this is what I did... I created two dynamic text fields and named them 'sco' and 'stat', and gave this script..._root.stat.text = "111";
_root.sco.text = _root.stat.text;and I see '111' on both text fields... Is this what you want??? I am not quite sure... :)
omega10mg
02-09-2003, 12:59 PM
hum...almost... heh
_root.stat.text = "111";
_root.sco.text = _root.stat.text;
That did not really helped.. but almost...
i want sco.text to be what the stat.text was when i died.
sco.text will be shownd when u die, Your score was: ???
u understand?
but then again.. u might be right, but what confuses me is _root.stat.text = "111";.. hum.. yeye..
i'll try somemore.. heh..
CyanBlue
02-09-2003, 09:54 PM
Um... Am I supposed to die soon??? :(
Why don't you show us what your code looks like or some sample FLA file if you need further assistance??? That' is the best I could do without knowing what you have there and where your limitation lies...
omega10mg
02-09-2003, 10:15 PM
hum.. but it cannot be that big of a problem. hum
i mean all i want is to know how i can copy the info from one dynamic textfield to another.
and how to make the code, posted above to stop.
CyanBlue
02-09-2003, 11:00 PM
> hum.. but it cannot be that big of a problem. hum
Yup... It's not... :)
> i mean all i want is to know how i can copy the info
> from one dynamic textfield to another.
Yup... That's exactly what I have showed you with two lines of code... That code does what you have asked, and yet you are still not sure how you can adapt it to your case, right??? That's why I want you to create a little sample so that I can help you better... I don't want to see your whole movie file... There is no reason for that...
> and how to make the code, posted above to stop.
What do you mean by that??? Stop what??? I don't quite understand that...
omega10mg
02-10-2003, 12:15 PM
here is some code, hope it helps to help =)
//This is in the first frame, it starts the "score"
i = 0;
_root.stat.text = 1;
function addSeconds() {
_root.stat.text++;
i++;
}
myInterval = setInterval(addSeconds, 1000);
//this is in the ground MovieClip, to check if the spacecraft collides.
onClipEvent (enterFrame) {
if (this.hitTest(_root.craft)) {
tellTarget ("_root.craft") {
gotoAndPlay(20);
}
}
}
//this is were i want the score to stop going up too, if u collide with the wall.
//and then I want the score to be shown, in the RETRY MOVIECLIP, its a only a black box, where it stands retry and so on.
hope this helps you to help me.
i am really thankfull for all your help! =) thanx dude!
CyanBlue
02-10-2003, 08:34 PM
See if this example makes sense to you...
I just created a simple one so that you will see what you need to solve your puzzle... :)
Oh... Don't call me a dude... I hate that word... :p
omega10mg
02-10-2003, 09:18 PM
Originally posted by CyanBlue
See if this example makes sense to you...
I just created a simple one so that you will see what you need to solve your puzzle... :)
Oh... Don't call me a dude... I hate that word... :p
okey dude.. thax dude! :p
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.