View Full Version : game doing strange things
Billy T
06-12-2003, 12:52 AM
Howdy
one of my students is making a game that is doing strange things I can't work this one out
Please have a look at the attached file
hit the space bar to start a box dropping down - use up and down arrows to control it. When it lands on the ground or another box, hit the space bar again to start another box falling
Problems - when a box lands on another it is meant to check whether or not the stack is off balance and if it is - make them all explode. However, sometimes (for no reason that I can see) a box or 2 are just left there on the stage. You can see from the trace that they were in the array to be removed and if you click on them the names are right but they just don't blow up!!
Problem 2 - sometimes after the boxes have exploded, the next box to come down will not act as planned and will be removed as soon as the one after that starts coming down - you'll see what I mean
If anyone can shed some light on this it would be much appreciated
cheers
i will try to have a look... ;)
oh and i like the name of the function... lol
Sorry (or not) but i tried and didn't see the bug AT ALL...
???
CyanBlue
06-12-2003, 03:00 AM
Keep playing... I saw it happening a couple times but not all the time, and I have no idea what the heck is wrong with it... :(
ok so i will test one more time...
:o
Billy T
06-12-2003, 03:21 AM
thanks for checking it out
yeah I'm pretty sure its a bug as the problem is pretty simple but it just doesnt do what it is meant to do
I have tried for loops that send each clip to the die frame 10 times but some of them just want to stay put
another test I did was trace the currentframe of each clip after the goto - they all go to frame 20 but only some play from there - the others stop
thanks
Hmmm did you try with a longer interval for your setInterval.
I dunno why but i think it could be something like this (it's the only answer I found).
Perhaps your function is too quickly called and sometimes, i dunno if it can be like this (-i suppose-), the function is called twice at the same time like doing twice:
clipsOnStage[i].gotoAndPlay("die");
i++;
so your i var is inc by 2 and not 1 and then a box is left on the _root...
... hmmm ... Ok i will stop taking drugs and will drink cold water... Promise.. ;)
PS: I'm actually at work, so my brain is a little slow. But if there is no answer, i will try to look this tonight... ;)
It's not so stupid...
It could be why if you have a box still on the ground, there is another one too after this one (like box 1 && 5), and why there is only one when it occurs on the last box (number 8)... Why? cause the i stop one step before (you know the one you diseapper)...
no?
Ok, I will stop drugs tomorrow... Hmmmm
try to pass the i var as a params and then return it.
Like this you will get FOR SURE the CORRECT value for I...
*i think*
? where's my fix ?
EDIT: the problem is to know if you can return value with setInterval called function???
Ok, i've search for an answer instead of working on my delphi project. So pls stop asking question like this...
function removeTheF___ingBoxes(myCount) {
if (myCount<clipsOnStage.length) {
clipsOnStage[i++].gotoAndPlay("die");
} else { ...
In that case it do the two thing at the same time.. Inc I and play the movie...
I test and think it works...
Billy T
06-12-2003, 04:41 AM
I think you should stop taking drugs...and to stop you being tempted you should give whatever you have left to someone that will take good care of them...
check out the attached file - calling the function once per second...i var counts up just fine but sometimes a box still gets left behind :(
thanks for your help on this
Billy T
06-12-2003, 04:43 AM
so what would you call that function with?
Ooopss didn't give all the stuff...
//end of fallTest function
trace(clipsOnStage);
clearBoxTimer = setInterval(removeTheF___ingBoxes, 50);
}
}
}
function removeTheF___ingBoxes() {
if (i<clipsOnStage.length) {
clipsOnStage[i++].gotoAndPlay("die");
} else {
clipsOnStage = new Array();
b = 0;
clearInterval(clearBoxTimer);
}
}
Here it is... and working... ;)
EDIT: look the function I changed it.. NO needs of the params (you can't see it i removed it.. lol)
Billy T
06-12-2003, 04:59 AM
still doesnt work for me
so basically you were increasing i in here
clipsOnStage[i++].gotoAndPlay("die");
instead of just after like
clipsOnStage[i].gotoAndPlay("die");
trace(i);
i++;
?
yeah.. Doing the two things at the same time and you're sure that all will be ok...
Saying that doesn't work...?
Seems ok here...
:confused:
Arrrrrrrrrrrrrrrrggggg
ok i retest and seems that we need to pass the params..
so here it is with the params...
function fallTest(clip) {
if (b>1) {
if (clip._x<(clip.hitTarg._x)-13.3 || clip._x>(clip.hitTarg._x)+13.3) {
i = 0;
trace(clipsOnStage);
clearBoxTimer = setInterval(removeTheF___ingBoxes, 50, i);
}
}
}
function removeTheF___ingBoxes(myCount) {
if (myCount<clipsOnStage.length) {
clipsOnStage[i++].gotoAndPlay("die");
} else {
clipsOnStage = new Array();
b = 0;
clearInterval(clearBoxTimer);
}
}
... *saying nothing and waiting billy t feedbacks*
Billy T
06-12-2003, 05:53 AM
sorry chief - same problem still happens occassionally
check out the trace with your code - array isn't being cleared properly
appreciate your efforts on this
Billy T
06-12-2003, 06:14 AM
praise the lord I think I have the answer
stick a stop action in the first frame of the box mc
for some unknown, my student (who shall remain unnamed...let's just call him Matt...) has put a loop in there that is doing nothing. In frame 10, there is a gotoAndPlay(1). If this action coincides with the
gotoAndPlay("die");
action that happens in the reset then it causes it all to stuff up
Now, Matt...
gotoAndPlay("die");
;)
Now, Matt...
gotoAndPlay("die");
lol
Arrrrrrrrrrrrrrggggg....
Don't think to look inside this f____ingBox... lol
Glad to hear that you get the answer...
CU
Billy T
06-12-2003, 10:41 PM
thanks again for your time on this
cheers
|
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.