User Tag List

Results 1 to 9 of 9

Thread: Enemies with gravity

  1. #1
    Clicker Fusion 2.5 Developer

    Join Date
    Dec 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Enemies with gravity

    I've been trying to do enemies that jump around the play area. When it comes to wall detecting, I've been trying to avoid making sensors, and the results have been glitchy. Now then, when I try to use sensors, I spread value A of the sensor and the enemy to make each have a separate ID. However, if I try to make an event with 'if value A of sensor = value A of enemy', it bugs totally, and A) can't find the sensor or B) the event affects to every enemy in the play area at the same time.

    Does any of you have any examples or other kind of help for doing enemies with gravity?

  2. #2
    No Products Registered

    Join Date
    Apr 2008
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemies with gravity

    In my experiences, it's bugging because the conditions are calling different objects. If you're not looking for accelerated gravity, it's rather easy. If you are, then you're going to need a detector (because of the way groups work and can't call themselves).

    Basic premise is this:

    -Spread value over object (or group)
    -Always:
    --Start loop 1 for # of object times
    --On loop + loop index = value
    ---Start loop 2 X times (X is fall speed in pixels)
    ---On loop 2 + value = loop 1 index
    ----Move down 1 pixel
    ---On loop + object over background
    ----Move up 1 pixel, stop loop 2

    That should make it work.

  3. #3
    Clicker Fusion 2.5 Developer

    Join Date
    Dec 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemies with gravity

    Wow now that looks imaginative! I've never thought it could've been done that way!
    ...But however, I need accelerated gravity. I think I didn't say it clearly in the first post, but I can accept movements with sensors, I'd just like an example on how to get the sensors and the whole movement WORK with ,any enemies at the same time.

  4. #4
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemies with gravity

    You can do that too. Just have a variable for vertical speed and start loop 2 as often as that value.

    If you increase that variable every frame / interval, you have increased falling speed.

  5. #5
    Clicker Fusion 2.5 Developer

    Join Date
    Dec 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemies with gravity

    Good idea! I might actually try that. Though there's still a problem since now if the enemy touches a wall on his left or right, it bugs.

  6. #6
    No Products Registered

    Join Date
    Apr 2008
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemies with gravity

    it gets more complicated to do this actually, because instead of using the object to do the collision detection, you need to position a detector under it. Set it's value to the value of the objects, and use that to call the object within the conditioning. Or just position it below the object and use the loop index before to move them together.

    You might need to add an infinite loop before loop 2 that you can stop, so that way it'll cycle through all of 1. Let me know if it works!

  7. #7
    Clicker Fusion 2.5 Developer

    Join Date
    Dec 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemies with gravity

    Quote Originally Posted by pirodaggar
    it gets more complicated to do this actually, because instead of using the object to do the collision detection, you need to position a detector under it. Set it's value to the value of the objects, and use that to call the object within the conditioning. Or just position it below the object and use the loop index before to move them together.

    You might need to add an infinite loop before loop 2 that you can stop, so that way it'll cycle through all of 1. Let me know if it works!
    Well, I've been trying to do this with sensors, but if I spread the ID values of the enemies and the sensors, and try to make them recognize each other with those ID's it bugs. Basically an event 'IF value A(enemy) = value A(sensor)' doesn't work.

  8. #8
    No Products Registered

    Join Date
    Apr 2008
    Posts
    65
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemies with gravity

    So use the loop index of loop 1, position the detector under it and during a falling loop just move the two independently (again using the loop index of 1 to pick the object out of the group) until detector hits something.

    Also, I believe it needs to be value a(sensor) = value a(enemy), and if that still doesn't work its because your conditions are negating out the objects.

    The way conditions work for things like groups is every action affects the group until they aren't part of a condition, then they are removed from the action-affect list. This caused a lot of problems for me in the past so I would just be aware of that.

  9. #9
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Enemies with gravity

    You can make use of MMF's oddity, that it always matches up objects of which the same amount exists. So if you have 20 enemies and 20 sensors they match up. Search the forum for this, there's a nice thread explaining it better.

    On the other hand that is pretty silly for sensors. Just use one sensor, loop through all enemies and position it to the current one, one at a time. If you need different shapes for different directions, you can either use a different object per shape, or animation frames/directions for each shape.

    Even better, don't use any sensor. You can check against the collision mask of the frame and see if there's an obstacle at a given X/Y position. Then you don't need any extra objects. Just check at as many positions around the enemy as you need (e.g. twice under it, left and right bottom and top, above, in the center).

    So. There's three doable solutions (I've used all of them in the past and they all work). The last one is the fastest and most reliable one (even if you check many pixels (e.g. 20)), unless you need really odd shaped sensors or need to check against other objects. Then the second solution is better. The first one is just for when you don't know any better :P

Similar Threads

  1. Problem in the gravity for enemies
    By Ls2 in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 3rd August 2011, 03:50 AM
  2. Gravity
    By Degamer in forum The Games Factory 2 - Technical Support
    Replies: 7
    Last Post: 12th July 2010, 07:11 PM
  3. thrown enemies not detecting other enemies
    By mobichan in forum File Archive
    Replies: 4
    Last Post: 8th April 2009, 06:40 PM
  4. Simpliest way to give all enemies Gravity/Physics?
    By Zenoff64 in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 3rd May 2008, 02:31 AM
  5. gravity
    By Taco in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 18th September 2007, 08:13 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
  •