User Tag List

Results 1 to 7 of 7

Thread: Impacting objects differently using box2d

  1. #1
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export Module

    Join Date
    Dec 2012
    Location
    Copenhagen, Denmark
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Impacting objects differently using box2d

    I've played around with box2d the last couple of days and I really like this engine.
    I have a minor issue revolving around impacting different objects of the same instance differently.

    Right now, I have an attack which hits an area around the player.
    Imagine I have a scene like this:

    O__P__O

    The O's being boxes, and P being the player. When he attacks, he hits both of these objects. Now consider this code snippet:
    -Attack Detection is overlapping Box
    -Attacking of Player is 1
    -X Position of Player <= X("Box")
    +Apply impulse, force 70, angle 45 + Random(15) degrees

    -Attack Detection is overlapping Box
    -Attacking of Player is 1
    -X Position of Player > X("Box")
    +Apply impulse, force 70, angle 135 - Random(15) degrees

    When the attack is performed, they both fly to the right, which shows the first code snippet is being fired for the both of them. I obviously want the left box to fly in the other direction (and it does work, if I only hit that box from the right side, without hitting the box to the right).

    I was looking into using the ForEach object, but that didn't work out for me.

    Can anyone help me? Thank you.

  2. #2
    No Products Registered

    Join Date
    Apr 2013
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try to switch condition "Xpos Player <= X(box)" for X(Box) >= X(player) and in the second event for X(box) < X(Player). That should filter it properly.

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export Module

    Join Date
    Dec 2012
    Location
    Copenhagen, Denmark
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, that did the trick!

    By the way, BigHatLogan, Dark Souls is one of my favourite games!

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export Module

    Join Date
    Dec 2012
    Location
    Copenhagen, Denmark
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    New question concerning box2d (title still applies so I'll post my question here).

    I'm trying to make a chain (using the box2d Physics - Rope and Chain object) move when the player touches it, based on direction.
    Thing is, it seems I need change the object type of the player (which is just a square at the moment) into one of the physics movements for it to work?
    I'm using a custom built movement type for the player and I don't want to use any other movement type.

    I thought I could do something like:
    - PhysicsChain: An element collides with "Player"
    + For each element, loop name "movechain"

    - On loop "movechain"
    + Do something here, like add impulse per element in the chain

    The options I need for the chain to move are just simply not there?

    Not sure how to do this properly. Does anyone know?

    Perhaps I need to create a combination of joins to create a different chain, rather than using the Physics - Rope and Chain Object?

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export Module

    Join Date
    Dec 2012
    Location
    Copenhagen, Denmark
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ^ To clarify, I want my custom platform movement to work with Physics - Chains, so that when the player walks into a chain, it starts dangling around.

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    happygreenfrog's Avatar
    Join Date
    May 2011
    Location
    I.L.T.D.O.I.R (I.L.T.D.O.I.R's Location: The Dimension Of Infinite Recursion)
    Posts
    4,304
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    I'm not sure how possible that is. However, as a work-around, you could try making an object with the physics static movement, make it ignore gravity (set the gravity value to 0), always set the object's angle to 0, and always position the object to the actual player object, and then test for collisions with the object with the physics static movement, and make the object with the physics static movement invisible. It might work, though I'm not sure.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export Module

    Join Date
    Dec 2012
    Location
    Copenhagen, Denmark
    Posts
    99
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I had actually tried that, but couldn't get it to work. It seemed I forgot about the Gravity modifier. D'oh. I made the chain "Stop" when any of its elements collided with the Player Physics Detector I made. I also had to tick "Fixed Angle", or the PPD would rotate when it hit the chain.
    It does work, kind of. It stops the chain from swining, but I can't find any command to make the chain move along with the PPD if it's not in motion.

Similar Threads

  1. Box2D objects disappearing randomly
    By SolarB in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 4th July 2012, 08:01 PM
  2. Objects created away from the object that creates them? Using Box2d. (not Box2d2.0)
    By leightonw87 in forum SWF/Flash Export Module Version 2.0
    Replies: 0
    Last Post: 29th February 2012, 11:51 AM
  3. Phizix Box2D - Interaction with regular objects ?
    By donmanolo in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 22nd January 2012, 10:09 AM
  4. Fonts displaying differently in Windows 7
    By mobichan in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 9th November 2011, 02:30 PM
  5. AGBO behaving differently in flash
    By life2searching in forum SWF/Flash Export Module Version 2.0
    Replies: 3
    Last Post: 10th May 2011, 09:40 AM

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
  •