Forum Topic: Help on a FPS game

(147 views • 6 replies)

This topic is 1 page long.

<< < > >>
None

Jovatov

Reply To Post Reply & Quote

Posted at: 7/7/06 02:51 AM

Jovatov LIGHT LEVEL 16

Sign-Up: 04/26/04

Posts: 1,879

It's not really a FPS, just some shooter thingie actually.
Anyways, here it is:
Link

Just shoot the thing and it falls down.
I know how to make the score thing work and all that.
The problem is how do I use the duplicatemovieclip() thingie here?
I want it to be that there randomly spawns a plane,
I read the tutorial on AS Main, but I can't find out HOW to use it, like and especially in combination with a for loop.
How can I make a for loop that like when you click the plane_mc it duplicates another plane that comes from the left?
I know all the bits, like random and duplicatemovieclip and for loops, I know how they work, don't link to AS main cus it's not necessary, I just don't get how to mix them all together.

I hope you understand and are able to help me.

Thanks in advance.


None

shazwoogle

Reply To Post Reply & Quote

Posted at: 7/7/06 02:59 AM

shazwoogle NEUTRAL LEVEL 10

Sign-Up: 09/27/04

Posts: 2,661

well have somthing like this

on(release){
_root.plane_mc.duplicateMovieClip("plane_m
c"+_root.planeCount, _root.planeCount)
_root["plane_mc"+_root.planeCount]._x = 0

_root.planeCount++
}


None

shazwoogle

Reply To Post Reply & Quote

Posted at: 7/7/06 03:01 AM

shazwoogle NEUTRAL LEVEL 10

Sign-Up: 09/27/04

Posts: 2,661

also forgot to mention... add _root.planeCount = 0; on load somewhere


None

Jovatov

Reply To Post Reply & Quote

Posted at: 7/7/06 03:03 AM

Jovatov LIGHT LEVEL 16

Sign-Up: 04/26/04

Posts: 1,879

At 7/7/06 02:59 AM, shazwoogle wrote: well have somthing like this

on(release){
_root.plane_mc.duplicateMovieClip("plane_m
c"+_root.planeCount, _root.planeCount)
_root["plane_mc"+_root.planeCount]._x = 0

_root.planeCount++
}

OK...
But if I click that new plane, it wouldn't create a new plane, becuase now the name of that new plane is "plane_mc"+_root.planeCount and not just plane_mc so I think that doesn't work.

Or am I missing something? (Thanks though)


None

Old-Style-Clock

Reply To Post Reply & Quote

Posted at: 7/7/06 04:21 AM

Old-Style-Clock LIGHT LEVEL 17

Sign-Up: 05/28/04

Posts: 2,683

dynamic text and instances??


None

Jovatov

Reply To Post Reply & Quote

Posted at: 7/7/06 08:37 AM

Jovatov LIGHT LEVEL 16

Sign-Up: 04/26/04

Posts: 1,879

At 7/7/06 04:21 AM, Old_Style_Clock wrote: dynamic text and instances??

Dynamic text? How would I use that for duplicating MC's and stuff?


None

GameSQUID

Reply To Post Reply & Quote

Posted at: 7/7/06 09:05 AM

GameSQUID NEUTRAL LEVEL 02

Sign-Up: 07/13/05

Posts: 95

At 7/7/06 02:59 AM, shazwoogle wrote: well have somthing like this

on(release){
_root.plane_mc.duplicateMovieClip("plane_m
c"+_root.planeCount, _root.planeCount)
_root["plane_mc"+_root.planeCount]._x = 0

_root.planeCount++
}

Nah, that's no good. If you add events using on and onClipEvent, you'll have events all over the place and it's not very maintainable. Add the events through code, preferably through the constructor of a class.

It amazes me how little people here on newgrounds now how to actually program.

If you want to randomly spawn movieclips, in your main loop you can use if (random(tresshold)<someValue) and then use attachMovie to add a new instance to your game, possibly with a counter that makes sure planes don't appear too fast. DuplicateMovieClip shouldn't be used for this, because if all your current instances are gone, you don't have anything to duplicate from.


All times are Eastern Standard Time (GMT -5) | Current Time: 08:23 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!