Results 1 to 7 of 7

Thread: Please Help Me Advance My AI's Code

  1. #1

    Please Help Me Advance My AI's Code

    This Is For A Bleach Game I'm Making

    That will be likeStreetfightermeetsSinjid Shadow of theWarriororSonny that zombie game


    please look the games up on google if u dont know them yet.





    so far my ai does this

    http://spamtheweb.com/ul/upload/100508/1 2994_ikkakuwitharray1.php

    i want to make it do one of these, preferably the second one but the first is easier to help me do

    the second one is a much better ai though

    im using coding on just one frame and it attaches the hero movie clip and the enemy movieclip

    and the enemy respawns if its killed

    but i cant get my enemy to do anything besides come to me and when its 70 away from me it stops... within reach of my weapon but its still doing the flying animation

    until its hit
    when its hit itll go to a random animation and im fixing the code now so that if he goes to "block" animation he wont
    lose hp




    1.

    "i want to make him attack me when he is close enough to me and if he hits me
    how to make it go to a second attack but only have a small chance of going to that

    but if ikkaku block= true and the monsters attack hits me he would go to the animation movie clip named attackblocked

    also this isnt as important for now but id like him to have a timer so it only attacks every so often"







    2.

    "i want to have him be like a streetfighter ai
    but i dont like that whole ai random thing i have
    i want my monster to be a fighting monster that can block me sometimes, hit me, fall when hit by full combo and get away from me at certain hp levels and come back with an attack

    until its dead "

    COULD YALL VIEW MY LINK AND THEN SEE WHAT COULD BE DONETO THAT AI TO BETTER IT


    http://spamtheweb.com/ul/upload/100508/1 2994_ikkakuwitharray1.php
    Last edited by youngtrill; May 11th, 2008 at 12:52 AM. Reason: had wrong link

  2. #2
    anyone please even tiny advice will do

  3. #3
    Last edited by youngtrill; May 11th, 2008 at 12:52 AM.

  4. #4
    "i want to make him attack me when he is close enough to me and if he hits me
    how to make it go to a second attack but only have a small chance of going to that

    but if ikkaku block= true and the monsters attack hits me he would go to the animation movie clip named attackblocked

    also this isnt as important for now but id like him to have a timer so it only attacks every so often"
    Sounds to me like you have the right idea on how to think of these things, you just have to execute them.

    First of all, if you want him to attackhe is close to you then you need to constantly check the distance between him and your character, if that distance is below the predetermined length then let him attack. Like this:

    PHP Code:
    if (distance 70){
    enemy.attack();} 
    If you dont know how find the distance between 2 points then do a quick google search.

    As far as the small chance to attack twice then you would use the Math.random() method. Like this:

    PHP Code:
    if (Math.random() < .3){
    attack again
    Math.random() returns a value between 0 and 1, so in that example there is a 30% chance that the enemy will attack again.

  5. #5
    okay let me go try to add this

    i wanna make it also when hp is 75 have a 50% chance of running away 100 and facing me then shooting a bullet.
    and at 50 i want it to have a 75% chance of doing that

    and then coming back to the reached distance of attacking range

  6. #6
    i hey that dont work properly lol

    he just attacks nonstop

    and i cant find a proper distance formula either

  7. #7
    well for distance you can just use the X value if this isn't a platformer game. So like if(Math.abs(object1.x - object2.x) < range). If it is a platformer use the pythagorean theorem. if((object1.x - object2.x) * (object1.x - object2.x) + (object1.y - object2.y) * (object1.y - object2.y) < range * range)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012