User Tag List

Results 1 to 4 of 4

Thread: Problem w/ sprites overlaying hitboxes

  1. #1
    No Products Registered

    Join Date
    Feb 2010
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem w/ sprites overlaying hitboxes

    Ok, so I have a bunch of the same enemy placed, and they move around properly and everything. Their AI is coded into their hitbox, and their actual graphic is created at the start of the frame and snaps over this hitbox.

    My problem is that when a sprite is destroyed, the others are destroyed as well. The hitboxes are still there though. (The problem similarly occurs when a sprite is supposed to change to a different animation; all sprites animate that way.)

    The issue is that the sprite should be "connected" with its hitbox, but isn't (even though it stays snapped onto the hitbox properly). What do I do?

  2. #2
    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: Problem w/ sprites overlaying hitboxes

    You could spread a value into an alterable variable of your objects and a similar variable in your hitboxes (Maybe call the varaible "ID". Then every frame you can attach them using:

    +ID(graphic)=ID(hitbox)
    -Set (graphic)position to 0,0 of (hitbox)

    If you need to destroy both objects when a collision occurs, you can use:

    +(hitbox) overlapping (*thing that destroys the object)
    +ID(graphic)=ID(hitbox)
    -Destroy(graphic)
    -Destroy(hitbox)

    I haven't tested it, but that should work. Of course, you may have to make it more complex or even use fastloops depending on what destroys your enemies and what happens when they die.

    Good Luck,

    Mobichan

  3. #3
    No Products Registered

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

    Re: Problem w/ sprites overlaying hitboxes

    Take this

    http://www.create-games.com/article.asp?id=1975

    and this http://www.create-games.com/article.asp?id=1960

    and this http://www.create-games.com/article.asp?id=1942

    Read through those thoroughly it should help make things clearer.

    Specifically the first one. "Handling Multiple Objects" You don't have to read the others but I recommend it.

  4. #4
    No Products Registered

    Join Date
    Feb 2010
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problem w/ sprites overlaying hitboxes

    Thanks mobichan, everything pretty much works now! The animations are still a bit off when there are several guys at once, but I'm assuming that's where fastloops will come in handy, I'll try using them later. And Mdsx, I'll make sure to keep those pages close at hand, I only read the first one so far but it was really useful. Thanks!

Similar Threads

  1. Transparent-video overlaying supported in MMF2?
    By MeisterEl in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 19th November 2013, 07:19 PM
  2. Overlaying a track
    By Kalis in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 19th September 2011, 11:04 AM
  3. Problem with Importing Sprites
    By bkfitww in forum Multimedia Fusion 2 - Technical Support
    Replies: 15
    Last Post: 12th April 2007, 11:11 PM
  4. Overlaying Text on Active Objects
    By Shmoo in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 16th February 2007, 02:42 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
  •