User Tag List

Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 23

Thread: Mario Type Game - Enemies not changing direction

  1. #1


    Join Date
    May 2010
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mario Type Game - Enemies not changing direction

    I have been trying to recreate a mario type game side scrolling 2d action platform game. I have used a few methods but have not found a good way to make enemies be able to walk across platforms or blocks, and fall when not, and then turn other way when they are walking and hit an obstacle.

    I have used a custom way of simulating the gravity or movement. I just changed x value (based on an alterable value saying if its facing left or right) and then increment it by one if its on a platform. I modify its y position so it moves down when not in a platform. I am not sure how to detect a collision in the sides of an active object, so i created a box that follows the object (will be invisible later) so i can tell it collides when moving left or right and when to change direction.

    I also get the object to collide with one side and change direction, but it ignores the other condition. My enemy has the pinball movement, but has 0 gravity and speed (so i can add impulses like springs, etc). It always seems to not change its direction value (alterable value stored in the active object) when the "actionBox" that follows the enemy collides with the object. I tested and both conditions are met, it collides, and its value is "facing the right way" but it wont change the alterable value. Its very confusing as y it doesnt.
    Ill post a link to my mfa file.

    Here it is:
    View MFA


    The error is when it is going left (alterable var = 0) and it goes through the platform on the left. It turns around on other platform but not on the left. Even if i move the objects to the other side it will still go through same block. I think it is situation based.

    Here is the other .MFA so you can see the objects on the other side and showing the "hole"

    View MFA

    They both have the same name so try not to confuse them or you can rename them.

    How would i also make sure all objects are on same layer? To avoid collision issues?


  2. #2
    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: Mario Type Game - Enemies not changing direction

    did you say left? [crazy]
    might be a related issue, i posted about a direction issue too, concerning making an active change direction to the left...

  3. #3
    No Products Registered

    Join Date
    Aug 2008
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mario Type Game - Enemies not changing direction

    This could be the long way, but couldn't you make a completely transparent object named left, and one named right. Just clone the object (so it doesn't make more than one in the program editor) and say, if enemy (group) touching left, set direction=right and vice versa.


  4. #4


    Join Date
    May 2010
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mario Type Game - Enemies not changing direction

    Ya but I am wondering how I can do this in the easiest way. For debugging too. I also just wanted to know y it isn't working. Is there an extension that can handle multiple enemies and collisions and reverse directions all at once? Or a extension to detect which side of the active object has the collision? This might be a bug and is consistsntly reproduceable. Both conditions met but the alterable value isn't changed. Other actions are carried out for those conditions tho. Just is confusing. Could it be a layer issue? Or pinball movement type? Any extension to just add projectile simple physics? I don't need much just to handle falling and impulses to change direction.

  5. #5
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mario Type Game - Enemies not changing direction

    The reason this happens is because of how MMF treats the event list. Every frame MMF runs through and checks every event in the event list from the top to the bottom. If your object is moving to the left MMF will first set the direction value to 0 when it reaches event 8, but as the object still is inside the wall when it reaches event 9 the value will be reset to 1, thus making the object move through the wall.

    One way around the problem would be to use a flag instead of a value for the direction, and simply toggling the flag when the object hits a wall.

  6. #6
    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: Mario Type Game - Enemies not changing direction

    Ah yes. Flags would probably work better because they "toggle" on and off.

    -Now also remember though that you can control how MMF fires through the events list. Remember that all [color:#FF0000]Red[/color] Events also happen before all other events too.

    So you might be able to still use the alterable values just add "collides with wall" that should be RED, see what happens then, or you could do is active object overlapping wall? and facing right? + Alterable value is different than 0? Then make active object face left!
    Sometimes you have to make MMF do what you want it to do with a little arm twisting...

    I usually find i can get anything to work if i add enough circumstances for MMF to check and eliminate to make an Event TRUE.

  7. #7


    Join Date
    May 2010
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mario Type Game - Enemies not changing direction

    Ok, red events are test above all in descending order right? I have tried "overlaps obstacle" over "collides with" but same result. How would i set a flag? (and have it named, for debugging purposes) is it just like an alterable value but stored in the object as well? and wouldn't the flag be checked just like the alterable value and thus make the same "logic error" that exists now? can someone upload a mfa that demonstrates this "glitch" being fixed? if i arrange the left one below the other then it will do it to the right side. so i have no idea as both will be checked in some order and one will be the "gap" that doesn't work right.

  8. #8
    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: Mario Type Game - Enemies not changing direction

    -first, did the collides with hightlight as red? If Collides with doesn't look like this-> [color:#FF0000]collides with background[/color] then the order will not be the first events mmf will always check every loop.

    -next does the right work all the time? or does left work sometimes and right work sometimes?

  9. #9


    Join Date
    May 2010
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Mario Type Game - Enemies not changing direction

    The collides event appeared red. The left side is ALWAYS the side that doesn't work. I even moved the blocks around and used a key to turn the enemy around and it works on the right side. But the key wont turn around the enemy when it gets close to the "hole" on the left side. Its like it ignores it in that situation or something. I don't know, its dumb how mmf2 acts up and is seemingly unexplainable.
    From what this other person said, mmf2 loops, but in my scenario he said that whichever is first will be the side that works. I rearranged them in the event editor and it is still the left side. Even when the left side is collides and right is overlaps.

  10. #10
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: Mario Type Game - Enemies not changing direction

    MMF2 redraws the frame between each loop of events. Thus, the last action of the last event in your code is the one that will override anything else.

    For instance if you set a counter to 1 then to 2 every frame, it will always show 2 and never show 1.

    However if you try to get the value of the counter between those two events it will be 1.

    It is like cooking, there is an order to it that must be followed for it to work right.
    Working as fast as I can on Fusion 3

Page 1 of 3 1 2 3 LastLast

Similar Threads

  1. Changing colors of an 'Animated' type Counter?
    By King_Cool in forum SWF/Flash Export Module Version 2.0
    Replies: 0
    Last Post: 30th May 2012, 12:06 PM
  2. Advice in changing enemy direction
    By Warmachine in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 16th September 2011, 10:34 PM
  3. Changing NPC's into Enemies
    By Sonti in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 19th April 2009, 09:16 PM
  4. Direction Changing + movement
    By Wingzero354 in forum Multimedia Fusion 2 - Technical Support
    Replies: 17
    Last Post: 29th March 2008, 08:06 AM
  5. Changing active object direction (???)
    By JohnC in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 19th January 2008, 11:58 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
  •