User Tag List

Results 1 to 10 of 10

Thread: Newbie question: Detecting object proximity.

  1. #1
    No Products Registered

    Join Date
    Sep 2008
    Location
    California
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Newbie question: Detecting object proximity.

    Hello, I have finally decided to make my first game. A tower defense games. Bad guys move along a pre determined path. You place your towers (guns, rockets, etc) along the path so when the bad guys pass by the towers shoot at the bad guys.

    My question: How can I determing when a bad guy is passing close to a tower, to make it start shooting?

    Any help would be greatly appreciated.
    Radbrad

  2. #2
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    RickyRombo's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere between here and there
    Posts
    3,167
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Newbie question: Detecting object proximity.

    You can use the Advanced Direction Object or the Clickteam Movement Controller to test if the distance between two objects is "in range"

  3. #3
    No Products Registered

    Join Date
    Sep 2008
    Location
    California
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Newbie question: Detecting object proximity.

    Thanks RickyRombo, now how do I use them? Can you point me to the any kind of documentation?

    CHeers,
    Radbrad

  4. #4
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Newbie question: Detecting object proximity.

    Download advanced direction object and check out the example files that come with it.

  5. #5
    Clickteam Clickteam
    Anders's Avatar
    Join Date
    Jun 2006
    Location
    Denmark, Århus
    Posts
    3,456
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)

    Re: Newbie question: Detecting object proximity.

    You could also make some circle shaped active objects and make the invisible. That is what many people on theese forums call a 'detector' since you can use it to test for collisions even though it is invisible.

    + Every 00:00:40
    + 'Enemy' is overlapping 'detector'
    + Fixed value of 'Tower' is equal to towerId('detector')
    --> Tower: Shoot at enemy

    You have to store the fixed value of the tower that the detector belongs to into some alterable value. In the above example I call it 'towerId' but you can call it whatever you want.

  6. #6
    No Products Registered

    Join Date
    Sep 2008
    Location
    California
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Newbie question: Detecting object proximity.

    Hey Andros First of all thank you for the solution.

    Sounds good but and there is aways a but, If I have to create an invisable object at the same X and Y coordinance as the tower to use as detector sounds like alot more work.

    I tried to create a large active object then erease it and make a small square in the center for testing, leaving a large mask around the square. The tower ignores the mask. Is ther a way for the object not to ignore the large invisable mask around the active object?


  7. #7
    No Products Registered

    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Newbie question: Detecting object proximity.

    A circle invisible object works but is not really a very good option. This is unneccesary as it increases memory usage and adds to your object limit and will cause lag with lots of objects. Use triginometry instead. Advanced direction calculator is easy.
    All you have to do is spread value 0 in all towers and fastloop through them. Then calculate if an enemy is within a certain distance from it.

  8. #8
    No Products Registered

    Join Date
    Sep 2008
    Location
    California
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Newbie question: Detecting object proximity.

    Is there any demo's you can point me to or some documentation I can read to understand how to put the trig in to the expression calculator. Maybe just a basic understanding of advanced direction calculator.

    Thanks again, you guys are great.

    Oh, I have a single level of the game almost totaly functional. Still polishing though for folks with lesser P.C.'s out there etc. This first go round is to teach myself MMF2. More of a prof of concept and to build my own demo library of little programs so I can remember how I got things to work. With the help of the great folks here at the Forums.
    Thank you again for your time and effort.

    Brad

  9. #9
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Aug 2006
    Posts
    2,335
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Newbie question: Detecting object proximity.

    I made a range check/compare widget a while back -

    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=112668#Post1126 68

    Not sure if the widget will help but maybe. There is also a few examples in the files area which are for this sort of thing -

    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=153140

    http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=146329

    Hope this helps

  10. #10
    No Products Registered

    Join Date
    Sep 2008
    Location
    California
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Newbie question: Detecting object proximity.

    I want to thank everyone who posted here for me. I really do appreicait you taking the time to help.

    Brad


Similar Threads

  1. Another newbie Question: Object Rotation
    By RCL in forum The Games Factory 2 - Technical Support
    Replies: 8
    Last Post: 21st November 2008, 07:41 PM
  2. Newbie question about Platform Movement Object
    By Brian in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 12th April 2008, 11:57 PM
  3. Newbie question about the database object
    By mtilton in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 28th July 2007, 11:54 PM
  4. Newbie Question, too!
    By Kid_Roleplay in forum The Games Factory 2 - Technical Support
    Replies: 4
    Last Post: 28th October 2006, 04:52 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
  •