User Tag List

Results 1 to 6 of 6

Thread: Problem with simple physics

  1. #1
    No Products Registered

    Join Date
    Jul 2006
    Location
    Germany
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem with simple physics

    Hi.

    I thought this shouldn't be too difficult. But obviously it is. I have a bouncing ball (selfmade physics) that just won't stop bouncing. I added an event that should make it lie still if the downward speed is too low to bounce.

    The next strange thing is: If you click the 'close window button' (the red button with the but move the mouse away from the x and then release the mouse button - it works!

    I'm very confused and appreciate any help - thanks!
    Attached files Attached files

  2. #2
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleUnicode Add-on

    Join Date
    Jun 2006
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problem with simple physics

    Timed events suck and you should never use them :P

    On the line straight under the "Physix" comment (line 13 for me):
    Ball.Internal Flag 0 is on
    + Every 00"-03 Seconds

    Remove the line
    + Every 00"-03 Seconds

    And it works perfectly. Great engine by the way.


  3. #3
    No Products Registered

    Join Date
    Jul 2006
    Location
    Germany
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problem with simple physics

    WOW thanks a lot! :grin:
    It's working perfectly now. I don't exactly get why, but it's not that important if it works.

    I must confess, though, that the physics are not completely my idea. I adapted and changed an old MMF1 tutorial for flying sparks.


    Thanks again!

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleUnicode Add-on

    Join Date
    Jun 2006
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problem with simple physics

    Well the simple answer is that timing events don't work well, because they aren't based on frames or something like that :P

    So basically if you wanted something to happen less often that its supposed to, then you're better off making your own timer. i.e.

    + Always
    add 1 to counter

    + If Counter >=6
    Set counter to 0

    + Repeat while shift is pressed
    + Counter = 0
    Shoot an object

    This code would only allow the player to shoot a bullet every 1 in 6 frames. It's similar to if you had "Repeat while shift is pressed & Every 0.5 Seconds", however the code above uses frames to measure how often the player should be able to shoot, instead of a timer. Timers also run differently on different computers, and they also have problems when a computer is running the mmf game at a slower framerate than it was designed for.

    So that's just an insight incase anybody else was wondering :P

  5. #5
    No Products Registered

    Join Date
    Jul 2006
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problem with simple physics

    I think the answer to your bouncing prob in general is to give the ball a lower elasticity.

    Eg. Ball collides with floor:

    -Set Y velocity to Y velocity * -1 * Elasticity

    If elasticity = 1 the ball will bounce indefinitely
    If elasticity = 0.5 the ball will lose half its momentum each time it bounces
    If elasticity = 0 the ball will stop immediately when it hits the floor (this will probably cause errors in your physics unless you have a pretty sophisticated collision system running)

  6. #6
    Forum Moderator Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleXNA Export Module
    Sphax's Avatar
    Join Date
    Jun 2006
    Location
    Paris, France
    Posts
    4,454
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Problem with simple physics

    To let your game work correctly check "run while resizing" option of your application.

Similar Threads

  1. Physics question! Making AI that uses Physics Platformer/Physics Static movement
    By Krim in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 13th December 2013, 03:19 AM
  2. Problem with physics (Box 2D)
    By SergioAndre in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 22nd May 2013, 09:08 AM
  3. Possible to make some simple object fall physics without physics engine?
    By Outcast in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 3rd March 2012, 08:56 AM
  4. Trying to Create Simple Platform Game Physics
    By LPViewer in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 18th June 2011, 04:50 PM
  5. Simple box physics movement?
    By machrider in forum Extension Development
    Replies: 1
    Last Post: 21st October 2006, 03:20 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
  •