User Tag List

Results 1 to 6 of 6

Thread: Help with checking if space is occupied by other bird

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,156
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)

    Question Help with checking if space is occupied by other bird

    I made a thread with help to make a bird AI and I am now working on it. I have the basics down to now having my birds fly and land on the top of a tree, there is two spots on each tree. My problem now is how to make it so if a spot is occupied by another bird there will be no other bird flying to the same spot.

    Do anyone know the best and simplest way to do this? As I have it now the birds sometimes fly and land on the same spot as another bird, or other times just get their new spot in the same destination and making them jump a pixel.

    I have attached an example of what I have so far
    Attached files Attached files

  2. #2
    Clicker Fusion 2.5Fusion 2.5+ DLC
    casleziro's Avatar
    Join Date
    Mar 2013
    Location
    United States
    Posts
    644
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    when a landing target exists for a bird to land on, and a bird decides to land on that target, set an "occupied" flag on that target until the bird leaves. Then when birds check for targets they can land on, only choose targets with "occupied" off.

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,156
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by casleziro View Post
    when a landing target exists for a bird to land on, and a bird decides to land on that target, set an "occupied" flag on that target until the bird leaves. Then when birds check for targets they can land on, only choose targets with "occupied" off.
    Yes that is kind of what I have been trying, but I have not managed to make it work consistently :/

    I often get problems when trying to make instances of things work together for some reason

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,156
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    I just can't get this to work properly, here is my latest example where I tried to assign if a spot is open, but the birds just stops going after a while :/
    Attached files Attached files

  5. #5
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export Module
    aenever's Avatar
    Join Date
    Jun 2013
    Posts
    1,436
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    I think your 'spots occupied' value doesn't work as you intended. When I set a counter to its value to see what was going on, its value increases with each move rather than counting the spaces that are available. Therefore once it reaches 10 the movement stops. It doesn't seem to subtract at any point. I think line 22 and 23 shouldn't have the negated bird is overlapping the tree; otherwise when the bird is overlapping the tree the sub feature will never enact if all the trees have at least one bird.

    It working better when the negated bird is overlapping the tree is deleted in line 22 or 23. Yet it still allows overlap.

    Or if you reduce the birds to 3, your code works well without any changes, but I'm still certain the 'spots occupied' value doesn't reflect the amount of spots that the birds are occupying.

  6. #6
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleUniversal Windows Platform Export ModuleSWF Export ModuleXNA Export Module
    Outcast's Avatar
    Join Date
    Jan 2011
    Location
    Sweden
    Posts
    3,156
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by aenever View Post
    I think your 'spots occupied' value doesn't work as you intended. When I set a counter to its value to see what was going on, its value increases with each move rather than counting the spaces that are available. Therefore once it reaches 10 the movement stops. It doesn't seem to subtract at any point. I think line 22 and 23 shouldn't have the negated bird is overlapping the tree; otherwise when the bird is overlapping the tree the sub feature will never enact if all the trees have at least one bird.

    It working better when the negated bird is overlapping the tree is deleted in line 22 or 23. Yet it still allows overlap.

    Or if you reduce the birds to 3, your code works well without any changes, but I'm still certain the 'spots occupied' value doesn't reflect the amount of spots that the birds are occupying.
    In the final game there can be like 100 birds though so 3 wont cut it :/ I don't get why this is so hard :S

Similar Threads

  1. Galactic Space Agency (A 2D game inspired by Kerbal Space Program) [PC]
    By MYCRAFTisbest in forum WIP & Released Games & Apps
    Replies: 4
    Last Post: 9th May 2016, 01:39 AM
  2. Checking two different Conditions
    By Jonas in forum Fusion 2.5
    Replies: 3
    Last Post: 29th November 2014, 04:21 PM
  3. do a checking thanks
    By melnet in forum The Games Factory 2 - Technical Support
    Replies: 1
    Last Post: 12th October 2008, 01:05 PM
  4. Checking if in range
    By MechatheSlag in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 9th September 2006, 04:10 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
  •