# A car game

**URL:** <https://forum.kirupa.com/t/a-car-game/108425>\
**Category:** Uncategorized\
**Created:** [April 25, 2004, 7:42am UTC](https://forum.kirupa.com/t/a-car-game/108425 "2004-04-25T07:42:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zeka](https://avatars.discourse-cdn.com/v4/letter/z/c6cbf5/32.png) [@zeka](https://forum.kirupa.com/u/zeka)\
**Post date:** [April 25, 2004, 7:42am UTC](https://forum.kirupa.com/t/a-car-game/108425/1 "2004-04-25T07:42:18Z")

</div>

I have a car game, but I want to be able to make obstacles for the car to go around, ect. I have thought of a simple way to stop the car from going “into” the objects, but don’t have the knowledge of actionscript to do it. Can someone please convert my idea into actual actionscript?

//script on car movieclip  
//must have a movieclip with an instance name of “obstacle”  
onClipEvent (enterFrame) {  
lastx = the x position the car was at 3 frames ago  
lasty = the y position the car was at 3 frames ago  
if (this.hitTest(\_root.obstacle)) {  
ease x pos to lastx  
ease y pos to lasty  
}  
}

so can someone please convert this into actual actionscript that will work?  
a sample game is at (i know its a bit childish) : [http://www.neopets.com/games/bumpercars.phtml](http://www.neopets.com/games/bumpercars.phtml)

thanks  
Zeka
