The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 9 of 9

Thread: ai problems

  1. #1

    ai problems

    hiyar, well its been two months and my game has come along in leaps and bounds until now, i had a basic ai system ready but i seem to have alot of faults with it.

    1.)The enemies can go through walls

    The enemies can walk straight through walls and basicly i have no idea how to stop them doing that

    2.)The enemies dont attack

    I tried adding a hittest inside it to play an arm symbol and it will not attack the character

    3.)For it to work things must be a certain way

    The code means that the character must be in the exact center of the map

    i was wondering if anyone could fix any of these problems for me
    thank you in advance
    Attached Files Attached Files

  2. #2
    Could anybody help me please?

  3. #3
    i don't actually understand what your problem is, mordormaster. You have a laundry list of things you have no idea how to do, and you keep making a new thread every month or so to see if someone can fix your fla and send it back to you.

    You have got to start putting your code in one place instead of on movieclips if you want people to begin to sort through it for you. It's kind of a mess right now.
    you = function(){
    setEnabled( true );
    setEnabled( false );

  4. #4
    BY the way, I got an unexpected file format error here...
    Bruno Palermo
    When everything is catastrophic, thank the Gods things aren't worse!

  5. #5
    The file format is flash cs3. i only need one or two of thouse problems fixed, i created alot of other things for the game im making but so far only ai is not working for me, now i have got the enemies walking but they still wont attack, i cant creat a hittest that works for it.

  6. #6
    I still use Flash 8...
    Bruno Palermo
    When everything is catastrophic, thank the Gods things aren't worse!

  7. #7
    i also use flash8, and i dont plan on using cs3 anytime soon, instead i will move on to something like flashdevelop which is meant for coding alone...

    Anyway, mordormaster, if the code is in as2, then convert the file to fl8 and show, else put your code right here.

    I need a SPRITER who can do pixel arts for an arcade fighter project. If you can help out, please pm me.
    I also need someone who can write simple xml files.

  8. #8
    i have converted it to flash 8 format now, but incase that dont work here is the code for the ai itself

    onClipEvent (enterFrame) {
    var herox=(;
    var heroy=(;
    // determine the distance using pythag's theorem
    dist = Math.sqrt( Math.pow( this._x - herox, 2) + Math.pow( this._y - heroy, 2) );
    // only chase if within 200px, and stop if touching
    if(dist < 200 && dist > this._width){
    // determine the angle between the hero and the enemy
    angle = Math.atan2( heroy - this._y, herox - this._x );
    // rotate enemy to face the hero
    this._rotation = angle * (180 / Math.PI);
    // move the enemy along the vector that leads to the hero
    // adjust the value of 5 to change the speed
    this._x += Math.cos(angle) * 5;
    this._y += Math.sin(angle) * 5;
    // normal enemy movement when not chasing goes here
    } //if
    Attached Files Attached Files

  9. #9
    right i have fixed the walking through walls and made it attack but i need to be able to make it go for the center of the screen, so far if i make my map any bigger than 700 pixels by 700 pixels it just wont work, can anyone help me?

Thread Information

Users Browsing this Thread

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

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 Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012