View Full Version : [AS2] game score
Hi,
1)The bombhit score does not work. It is set up in such a way that each bombshell that falls below a certain y=560, it should tabulate the score in the bombhit dynamic textfield.
2)Moreover, if the score in the bombhit >6, it dose not go to the "win" frame.
http://www.4shared.com/file/76751175/6b5f6e84/missilegame3fla.html
Thank you:eek:
Bod720
12-19-2008, 01:15 PM
What do you want it to do intstead of going to the 'Win' frame? (I haven't opened up the .fla yet, so if there is so if there is something obvious in there, then I will see that before I check back on here).
CyanBlue
12-19-2008, 02:39 PM
We have Gaming and Game Development forum which is dedicated for Game development... I understand that you can fit your question to at least more than 1 forum area, but please use this forum for all your game related question... Thank you...
pradvan
12-19-2008, 02:57 PM
your code:
for(i=1;i<=5;i++)
{
_root["bomb"].duplicateMovieClip("bomb"+i,i+1000,bomb);
} //Your for loop ends here
_root.bombhit=0
_root.bombshot=0
//how would flash know what the i below equals to if its outside the for loop?
if(["bomb"+i]._y>560)
...
I want it to go to "win" frame after the score reached a certain number, but it does not go to that frame at all.
Also, I have changed the code to the following, but still I cannot see the score changing in the Bombs hit text field.
http://www.4shared.com/file/76751175/6b5f6e84/missilegame3fla.html
_root.bombhit = 0;
_root.bombshot = 0;
for (i=1; i<=5; i++) {
_root["bomb"].duplicateMovieClip("bomb"+i,i+1000,bomb);
if (["bomb"+i]._y>560) {
_root.bombhit += 1;
_root["bomb"+i].gotoAndPlay("blowup");
}
}
if (bombshot == 4) {
this.speed = random(4)+4;
}
if (bombshot == 100) {
this.speed = random(4)+5;
}
if (bombshot == 6) {
_root.gotoAndStop("win");
}
if (bombhit == 3) {
_root.gotoAndStop("over");
}
Maybe you don't understand that the code in the frame on the timeline only executes when it enters the frame. If you want it to test repeatedly, you should put it inside:
onEnterFrame = function () {
//this code will actually execute every frame until the onEnterFrame function is changed.
}
Also note what Pravdan pointed out about your for loop.
fgerhtrfg
12-27-2008, 03:20 AM
What do you want it to do intstead of going to the 'Win' frame? (I haven't opened up the .fla yet, so if there is so if there is something obvious in there, then I will see that before I check back on here).
:rolleyes:
oh , and i do not know how to do that , but i want to help you , and i can not understand you clearly?/
orange gold
12-28-2008, 06:37 AM
you have to add the _root.onEnterFrame = function() {
to the if detectors otherwise they arent always called...
replace the old code with this...
_root.bombhit = 0;
_root.bombshot = 0;
for (i=1; i<=5; i++) {
_root["bomb"].duplicateMovieClip("bomb"+i,i+1000,bomb);
if (["bomb"+i]._y>560) {
_root.bombhit += 1;
_root["bomb"+i].gotoAndPlay("blowup");
}
}
_root.onEnterFrame = function() {
if (bombshot == 4) {
this.speed = random(4)+4;
}
if (bombshot == 100) {
this.speed = random(4)+5;
}
if (bombshot >= 6) {
_root.gotoAndStop("win");
}
if (bombhit == 3) {
_root.gotoAndStop("over");
}
}
|
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.