Home | Help Forums | Web Design Tutorials | Free Swishmax Downloads | All Downloads

 

 

Company

Home

Nework Details

Tutorials

SWiSH 2

SWiSHMax

Flash MX

PHP & MySQL

HTML / JScript

Adobe Photoshop

Corel Draw

Gimp

Miscellaneous

Downloads

Templates

Plugins

Fonts

Wallpapers

Free Images

Scripts and Codes

Products

E-Books

SWiSH BB

SWiSH Templates

SWiSH-DB Newsletter
Subscribe to our newsletter : GO
  Partners / Affiliates

   Swish Templates
   SWiSH Climax
   GimpTalk
   Idea Designs
   Sposatoettore
   Try Acai Berry Diet
   Download Free Ringtones
   Swishzone

Manage your site with Flax Article Content Management System
HitTest() function
Category : SWiSHMax | Level : Beginner | Language : English
Ask Question | Read Comments | Post tutorial | Previous | Next

Web www.swish-db.com

In this tutorial I will explain you how to use “HitTest()” function in SwihMax. This function is not available in SwishMax but it is working if you test it in Player.
In this example I used an object (a car) which can be move from your keyboard. You will see that when you will hit the black area your object will bounce.
“HitTest()” function is like “isNearThis()” function but this can verify if an object is near a round object. “isNearThis()” function is verifying only if an object is near totality other object as being a square object.
I used a boundary which contains some shapes. “HitTest()” will verify if the object (the car) hit the shapes from the boundary.

Her is the code I used:

if (!_root.boundary.hitTest(car._x+x, car._y+y, true))
{
car._x += _root.x;
car._y += _root.y;
}
else
{
speed *= -.3;
}

I would also like to thank EddiE K for helping me make this tutorial.
Excuse my english J I don’t know it very well.

I attached the .swi file to understand it better. Take a look.

example


All rights reserved - swish-db.com