User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 13

Thread: Repelling enemies from themselves?

  1. #1
    No Products Registered

    Join Date
    Dec 2009
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Repelling enemies from themselves?

    Pushing enemies out of each other...How do I do that?

    In games like Odin's Sphere and Muramasa: The Demon Blade you fight enemies that don't collide with each other in the conventional sense ala Mario. Instead when the enemies are overlapping each other they slowly are pushed out. That way you never have a bunch of enemies stacked up.

    Anyone know how to accomplish this? I imagine they would be pushed out of each other in opposite directions.

    Still, I have no idea how to go about this. Any ideas?

  2. #2
    No Products Registered

    Join Date
    Dec 2009
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Repelling enemies from themselves?

    Anyone? I have no idea how to do this one. I just tried doing distance code for the same objects and it didn't do squat. I tried this specifically

    Always
    -Set X dist to X( "Enemy" )-X( "Enemy" )

    Clearly that won't work for obvious reasons. I've never had to really deal with this before. Anyone have a solution or example?

  3. #3
    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: Repelling enemies from themselves?

    Wait, you want them to overlap, then slowly both move away from the collision?

    How far do you want them to overlap? What movement are you using, if any? (I haven't played Odin's Sphere or whatever)

    Maybe a diagram or something would help?

    Otherwise I'd say make the object slowly stop (by subtracting one from its speed) when it's detector (invisible object always being set to the position of the object) is overlapping the opposite object. When it reaches 1, (aka as far as it can go before it triggers every time it's stopped) then reverse it and add to the speed.

  4. #4
    No Products Registered

    Join Date
    Dec 2009
    Posts
    40
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Repelling enemies from themselves?

    The main reason for this is so they don't get all bunched up and visually look like only 1 enemy.

    Heres a quick mockup



    Another reason for this is so they can move through each other which allows me to have more enemies on screen. I'll probably only have them pushing out if they overlap completely for too long or something.

  5. #5
    Clicker Multimedia Fusion 2
    Fusion 2.5 (Steam)iOS Export Module (Steam)

    Join Date
    Jun 2007
    Location
    United States
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Repelling enemies from themselves?

    Detector one pixel in size in the center of each enemy. When the detector is overlapping another detector (aka when an enemy is completely overlapping another enemy) reverse the enemy's direction. This requires the detectors to all have the same X position of course. Or the same Y position if they move vertically.

  6. #6
    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: Repelling enemies from themselves?

    You might want it a little bigger than that depending on the push distance. But I'd say for certain that you want detectors!

    If you want it smooth, reduce the speed before reversing and then increase the speed again. If you want it to be quick, bounce on detector collision.

    Will that work?

  7. #7
    Clicker Fusion 2.5 Developer
    00J's Avatar
    Join Date
    Jun 2006
    Location
    Virginia, USA
    Posts
    1,510
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Repelling enemies from themselves?

    yeah detectors on their feet, and also maybe some code to keep them on the same plane. Like always set y to 400 or so.

  8. #8
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Repelling enemies from themselves?

    You could run a fastloop that moves each active in a variety of directions, records it in Alterable values, then moves back. You will know what is around the player and not need detectors.

  9. #9
    Clicker

    Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export ModuleUnicode Add-on
    mobichan's Avatar
    Join Date
    Oct 2007
    Location
    Buffalo, NY
    Posts
    3,310
    Mentioned
    28 Post(s)
    Tagged
    0 Thread(s)

    Re: Repelling enemies from themselves?

    So, how exactly do they get on top of each other in the first place? Because your AI code could just stop them from moving (stall them, for instance) when they get near each other.

  10. #10
    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: Repelling enemies from themselves?

    If both enemies were already moving anyway, wouldn't they just move off one another?

Page 1 of 2 1 2 LastLast

Similar Threads

  1. How to do Enemies?
    By Corlen in forum Lacewing
    Replies: 4
    Last Post: 18th April 2012, 06:59 PM
  2. enemies
    By WareWolff in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 30th June 2010, 08:53 PM
  3. Enemies
    By WareWolff in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 29th June 2010, 06:48 AM
  4. thrown enemies not detecting other enemies
    By mobichan in forum File Archive
    Replies: 4
    Last Post: 8th April 2009, 06:40 PM
  5. enemies
    By spartan117 in forum The Games Factory 2 - Technical Support
    Replies: 1
    Last Post: 7th February 2007, 09:05 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
  •