don't laugh: simple gotoAndStop/Play problem...
ok, i have noticed something:
code:
gotoAndStop(5);
trace("hello");
^ it traces "hello". without using any if statment, is there a way that flash goes to frame 5 without reading all the code that is above the gotoAndPlay()? imagine that the trace here is in my game something like 300 lines of code that i don't want to be calculated anymore...
another example:
code:
function next_f(frame) {
delete next_f;
gotoAndStop(frame);
trace_f();
}
function trace_f() {
trace(_currentframe);
}
next_f(5);
here, even by deleting the function, it's still read in its intergrity before being deleted.
that one works, but that's not what i want:
code:
function next_f(frame) {
delete trace_f;
gotoAndStop(frame);
trace_f();
}
function trace_f() {
trace(_currentframe);
}
next_f(5);
ok, basically what i want: is there a way to "break" a code before it's finished, like the break; method that works with for loops? i mean, without using if statments everywhere, because i have TONS of code (it's for my fighting game)
here's a better description of the little problem i have:
that fighting game require a lot of keys interaction, and is filled with tons of function... imagine that at the same frame, the player attacks and exactely at the same time recieve a hit > so there are here 2 times a gotoAndPlay() at the same time. what's the result?
the enemy loses life, the hit effect is attached, but he doesn't play his hit animation and directly goes to his attack animation... it's probably like saying:
code:
gotoAndPlay("hit")
// lose life, etc
gotoAndPlay("attack")
ok, it's not the only example i have, but when it occurs, it's not funny :-(
oh, another question, sometimes flash seems to be confused... a gotoAndStop() becomes gotoAndPlay(), or goes to a wrong frame (never mentioned by me since it was a blank and unlabelled frame in the middle of the movie), some _x/_y values may be wrong (that's true!) etc...
i'm now in the process of cleaning the code a bit, since the engine is almost finished, but i want the game to look the best possible and get rid of all these little annoying bugs.
so my question is: using a lot of values that have almost the same may confuse flash or not? example:
var key_checker
function key_checker
var key_check_minus
var key_check_error
...etc...
^ these names are quite similar, do you think they may perturb flash?
thanks for any response
Re: don't laugh: simple gotoAndStop/Play problem...
Quote:
Originally posted by marmotte
imagine that at the same frame, the player attacks and exactely at the same time recieve a hit > so there are here 2 times a gotoAndPlay() at the same time. what's the result?
the enemy loses life, the hit effect is attached, but he doesn't play his hit animation and directly goes to his attack animation.
You could make array of animations to play.
Player got hit - add hit animation to the end of play_animations_array
Player attacks - add attack animation to the end of play_animations_array
Every time animation is finished, take first element from play_animations_array and play it.
Quote:
so my question is: using a lot of values that have almost the same may confuse flash or not? example:
var key_checker
function key_checker
var key_check_minus
var key_check_error
^ these names are quite similar, do you think they may perturb flash?
[/B]
I would avoid those:
var key_checker
function key_checker
Those look fine:
var key_check_minus
var key_check_error
Re: Re: don't laugh: simple gotoAndStop/Play problem...
Quote:
Originally posted by tonypa
I would avoid those:
var key_checker
function key_checker
sorry, i misstyped it...
the var is called
> k_rec_checker
and the function
> k_rec_check()
don't you think flash can mix them accidentally during all these simultaneous codes?
about your frame array suggestion, that is interesting. i'll try do to something with it.
your idea: avoid gotoAndStop("hit") BUT use frame.unshift("stand_hit_medium"). i understand the concept, and i'll try it, thanks... (hop, a new array again :-) i have tons of them too)
Re: Re: Re: don't laugh: simple gotoAndStop/Play problem...
Quote:
Originally posted by marmotte
the var is called
> k_rec_checker
and the function
> k_rec_check()
don't you think flash can mix them accidentally during all these simultaneous codes?
No, I dont think they can be mixed up.
If Flash would mix something like this, what about all the stuff in tbw:
t_0_1
t_0_2
...
t_0_235
It would be complete mess :)