# Hittest and a bit of positionig of a MC

**URL:** https://forum.kirupa.com/t/hittest-and-a-bit-of-positionig-of-a-mc/92094
**Category:** Uncategorized
**Created:** [October 13, 2003, 7:05am UTC](https://forum.kirupa.com/t/hittest-and-a-bit-of-positionig-of-a-mc/92094 "2003-10-13T07:05:30Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![knutlig](https://avatars.discourse-cdn.com/v4/letter/k/b5e925/32.png) [@knutlig](https://forum.kirupa.com/u/knutlig)
#### Post date: [October 13, 2003, 7:05am UTC](https://forum.kirupa.com/t/hittest-and-a-bit-of-positionig-of-a-mc/92094/1 "2003-10-13T07:05:30Z")

</div>

Have a look at [http://knut.espenish.com/speedracer/content/game.html](http://knut.espenish.com/speedracer/content/game.html).

What happens here is that the car MC performs a hittest on the road MC. When the cars centre goes outside the shape of the road it sends the car MC back some points on its axis.

I want the car to stop going the direction its going when it exceeds the x and y co-ordinates of the Road MC…

This is the code…

\_root.car.\_x += -1;  
\_root.car.\_y += 25;

I want it to say something like this…

\_root.car.\_x = the x co-ordinate it has when the hittest detects that it is outside the roadMC;

\_root.car.\_y = the y co-ordinate it has when the hittest detects that it is outside the roadMC;

Cheers

Knut Erik Sorli
