User Tag List

Results 1 to 4 of 4

Thread: Activating 1 object out of many identical objects?

  1. #1
    No Products Registered

    Join Date
    Jun 2007
    Posts
    323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Activating 1 object out of many identical objects?

    I'm pretty sure this is done by spreading values or using fixed values, but I'm not sure how to do it. Anyways, If I make more than 1 of the same object, how can I activate only 1 at a time?

    EX: If my player's distance is lower than 100 pixels from an object, then it will activate that object.

    Problem is if I have more than 1 of that object, then none of them work. So how do I select which object will be active depending on how far the player is from it?

  2. #2
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export Module
    Jaffob's Avatar
    Join Date
    May 2008
    Location
    USA
    Posts
    1,833
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Activating 1 object out of many identical objects?

    Quote Originally Posted by camelman
    Problem is if I have more than 1 of that object, then none of them work. So how do I select which object will be active depending on how far the player is from it?
    I have had this problem too. I was making enemies that would shoot at you if you were close enough. Instead, when you approach a certain enemy, all the enemies in the frame would fire.

  3. #3
    Forum Moderator Fusion 2.5 DeveloperAndroid Export ModuleiOS Export ModuleSWF Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    England
    Posts
    3,528
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)

    Re: Activating 1 object out of many identical objects?

    For some things you should spread alterable value 0 then run a loop for the number of objects then on the loop check the alterable value against the loopindex. But not in this case.

    It is very simple, but only if you know how...
    1. Always: Set alterable value of enemy to Sqr( (X("Player")-X("Enemy")) pow 2 + (Y("Player")-Y("Enemy")) pow 2 )
    2. If alterable value of enemy < 100: Activate or whatever

    Comparing against the distance in such a way that it selects only objects which meet the condition is difficult, because 'compare two general values' does not select an object. What is easy is setting all objects to a distance formula calculation based on themselves and the player, and then using the results of that to select the object. Of course this wouldn't work if you had lots of players as well as lots of enemies.
    .:::.Joshtek.:::.

  4. #4
    No Products Registered

    Join Date
    Jun 2007
    Posts
    323
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Activating 1 object out of many identical objects?

    Darn I really thought that would work but it still only activates 1 enemy.. Maybe it's not working because the enemies code. Basically I'm not comparing the distance of player and enemy, but player and enemy spawner. Every 2 seconds that player is so close to the spawner, it will make an enemy. Thing is I want more than 1 spawner. Do you think that's why this isn't working?

    -edit- WOW, my bad. I had "create enemy at layer1" instead of relative to enemy spawner :P Must have overlooked it lol, anyways it works perfectly thanks man.

Similar Threads

  1. Activating one of 2 overlapping objects
    By MegapiemanPHD in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 3rd September 2013, 03:54 AM
  2. Finding the distance between 2 identical objects
    By gkinfinity in forum Multimedia Fusion 2 - Technical Support
    Replies: 12
    Last Post: 29th December 2012, 11:08 PM
  3. activating MMF Developer
    By dascribe in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 13th December 2011, 02:19 AM
  4. Hardcore Questions regarding identical object overlapping
    By Morbus Crohn in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 23rd November 2011, 07:11 AM
  5. Identical graphics - memory
    By Ramses in forum iOS Export Module Version 2.0
    Replies: 1
    Last Post: 12th September 2011, 09:44 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
  •