polyglot
Programmer
- Nov 28, 2007
- 11
Hello-
I have posted before and have been able to solve my previous problems... but now I have a new one:
I am creating a game in which I have a movie clip serving as an aimer mechanism so that the player can hit a bullseye target. In the movie clip I have a dot moving back and forth serving as the aiming sight; ideally this is what I want:
The player will click a button. When they click the button, I want the following to happen:
1. The aimer movie clip stops.
2. The program gets the frame number where the movie clip stopped.
3. The program does 3 different things, depending on the frame number of the stopped movie clip (Say - if the frame number is between 1 and 2 or between 10 and 11, the player has missed the target and a dynamic text box tells them "You missed." If the frame number is between 3 and 5 or between 7 and 9, the dynamic text box displays something like "You have hit the periphery." If the frame number is 6, the dynamic text box displays "BULLSEYE!").
I am using the following code, but my game goes beserk and jumps to other frames rapidly and erratically when the button is clicked. The code is not inside the movie clip, but rather on the level on which I have put the clip (level 0?). Can anyone offer any insight? Sorry if the code looks clunky and junky - I am new to Flash and Actionscript.
btnThrow.onRelease = function() {
_root.aimerslow.stop("aimerslow");
_root.sframe = _root.aimerslow._currentframe;
if (_root.sframe <= 24) {
gotoAndStop("victim");
}
}
Thanks,
Monica
I have posted before and have been able to solve my previous problems... but now I have a new one:
I am creating a game in which I have a movie clip serving as an aimer mechanism so that the player can hit a bullseye target. In the movie clip I have a dot moving back and forth serving as the aiming sight; ideally this is what I want:
The player will click a button. When they click the button, I want the following to happen:
1. The aimer movie clip stops.
2. The program gets the frame number where the movie clip stopped.
3. The program does 3 different things, depending on the frame number of the stopped movie clip (Say - if the frame number is between 1 and 2 or between 10 and 11, the player has missed the target and a dynamic text box tells them "You missed." If the frame number is between 3 and 5 or between 7 and 9, the dynamic text box displays something like "You have hit the periphery." If the frame number is 6, the dynamic text box displays "BULLSEYE!").
I am using the following code, but my game goes beserk and jumps to other frames rapidly and erratically when the button is clicked. The code is not inside the movie clip, but rather on the level on which I have put the clip (level 0?). Can anyone offer any insight? Sorry if the code looks clunky and junky - I am new to Flash and Actionscript.
btnThrow.onRelease = function() {
_root.aimerslow.stop("aimerslow");
_root.sframe = _root.aimerslow._currentframe;
if (_root.sframe <= 24) {
gotoAndStop("victim");
}
}
Thanks,
Monica