Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

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 );
    live();
    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.
    MY BLOG

    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=(_root.map._width/2)-_root.map._x;
    var heroy=(_root.map._height/2)-_root.map._y;
    // 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;
    }else{
    // 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 kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012