# AI tutorial

**URL:** <https://forum.kirupa.com/t/ai-tutorial/63571>\
**Category:** programming\
**Created:** [September 8, 2004, 2:59am UTC](https://forum.kirupa.com/t/ai-tutorial/63571 "2004-09-08T02:59:46Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![leoHEK](https://avatars.discourse-cdn.com/v4/letter/l/90ced4/32.png) [@leoHEK](https://forum.kirupa.com/u/leoHEK)\
**Post date:** [September 8, 2004, 2:59am UTC](https://forum.kirupa.com/t/ai-tutorial/63571/1 "2004-09-08T02:59:46Z")

</div>

I read marz’s tutorial on AI but I don’t get it. What those the script mean when it says “perform the buttsquash”. Is “buttsquash” a MC or a frame.

---

<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 8, 2004, 3:44am UTC](https://forum.kirupa.com/t/ai-tutorial/63571/2 "2004-09-08T03:44:41Z")

</div>

A frame. I think the “performAttack” is like his way of saying “gotoAndStop”. When he says:

ape.performAttack(“buttSquash”);

It means:

ape.gotoAndStop(“buttSquash”);

I dont know if thats what he meant, but it worked for my fencing game. Hope that helps you.

peace

---

<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 8, 2004, 3:46am UTC](https://forum.kirupa.com/t/ai-tutorial/63571/3 "2004-09-08T03:46:42Z")

</div>

no, no, noooooo!! The buttsquash is a dance, you must perform the buttsquash to understand.

---

<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 9, 2004, 1:57am UTC](https://forum.kirupa.com/t/ai-tutorial/63571/4 "2004-09-09T01:57:46Z")

</div>

_lol_… Oh man guys… this was the hardest I’ve laughed in a while… Don’t take offence or feel stupid though…

it’s just an analogy on what you could possibly do with the system leoHEK… In the above situation, the buttsquash would be an attack that the ape could perform…

The performAttack is actually a Prototype.MovieClip function. You create this function to handle all of your attacks… How would you do this? Several different ways. I would love to elaborate more on this, but I need to try to go to sleep… My head is pounding and I’m a little dizzy…

---

<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 9, 2004, 3:33am UTC](https://forum.kirupa.com/t/ai-tutorial/63571/5 "2004-09-09T03:33:51Z")

</div>

Hmmm, Well, I used the “gotoAndStop” method and it worked fine.

P.S. lol, I DO feel pretty stupid :crazy:

peace

---

<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 9, 2004, 5:06am UTC](https://forum.kirupa.com/t/ai-tutorial/63571/6 "2004-09-09T05:06:46Z")

</div>

Well man… You can actually do t that way as well… But if you have characters and multiple attacks… You need to handle everything from taking off hitpoints and all of that fun stuff… An dit’s better handled in a function… That way you aren’t copying and pasting alot of code… It’ll be a series of gotoAndstop’s and some variable calls. 🙂

So don’t feel stupid.

---

<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 9, 2004, 1:06pm UTC](https://forum.kirupa.com/t/ai-tutorial/63571/7 "2004-09-09T13:06:06Z")

</div>

> [@Marz](#):
>
> Well man… You can actually do t that way as well… But if you have characters and multiple attacks… You need to handle everything from taking off hitpoints and all of that fun stuff… An dit’s better handled in a function… That way you aren’t copying and pasting alot of code… It’ll be a series of gotoAndstop’s and some variable calls. 🙂
> 
> So don’t feel stupid.

Aaaah, I see. Yeah, the function handler sounds better then the code that I used for my fencing game (the oponent would start attacking so much, nobody could win).

peace

---

<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 9, 2004, 7:29pm UTC](https://forum.kirupa.com/t/ai-tutorial/63571/8 "2004-09-09T19:29:04Z")

</div>

> [@joMan](#):
>
> Aaaah, I see. Yeah, the function handler sounds better then the code that I used for my fencing game (the oponent would start attacking so much, nobody could win).

I think of functions as the segments that make up the logic of the flash game. Then I go through and make sure I label everything that is referenced in the function.

Once it’s working you can tweak your initialized variables, the upper/lower limits, scale and such. I personally like to work at 2x and then resize 50% so it looks more polished (also allows imported PNGs to scale up to 200% without jaggies).

---

<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 9, 2004, 8:25pm UTC](https://forum.kirupa.com/t/ai-tutorial/63571/9 "2004-09-09T20:25:58Z")

</div>

Basically, the reason I dont use functions, is because I dont know how :h:

---

<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 13, 2004, 3:21am UTC](https://forum.kirupa.com/t/ai-tutorial/63571/10 "2004-09-13T03:21:12Z")

</div>

it’s cool man… Functions are extremely powerful tools… I’ll display to you some possibilities and give you a brief informative breakdown sometime.
