# Help implementing AI

**URL:** <https://forum.kirupa.com/t/help-implementing-ai/64665>\
**Category:** Uncategorized\
**Created:** [September 18, 2004, 4:50pm UTC](https://forum.kirupa.com/t/help-implementing-ai/64665 "2004-09-18T16:50:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![netrix](https://avatars.discourse-cdn.com/v4/letter/n/f0a364/32.png) [@netrix](https://forum.kirupa.com/u/netrix)\
**Post date:** [September 18, 2004, 4:50pm UTC](https://forum.kirupa.com/t/help-implementing-ai/64665/1 "2004-09-18T16:50:15Z")

</div>

Hi guys… i made my first game like a month ago, it was a 2 player game but i will like to implement some AI to it to make it a one player game. What kind of AI should i use??? and where should I start??? Any info would be greatlky aprecciated… btw [here](http://www.juliocortiz.com/net/vh.swf) is the game.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2004, 2:43am UTC](https://forum.kirupa.com/t/help-implementing-ai/64665/2 "2004-09-19T02:43:45Z")

</div>

This should be too hard to create simple ai, for the computer puck i would put

```auto
onClipEvent(enterFrame){
dist = this._y-puck_mc._y;
// i'd put 1 instead of 0, just so it moves smoother
if(dist>1){
//speed is anything eg 5
this._y -= speed;
}
if(dist<-1){
this._y += speed;
}
}

```

that should work, and if u want to make the game harder or easier, it’s pretty simple just increase/decrease speed

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2004, 3:49am UTC](https://forum.kirupa.com/t/help-implementing-ai/64665/3 "2004-09-19T03:49:09Z")

</div>

thanks a lot man… that would do, now i have to polish the game a bit!!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2004, 4:27am UTC](https://forum.kirupa.com/t/help-implementing-ai/64665/4 "2004-09-19T04:27:03Z")

</div>

Its actually not that bad

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 19, 2004, 1:37pm UTC](https://forum.kirupa.com/t/help-implementing-ai/64665/5 "2004-09-19T13:37:02Z")

</div>

i tweeked a few things but still it needs some polishing… i’ll do it when i have some time… college is taking a lot of time!!! but thanks a lot man!!!
