Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Animation and Effects

Reply
 
Thread Tools Rate Thread Display Modes
Old 03-13-2001, 04:53 PM   #1
brid
Registered User
 
Join Date: Mar 2001
Posts: 2
Default

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
brid is offline   Reply With Quote
Old 03-18-2001, 12:04 PM   #2
Marx
New Member
 
Join Date: Feb 2001
Posts: 378
Default

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.


Marx is offline   Reply With Quote
Old 03-19-2001, 09:34 PM   #3
brid
Registered User
 
Join Date: Mar 2001
Posts: 2
Default

Hi Marx,
I found your suggest really usefull. Thanks a lot
Bye brid
brid 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 Off
HTML code is Off

Forum Jump

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


All times are GMT. The time now is 11:41 AM.


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