Destroying dots on miniMap...?

allc1865allc1865 Member, PRO Posts: 777
Hey guys. On my miniMap I have dots the represent the enemies in my game. After I kill all the enemies, there's always one enemy dot left on my map that's not an enemy. How would I destroy the dot after all enemies are killed?
Thanks :)

Best Answer

  • Braydon_SFXBraydon_SFX Posts: 9,273
    Accepted Answer
    That dot is an actor, so you could arrange something like this:

    Create an Integer game Attribute called "HowMany." Leave the value at 0 for now.

    In your enemy actor, add a Change Attribute:
    Change Attribute: game.HowMany to game.HowMany+1

    Make sure that the Change Attribute behavior is at the top of your logic stack.

    Next, when you destroy an enemy, add a Change Attribute:
    Change Attribute: game.HowMany to game.HowMany-1


    Then create a rule in your dot actor:
    When attribute: game.HowMany = 0
    Destroy


Answers

  • allc1865allc1865 Member, PRO Posts: 777
    Thanks! That worked! One more question. What if it's a coin instead and you wanted to destroy the coin dot on the miniMap?
    Thanks! ;) :)
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    edited November 2013
    Not sure what you mean, but you'd use the same rule to destroy something else when all of the enemies are gone:

    When attribute: game.HowMany = 0
    Destroy
  • allc1865allc1865 Member, PRO Posts: 777
    Okay. I have coins around my game that the character has to collect. Those coins are displayed on the miniMap. When the player collides with the coin, I want the coin displayed on the minMap to go away.
    Hope that helps! ;) :) Thanks!
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    That's going to be a little more difficult than the method above. Let me see if I can whip up a demo project for you. Give me a few minutes.
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Here you go. Simple once you know what to do.

    This method assigns a unique ID to each main coin, and mini map coin.
    When I touch a main coin, I change a game attribute to the ID number of that main coin, for example, 2.

    Then in the mini map coin, I say when that game attribute = the unique ID for the mini coin, for example 2, then destroy.

    A mouthful, but you'll see what I'm talking about when you open the project.
  • allc1865allc1865 Member, PRO Posts: 777
    That's a good template, thanks. But I don't think I can use it because I unlocked my actors in the scene to get them to show up on the miniMap...
    Here's my template if you want to look at it.
    Thanks... :) ;)
    https://www.dropbox.com/s/44r3p3rgtum67m3/MiniMap Game.zip
  • allc1865allc1865 Member, PRO Posts: 777
    Thanks, @Braydon_SFX, got it working! :) ;)
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Glad it worked out for you. Best of luck!
Sign In or Register to comment.