Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-15-2001, 09:09 AM   #1
Toad
Registered User
 
Join Date: Jul 2001
Posts: 2
Unhappy

I am trying to write a small game based on the Laser Game tutorial and using hitTest().

There can be any number of instances existing for the 'bullet' and also for the 'target'. Therefore, hard coding the testing by bullet1, bullet2 .... bulletn would be impossible. So, I need to detect a hit from any instance of a MovieClip... is this possible?

My alternative is to keep track of names of all existing instances of each and write a function that constantly loops through each target and hitTests on each exisitng bullet... this would be damned slow

Thanks in advance

Toad
Toad is offline   Reply With Quote
Old 07-15-2001, 12:53 PM   #2
Toad
Registered User
 
Join Date: Jul 2001
Posts: 2
Default

I've sorted that problem out by keeping an array of the _names ...

New Problem: I make my target appear (duplicatemovie) in the first(and only) frame of the movie... but when I fire my target disappears, what could I have done wrong?

Toad
Toad is offline   Reply With Quote
Old 07-16-2001, 02:18 PM   #3
20 Ton Squirrel
Risu Oyabun!
 
20 Ton Squirrel's Avatar
 
Join Date: Apr 2001
Location: Houston, Texas
Posts: 1,460
Default

Make certain you aren't duping a movie into the layer that your target exists on. What a lot of people do is reserve ranges of levels for their objects. Think about how many laser beam thingies can be on screen at once. I doubt it'd be more than like 500, so reserve levels 500 to 1000 for your laser beams. Have some kind of check coded to reuse the levels based on the dupe's position on the stage. If the MC is off-stage, re-use it's level because it's no longer visible.
20 Ton Squirrel is offline   Reply With Quote
Old 07-17-2001, 06:25 AM   #4
Jesse
ActionScript.org Founder
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: New York
Posts: 8,736
Default

Note you could also use a for..in loop instead of a name array.
__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 events with small button above a large button blob ActionScript 2.0 8 01-05-2005 05:26 AM
[AS2] Tile game or not tile game? krolben Gaming and Game Development 4 07-28-2004 12:41 PM
small game partnership speedlemon Projects and Positions 2 07-06-2004 07:47 PM
Small online game company needed. zekebru Projects and Positions 0 08-23-2001 06:38 PM


All times are GMT. The time now is 06:29 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.