| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Registered User
Join Date: Mar 2001
Posts: 2
|
I forum, is my first time here!
I found around the web a lot of nice platform game and I like to realize one. I read the tutorials about hitTest, but the thing works when there are only two objects. I mean in platform games there's the HERO that jump from a platform to another and so on. I suppose that the platforms are all instance of the same MC, so where I have to put the code that detect collision? Have u a tutorial to suggest me? Thanks a lot Brid |
|
|
|
|
|
#2 |
|
New Member
Join Date: Feb 2001
Posts: 378
|
Hi..
The following code will first duplicate an MC four times at predetermined positions on our screen. Then we will test for hit tests on the MC's: 1) Frame 1: xpos = 10; xspace = 100; for (i=1; i<=4; i++) { platform.duplicateMovieClip("platform"+i, i); this["platform"+i]._x = xpos; xpos += xspace; } This is where we duplicate the 'platform' MC four times, placing each additional duplicated MC 100 pixels to the right. For more precise positioning target each dup MC individually: _root.platform2._x=500; _root.platform2._y=300; 2) Place this on the 'hero' MC: onClipEvent (enterFrame) { if (this.hitTest(_root.platform)||this.hitTest(_root. platform1)||this.hitTest(_root.platform2)||this.hi tTest(_root.platform3)||this.hitTest(_root.platfor m4)) { _root.result = "Hit!"; } else { _root.result = "Miss"; } } This tests for a hit test on all five MC's and then outputs the results to a dynamic textfield on our stage named 'result'. Best of luck. Marx. |
|
|
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Mar 2001
Posts: 2
|
Hi Marx,
I found your suggest really usefull. Thanks a lot Bye brid |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Looking to buy Flash games w/source code and full rights | xoloinc | Projects and Positions | 4 | 03-26-2008 04:59 PM |
| Is Anyone A Fan Of Lucas Arts Adventure Games?? | Low Lines | Other Flash General Questions | 2 | 01-29-2007 03:56 PM |
| Armor Games Contest 3 | jeremysfilms | General Chat | 15 | 08-05-2006 12:03 PM |
| Flash Games and Copyright issues | john829 | Gaming and Game Development | 4 | 12-08-2005 03:09 AM |
| Ye Olde hitTest Problem - revisited.... | zantafio | ActionScript 1.0 (and below) | 5 | 05-17-2003 12:46 AM |