10-01-2003, 03:51 PM
|
#1
|
|
Registered User
Join Date: Jan 2003
Location: somewhere. But what does it matter?
Posts: 24
|
help with shootemup game
I'm making a shooting game and I've got alot done on it. In one of the movie clips when it comes to a certain frame I want it to play another movie clip on the stage. How do I do that?
|
|
|
10-01-2003, 03:59 PM
|
#2
|
|
I'm back, baby!
Join Date: Jul 2003
Location: Palm Desert, Ca
Posts: 1,148
|
Use absolute paths.
ActionScript Code:
//clip1 frame 10
_root.clip2.gotoAndPlay(2);
//clip2 frame 1
onClipEvent(load){
stop();
}
|
|
|
10-01-2003, 04:12 PM
|
#3
|
|
Registered User
Join Date: Jan 2003
Location: somewhere. But what does it matter?
Posts: 24
|
wow that was fast....but that still doesn't solve my problem. Let me tell you exactly what I'm doing. The first movieclip is a guy shooting the player. There is a frame where it shows the guy firing towards the screen. When it comes to that frame I want the life meter on the bottom to play, but I don't want it to gotoandplay a certain frame because if the guy shoots at the screen twice I want the life meter to be past that frame and on the frame where it says just one life is left because there are only three lives. So whenever the movieclip loops and goes to that frame where the guy is shooting the screen it will take away one life and there are 4 frames where the first one has all three lives, the second has two lives, the 3rd has one, and the last has none and then on the last frame it goes to a certain frame on the main stage that says game over. Can you help me with that?
|
|
|
10-01-2003, 04:14 PM
|
#4
|
|
Registered User
Join Date: Jan 2003
Location: somewhere. But what does it matter?
Posts: 24
|
The only thing I need help with is that one frame where it plays the life meter movie clip that's all I need help with not any of that other stuff.
|
|
|
10-01-2003, 04:28 PM
|
#5
|
|
I'm back, baby!
Join Date: Jul 2003
Location: Palm Desert, Ca
Posts: 1,148
|
Might I suggest something a little more dynamic? Now keep in mind, this AS looks way more complicated than it really is. All the createEmptyMovieClip and drawingAPI can be done at authoring time w/o AS. I just did it this way so that you could cut and paste. To make yours, you would just draw a clip with a border layer and a lifeBar on a layer under that. Make sure the lifeBar has a registration point at the absolute left of it too, because we're scaling against the left side. Anyway, take a look at this code. The point of this is to avoid your goto problem. With this you can simply set the position of the life meter with a function whenever you need to.
ActionScript Code:
life = _root.createEmptyMovieClip("life",1);
life.createEmptyMovieClip("lifeBorder",3);
life.lifeBorder.lineStyle(5,0x666666,100);
life.lifeBorder.lineTo(100,0);
life.lifeBorder.lineTo(100,20);
life.lifeBorder.lineTo(0,20);
life.lifeBorder.lineTo(0,0);
bar = life.createEmptyMovieClip("lifeBar",2);
bar.lineStyle(2,0x000000,100);
bar.beginFill(0xff0000,100);
bar.lineTo(100,0);
bar.lineTo(100,20);
bar.lineTo(0,20);
bar.lineTo(0,0);
bar.endFill();
function sizeBar(path,life){
// assume full life is 100
path._xscale = life;
// set variables that actually control life here or do anything
// else you want to when the life changes, remeber this is
// only graphical
}
sizeBar(_root.life.lifeBar,50);
In the sizeBar function, the second argument controls the life. 50 is half, 100 is full, 0 dead, etc. I'm sure there will be questions, so just holla. I'll be here for a bit.
Last edited by dzy2566; 10-01-2003 at 04:34 PM.
|
|
|
10-01-2003, 04:33 PM
|
#6
|
|
I'm back, baby!
Join Date: Jul 2003
Location: Palm Desert, Ca
Posts: 1,148
|
Here's that mess built at authoring time. Remember, I have it built so the life directly corresponds to the life bar. If that's not the case, like you said you have 3 stages. Then you want _xscale = life/3, not simply _xscale = life. So now you would only enter 3, 2, 1, or 0. I think that the less author-time tweens you use, the better.
Last edited by dzy2566; 10-01-2003 at 04:40 PM.
|
|
|
10-01-2003, 04:55 PM
|
#7
|
|
Registered User
Join Date: Jan 2003
Location: somewhere. But what does it matter?
Posts: 24
|
I am just a beginner and don't have one clue what your talking about after all this is the newbies forum. The code I have on the frame where it will play the life meter movie clip is this
life meter.play();
plain and simple and not working. All I want to do is make the life meter movie clip play when it reaches the frame where the guy is shooting the screen!!!!
|
|
|
10-01-2003, 05:09 PM
|
#8
|
|
I'm back, baby!
Join Date: Jul 2003
Location: Palm Desert, Ca
Posts: 1,148
|
Yes, I understand what you've done. I'm saying you shouldn't be using a movie clip that plays. It would be easier to have a clip that can be changed with a function. Did you check out the attachment I gave you? It is very basic. Play with that a little bit. This solution side-steps your play() problems, because there is no play. No need to get upset. We're all willing to help, but you have to be willing to do some work with us too. We don't know exaclty what your abilities are. Try to play with it and come back with questions a little more specific than "I have no clue.....". I and the other members are more than happy to help.
|
|
|
10-01-2003, 05:15 PM
|
#9
|
|
I'm back, baby!
Join Date: Jul 2003
Location: Palm Desert, Ca
Posts: 1,148
|
Function description:
When you call the size bar function in the following way:
sizeBar(_root.life.lifeBar,50);
In english, you are saying......
"Scale the clip 'lifeBar', which is inside the clip 'life' to 50%. In your case, you've been trying to get a clip with multiple frames to go to the frame that represents 50% health. In this example, there are no frames, so there's no confusion. Rather than having to go through the thought process of.....
"At this point in the game the player should have 50% of his life, which means my life meter clip should go to frame 4"
All you have to do is set the clip to look like whatever you want by passing the clip the scale, throught sizeBar.
"At this point in the game the player should have 50% health, so I have to tell the clip to display 50% health, or sizeBar(_root.life.lifeBar,50)
I hope that helps. If you're trying to build a game, these are very fundamental AS concepts that you will need to do it. So if this frustrates you or seems difficult I suggest trying to understand it rather than trying to get around it. If I can help more, please ask. I'm glad to do so.
|
|
|
10-01-2003, 06:54 PM
|
#10
|
|
Registered User
Join Date: Jan 2003
Location: somewhere. But what does it matter?
Posts: 24
|
it's not really a bar of life it's 3 little glowing squares. Each time you are hit it takes away one it's not a Life bar.
|
|
|
| Thread Tools |
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 10:57 PM.
///
|
|