# Starting first game....i need some hint

**URL:** <https://forum.kirupa.com/t/starting-first-game-i-need-some-hint/51358>\
**Category:** Uncategorized\
**Created:** [May 12, 2004, 10:18am UTC](https://forum.kirupa.com/t/starting-first-game-i-need-some-hint/51358 "2004-05-12T10:18:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tayfunde](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@tayfunde](https://forum.kirupa.com/u/tayfunde)\
**Post date:** [May 12, 2004, 10:18am UTC](https://forum.kirupa.com/t/starting-first-game-i-need-some-hint/51358/1 "2004-05-12T10:18:31Z")

</div>

hello  
my first post here…okay

so im starting to program a small car game…like grand theft auto…  
but in the first step im trying to figure out the movement of the car

```auto
www.billstedt.biz/test/index2.html

```

but now…i dont know how to add some kind of friction…so that the cars stops after a certain distance and…how can i controll the acceleration?

```auto
StageWidth = 600;
StageHeight = 400;
arrowMC._x = 550;
arrowMC._y = 350;
porsche_mc.speed = 5;
friction = .5;
_root.attachMovie("arrow_mc", "arrowMC", 50);
porsche_mc.onEnterFrame = moveStuff;
function moveStuff() {
	if (Key.isDown(Key.LEFT)) {
		porsche_mc._rotation -= 2;
	}
	if (Key.isDown(Key.RIGHT)) {
		porsche_mc._rotation += 2;
	}
	if (Key.isDown(Key.UP)) {
		speed++;
	}
	if (Key.isDown(Key.DOWN)) {
		speed--;
	}
	rot = Math.PI/180*porsche_mc._rotation;
	//trace("Rotation: "+porsche_mc._rotation+" Bogenmaß: "+rot+" Sinus: "+Math.sin(rot)+" Kosinus: "+Math.cos(rot)+" Tangens:"+Math.tan(rot));
	xSpeed = speed*Math.cos(rot);
	ySpeed = speed*Math.sin(rot);
	porsche_mc._x += xSpeed;
	porsche_mc._y += ySpeed;
	if (this._x>StageWidth+(this._width/2)) {
		this._x = 0-(this._width/2);
	}
	if (this._x<0-(this._width/2)) {
		this._x = StageWidth+(this._width/2);
	}
	if (this._y>StageHeight+(this._height/2)) {
		this._y = 0-(this._height/2);
	}
	if (this._y<0-(this._height/2)) {
		this._y = StageHeight+(this._height/2);
	}
}

```
