User Tag List

Results 1 to 6 of 6

Thread: Checking for obstacle in front of object without using detector actives?

  1. #1
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Checking for obstacle in front of object without using detector actives?

    I am making an AI for an 8 directional game. So far, I have made it so that enemies see the player if there is not an obstacle in the way, using a line that I draw between each enemy and the player. Now, I have also made it so that each enemy runs to the last point where they saw the player. The problem is, they sometimes run into obstacles doing this. I want them to see that the obstacle is coming up ahead, and change directions instead of running into the wall. Is this possible, without using any excess objects? It would be easy just positioning a "view line" object that pointed in the direction that the enemy was looking, and then checking for overlapping of obstacles from there, but I don't want to use too many active objects for the AI, due to memory consuming. Is this check for obstacles ahead possible to do with math instead? Preferably with a chance to alter the distance of detection between the enemy and obstacle?

    Hope I am making myself clear :P

  2. #2
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You can change the animation to your detector animation and set the animation frame to the detector that checks on the right, then just check for a collision
    Working as fast as I can on Fusion 3

  3. #3
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your detector ( line ) can have multiple purposes, you dont need seperate detectors to do seperate jobs.

    Allways -->
    - Draw line to Player
    If line not overlpapping obstacle
    - Enemy sees Player
    Allways -->
    - Draw line to Suitcase
    If line not overlpapping obstacle
    - Enemy sees Suitcase
    Allways -->
    - Draw line X pixles ( radius ) in enemies facing direction
    If line not overlpapping obstacle
    - Enemy does not have an Obstacle infront of him

    You can use the same detector to do multiple jobs.
    The same detector can check if it sees the player, the suitcase, and even see if there is a wall X pixles infront of him by using the same detector. The above code 'will' work if you do it properly in the event editor.

    Hope this helps feel free to ask me if you have any questions, good luck

  4. #4
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I will try your suggestions I am struggling to find out what King_Cool means by "suitcase" though :P

  5. #5
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)
    King_Cool's Avatar
    Join Date
    Aug 2008
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A suitcase is a general term for a distinguishable form of luggage. It is often a somewhat flat, rectangular-shaped bag with rounded/square corners, either metal, hard plastic or made of cloth, vinyl or leather that more or less keeps its shape. It has a carrying handle on one side and is used mainly for transporting clothes and other possessions during trips. It opens on hinges like a door. Suitcases lock with keys or a combination. ( illustration below )


    I do realize a suitcase has nothing to do with your game. I just included it in the example to more clearly explain that your single detector, which you are allready using, cas be used to detect multiple tings and not just have a single purpose.
    You can switch Suitcase with Apple or Animal or anything, it does not really matter.

  6. #6
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jan 2010
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Haha, I didn't see the last post until today :P And yes, I know what a regular suitcase is xD
    Anyways, thanks

Similar Threads

  1. Distance Code Reliability vs. Radial Detector Object
    By Kid_Roleplay in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 26th December 2012, 07:02 PM
  2. Ordering backdrops in front of actives?
    By XStar in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 6th November 2012, 12:59 PM
  3. Making Backdrops Appear in front of Actives
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 26th February 2012, 01:42 PM
  4. Object detector not working...
    By LB in forum File Archive
    Replies: 2
    Last Post: 21st July 2008, 04:46 PM

Posting Permissions

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