User Tag List

Results 1 to 3 of 3

Thread: Values: only 1 condition met but 2 counted

  1. #1
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)

    Join Date
    Sep 2007
    Location
    Austria
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Values: only 1 condition met but 2 counted

    I have a problem. In my game the player has two slots for powerups. He can carry up to two powerups at the same time. Not more.

    Variable B= 0 -> slot 1 is free
    Variable C= 0 -> slot 2 is free
    Variable B= 1 -> carries powerup in slot 1
    Variable C= 1 -> carries powerup in slot 2

    1) Player collides with powerup box
    if B=0 and C=0 (player has NO powerups) then set B=1.
    The powerup is assigned to the first slot. Destroy powerup box.

    2) Player collides with powerup box
    if B>0 and C=0 (player carries one powerup in slot 1 but none in slot 2) then set C=1.
    Now the player has one powerup in both slots. Destory powerup box.

    3) Player collides with powerup box
    if B=0 and C>0 (player carries no powerup in slot 1 but one in slot 2) then set B=1.
    Now the player has one powerup in both slots. Destroy powerup box.

    ===========

    When the player collects the box (ONE box) BOTH variables are set to 1.
    He start with B=1 and C=1, collects the box and afterwards, B and C are set to 1. Why?

    It seems as if the command "destroy powerup box" is too slow and the cpu calculates two conditions within the short time in which the box is destroyed. "Restrict actions for 1 sec" did not help either.

    Could you help me please?


  2. #2
    No Products Registered

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

    Re: Values: only 1 condition met but 2 counted

    When you destroy an object in MMF it isn't removed until the end of the event loop. So in your case the 2 top events will run since the box is still there. You can prevent this by turning on a flag on the box when it is destroyed and check if it is off in the other events.

  3. #3
    Clicker Fusion 2.5
    Fusion 2.5 (Steam)

    Join Date
    Sep 2007
    Location
    Austria
    Posts
    289
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Values: only 1 condition met but 2 counted

    Thanks.

Similar Threads

  1. Global Values & Alterable Values with same names
    By Gustav in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 7th November 2012, 06:15 PM
  2. Trying to use OR in a condition to compare more than two values at once...
    By alxmrg in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 25th January 2012, 05:47 PM
  3. How time is counted?
    By dontknow in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 15th June 2011, 03:53 AM
  4. Display values on screen from Alterable Values
    By mikeh in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 13th May 2008, 01:59 PM
  5. Negative values in a List, and Global Values
    By aidmm in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 20th January 2007, 06:08 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
  •