User Tag List

Results 1 to 4 of 4

Thread: Checking for objects in your way...easier way?

  1. #1
    No Products Registered

    Join Date
    Apr 2008
    Location
    arizona
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Checking for objects in your way...easier way?

    I'm programming the eight queens problem using a chess board and eight queen pieces.

    After I place the first queen then I place the second queen. I have to test that the second queen is not in danger of capture, so it can't be where the first queen can capture it.

    Is there any way that the second queen(and subsequent queens) can simply "look" in all directions and somehow detect that there is an "obstacle" or another queen it it's path? Without physically moving and "colliding" with another queen?

    Right now, I'd have to use a brute force method like this:

    1. Test each square(with x and y coordinates) and compare it to all other squares in a legal queen path(x and y) FOR EACH of the eight queens.

    2. Then I would have to test for at least one other queen(up to seven queens) in all other legal x/y coordinate paths. That's a lot of testing just for one move.

    I could have the currently placed queen try to move in each of her legal directions and if she collides with another queen, then the move is illegal.

    But there should be an easier way, a way to detect obstacles in your path. Without this, I would have to set up direction paths for each of the eight queens from all 64 squares, which can be 1000 lines of coding!

    What I'd like to see is this:

    1. You place the first queen anywhere within any of the 64 individual squares.

    2. You place the second queen on any of the 63 remaining squares and then have this second queen "look" in all her legal directions.

    3. If she detects an obstacle/object in one of her paths, she must "snap back" off the board where she started from and the user must try again.

    4. This would continue until all eight queens are legally placed.


    Can someone point me to an easy way to detect collisions in a path without having to physically move the object? Or set up individual paths for each queen from the same grid?

    Thanks.

    John Soares

  2. #2
    Clicker Fusion 2.5 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Location
    Turku, Finland
    Posts
    1,023
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Checking for objects in your way...easier way?

    Couldn't you just shoot an invisible object to all the possible directions from the queen and check if it hits something? That would be pretty basic but I can't see why it wouldn't work.

  3. #3
    No Products Registered

    Join Date
    Apr 2008
    Location
    arizona
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Checking for objects in your way...easier way?

    Can you give me an example of invisible shooting?

    My problem is this:

    1. I need to place the first queen and then the second and subsequent queens FIRST. I'm using drag/drop to drop each queen onto the board at a specific square.

    2. When I have finished dropping each queen on the board, only then do I want to check for collisions.

    What's happening now is that before I can even place the first queen, I'm getting "collision" movement. I need to actually place each queen on the board FIRST.

    How do I place each queen and then check for collisions with another queen? Can this be done without physically moving any objects?

    Thanks.

    John Soares

  4. #4
    Clicker Fusion 2.5 DeveloperSWF Export Module

    Join Date
    Jun 2006
    Location
    Turku, Finland
    Posts
    1,023
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Checking for objects in your way...easier way?

    I think I did it in the most weird way, but... it works. Here it is: http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=87080#Post87080

Similar Threads

  1. Update suggestion: Making instances, and pairing of objects easier to understand.
    By Grim_Jester in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 31st August 2012, 03:27 PM
  2. Moving objects and then checking for collision doesn't work during frame start
    By crusher in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 8th July 2012, 04:48 PM
  3. Easier way? : edit box = A or B or C etc
    By Gibbon in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 17th December 2008, 01:05 AM
  4. Is there an easier way than this?
    By maestro1 in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 1st March 2008, 06:49 AM

Posting Permissions

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