User Tag List

Results 1 to 8 of 8

Thread: Tower Defense hitbox issue

  1. #1
    Clicker Multimedia Fusion 2
    Zarpo's Avatar
    Join Date
    Apr 2010
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Tower Defense hitbox issue

    Hi, I'm currently having some issues while developing my Tower Defense game.
    I am trying to be very limited with my events, since I have no experience in utilizing loops or scripts.

    The issue I have is this:

    I currently have two hitboxes. One for the tower and the other for the enemy. Building one tower works perfectly. The
    tower shoots at the enemy with no problem. But, when there are two towers and two enemies both colliding with them, the towers both shoot in odd directions, they dont shoot the enemies that pass by individually.

    To build a tower, just click a space that's not on the path with the enemies. You will build a wall. Then click the wall and you will build a tower.
    To get a good view of the issue, try replicating this picture:


    http://i.imgur.com/1wIuO3w.png
    Attached files Attached files

  2. #2
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Have you tried changing your events so they use qualifiers, rather than the active objects? That should fix things, I would think.

  3. #3
    Clicker Multimedia Fusion 2
    Zarpo's Avatar
    Join Date
    Apr 2010
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ratty View Post
    Have you tried changing your events so they use qualifiers, rather than the active objects? That should fix things, I would think.
    Hi and thank you Ratty for the quick response!

    Qualifiers? What would I have to change in order to make this work? I never used qualifiers before. : x

  4. #4
    Clicker

    Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCHTML5 Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)Universal Windows Platform Export Module (Steam)
    ratty's Avatar
    Join Date
    Apr 2012
    Posts
    1,165
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Tower Defense hitbox issue

    I'm still learning a lot myself, so I don't want to risk steering your wrong. Instead, I'll recommend you research qualifiers a bit.

    I'm not at my computer so I can't test it, but setting the towers to one qualifier and the enemies to another, then having your events reference qualifiers instead of active objects, just might fix the issue. But like I said, this is theoretical at the time being.

  5. #5
    Clicker Multimedia Fusion 2
    Zarpo's Avatar
    Join Date
    Apr 2010
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    So I looked into making qualifiers and I set the hitboxes/towers/enemies as qualifiers but it still did not work. Would someone be able to check out the MFA file?
    I appreciate it and thanks for the help again.

    EDIT: Turns out that the MFA file contained a custom plug-in. Apologies. Attaching the MFA without it now.
    Attached files Attached files

  6. #6
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleSWF Export Module
    Konidias's Avatar
    Join Date
    Aug 2009
    Posts
    1,546
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    I can't open the project (because I don't have ultimate fullscreen object at work) but I can already tell you what's wrong with it.

    You need to loop through your objects to isolate them in order to properly apply actions to them. Right now what is happening in that screenshot, is that you have the enemy collide with the tower and the tower shoots toward the enemy, correct?

    Well the problem is that MMF is not differentiating between the enemies and the towers. You probably have something like:

    - if enemy hitbox collides with tower hitbox, then do the shoot action toward the enemy

    MMF doesn't see this as "oh this specific enemy touched this specific tower" it just sees "an enemy object touched a tower object". Meaning MMF is getting confused since it's just applying your actions to any tower and any enemy. Not the specific ones. Since both enemy objects are colliding with both tower objects, it doesn't know what to do.

    You need to either use object pairing or the ForEach loop and compare the instances of each tower to the instances of each enemy. Coincidentally, there is an active thread about this right here:

    http://community.clickteam.com/threads/80874-Understanding-ForEach-Object-and-Parent-Child-Objects

  7. #7
    Clicker Multimedia Fusion 2
    Zarpo's Avatar
    Join Date
    Apr 2010
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Konidias View Post
    I can't open the project (because I don't have ultimate fullscreen object at work) but I can already tell you what's wrong with it.

    You need to loop through your objects to isolate them in order to properly apply actions to them. Right now what is happening in that screenshot, is that you have the enemy collide with the tower and the tower shoots toward the enemy, correct?

    Well the problem is that MMF is not differentiating between the enemies and the towers. You probably have something like:

    - if enemy hitbox collides with tower hitbox, then do the shoot action toward the enemy

    MMF doesn't see this as "oh this specific enemy touched this specific tower" it just sees "an enemy object touched a tower object". Meaning MMF is getting confused since it's just applying your actions to any tower and any enemy. Not the specific ones. Since both enemy objects are colliding with both tower objects, it doesn't know what to do.

    You need to either use object pairing or the ForEach loop and compare the instances of each tower to the instances of each enemy. Coincidentally, there is an active thread about this right here:

    http://community.clickteam.com/threads/80874-Understanding-ForEach-Object-and-Parent-Child-Objects
    Okay, awesome! I'll talk a look and research into object pairing/ForEach. I wish there could be a much easier way to make each hitbox "by themselves", though. Your assumption was right on the money.
    The events go like this:

    http://i.imgur.com/yLAwEjX.png
    "If Blue Hitbox overlaps with Green Hitbox, then have the Blue Hitbox launch a bullet at the Green Hitbox."

  8. #8
    Clicker Multimedia Fusion 2
    Zarpo's Avatar
    Join Date
    Apr 2010
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just spent the whole day looking up and understanding loops/Qualifiers. I also referred to the "Tower Defense" MFA example made by Netninja.
    Everything is now working accordingly. Thanks for the help!

    Zarpo

Similar Threads

  1. Elaboration d'un Tower defense
    By faeriebass in forum Multimedia Fusion 2 - Technical Support
    Replies: 11
    Last Post: 5th June 2010, 01:45 PM
  2. Tower defense tower firing
    By splicel in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 7th May 2010, 06:34 PM
  3. Tower Defense: Blocks
    By picklecow in forum File Archive
    Replies: 2
    Last Post: 10th November 2009, 05:26 AM
  4. very basic tower defense
    By maVado in forum File Archive
    Replies: 6
    Last Post: 19th July 2009, 12:10 PM

Tags for this Thread

Posting Permissions

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