Complicated Question???

0 favourites
From the Asset Store
Logo Quiz with 150 prepared logos and answers, automatic question and answer mixing
  • If i had an object with a bullet action on it how could i tell it to not go through a wall without collision? In a pacman example the ghost never collided with the walls, instead a script allows them to pick on available directions. For my game i want my object to go in a specific path without AI. I only want my object to change directions when it reaches a wall.

  • You could just tell it to rotate on collision with an invisible object, so it never actually touches a wall, you could set angles of 0,90,180,270 and get it to either pick one at random, but this could create a bounce action, or get it to check for invisible object is within say 2 pixles then rotate.

  • you can save the X and Y position of your object each tick in two private variables, and then

    if there's overlapping

    • > fall back the the previous position
    • > then randomly pick any of the 3 cardinal directions your object wasn't moving toward (loop three or four times)

       -> check each time if you won't run into a wall again (overlap at offset)

       -> and then apply and break the loop

  • Thanks yann here is the capx.

    dl.dropbox.com/u/11360597/DirectXMainFile.capx

    i called it directx because you direct the critters around the map.

    You press space to start them going. Maybe this will better help explain my dilemma. If i can get this to work i will be extremely happy. If i can't get it to work i will scrap the project altogether.

  • going all through the walls like crazy, its so annoying.

  • easier with a grid movement type of algo botAI.capx

    you can even set the speed super high like 10,000 px per second, you won't lose any bot

  • holy crap, thanks dude. The only thing is i don't want the bot to have a choice to go in any direction i want them to be stuck in a loop on purpose. I want the player to place an arrow to get the bot to exit the loop. They are 2 smart hehe. I want them to be dumber if that makes any since XD.

    Here is a youtube link of what im trying to go for.

    youtube.com/watch

  • if you understand the code, it's just one line to change

  • is it in the check for walls part? I need a hint lol.

  • i changed the set dir to chosen (-1,-1) and there sort of looping, but some of them want to escape the loop by going in a forbidden direction.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • never mind it works. Thank you yann master :D

    The project will continue because of you thank you man. Did you get a computer science degree? because you are smart.

  • I went to artschool actually...

  • then how do you know so much?

  • I know nothing it's just logic. Your problem was caused by some imprecision, by using a grid movement system you're 100% accurate, then it's just a matter of changing direction.

    Ok I lied, I know unit circles and affine functions. But well... almost everybody learn that in highschool.

  • i need to learn that math. Your like my role model lol. teach me your ways hehehe.

    I have another question. If the player wanted to change the bots direction how could that work. Like once the bot walks on a down arrow i want it to go down. I know how to grid snap drag but how do i change the bots direction on the fly.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)