User Tag List

Results 1 to 8 of 8

Thread: Pixel Precision

  1. #1
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pixel Precision

    Hi, I haven't posted in here for a while....anyway...
    As i was looking through soem of my old examples and edits of examples I found that when you have positions set to values, it only accepts integers,ie
    Code:
    Always
    +Set Xposition to X( "Active" )+Alterable Value A
    If Alterable value A was 1.3, it would act as 1.

    I have concluded that the only reason for this is you can't set an object to between pixels, and the only way I have found to fix this is to use Alterable Values and set the X and Y positions based on those.

    Now, I have long since decided to make movement engines for MMF2 so I could make games easier. Now that I have decided to put that plan into action, I have started with a platform movement.

    The idea behind this was simple, only use Alterable Values that have a direct influence on the movement. None of that grav and horiz stuff from the tutorial that no matter what you changed it to at the start, it wouldn't change anything.

    So, I started with all that Grav and Horiz stuff, modeling my engine off the tutorial. Well, actually I just edited code from it but whatever. I replaced the grav and horiz with Alterable Values Y and X respectively, and the engine still worked fine. So far, I was doing good. Then, I replaced all the position events with Value V for X and W for Y(It seemed to make sense at the time)and I added two events:
    Code:
    -Start of Frame
    + Set Alterable Value V to X( "Active" )
    +Set Alterable Value W to Y( Active" )
    
    -Always
    +Set X position to Alterable Value V( "Active" )
    +Set Y position to Alterable Value W( "Active" )
    And that was the night it all went wrong...

    Suddenly, my player would get stuck in the ground and not come up, and be unable to move because it was in the ground. When it touched the roof it shot up until it was completely overlapping it. The chaos reigned!I spent quite awhile trying to figure out what happened and I never could...

    So, I come here today to plead for help. If there is any chance somebody could help, any chance at all, please tell me. I really need to sleep now...

    And that concludes my life story.

    PS: If anyone here dislikes all these 2/3 line paragraphs, they really look longer while I am typing them

    PPS: I almost forgot...Linky

  2. #2
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel Precision

    It dawned upon me last night that I hadn't asked a question yet. So, why is the player getting stuck in the background when I set its position based on an alterable value and not when I deal with its position directly?

  3. #3
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export ModuleInstall Creator ProPatch Maker
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    DJFuego's Avatar
    Join Date
    Jul 2006
    Location
    UK
    Posts
    1,416
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel Precision

    Alterable variables are not updated the same way and I have found from expirence that if you base any time related movements using Global or alterable vars then you are never going to get what you want.

    It's annoying as you'd expect them to 'work' as well as everything else.

    Maybe if you incorporate a loop to check the var or pixel collision before movement then you could get the result you are looking for..

    Until then I use overlapping.

  4. #4
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel Precision

    Alterable variables are not updated the same way and I have found from expirence that if you base any time related movements using Global or alterable vars then you are never going to get what you want.
    ...and yet, whenever I try it, I never run across that kind of problems. Are you sure MMF2 is to blame here?

    I couldn't understand the original code, it was uncommented and not all alterable values were named. I figured it would be quicker to just rewrite something. Here's my take on it though, and I sure didn't get any odd problems. Sorry for not making any in-depth explanations in my comments.

  5. #5
    No Products Registered

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

    Re: Pixel Precision

    I take it you want floating point values stored in the position variables, so they can increase / decrease by fractions of 1.
    To get that, when you set them, always include the . somewhere.

    E.g.
    Set alterable value X to 0.0
    or
    Set alterable value X to X("Active") + 0.0

  6. #6
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel Precision

    In my example, that isn't needed. Once an alterable value have turned into a float, you don't need to add +0.0 to it to make sure the calculations happens in floating point mode. I'm not sure if your post was a response to me though.

  7. #7
    Clicker Multimedia Fusion 2SWF Export Module
    Jacob's Avatar
    Join Date
    Jul 2007
    Location
    Second pixel to the right
    Posts
    3,208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel Precision

    @Nifflas, I usually comment my code and the alterable values being unnamed was the entire point of this. The reason I didnt comment it because I took the platform tutorial(uncommented ) and I tried to have the only alterable values that the player could change(the ones that you could see without hitting new) as the only ones with a direct influence on the movement. (your acceleration, speed, number of jumps, etc.) This means I am unable to name those values.

  8. #8
    Clicker Multimedia Fusion 2 DeveloperiOS Export Module
    Nifflas's Avatar
    Join Date
    Jul 2006
    Posts
    2,613
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pixel Precision

    Okey! I don't think I'll have time to go through that platform engine and fix it, but feel free to use mine.

Similar Threads

  1. Double precision doesn't work on Android ?
    By Wolkam in forum Android Export Module Version 2.0
    Replies: 0
    Last Post: 23rd August 2013, 09:18 PM
  2. How would you move an object in straight line pixel by pixel from location to another
    By Tsun in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 22nd December 2012, 10:38 PM
  3. Displaying a double precision decimal
    By cimics in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 3rd February 2012, 10:07 PM
  4. Beta 11: Moving buttons Pixel by Pixel
    By Kisguri in forum iOS Export Module Version 2.0
    Replies: 2
    Last Post: 16th January 2011, 08:54 AM
  5. Double Precision Object
    By drnebula in forum Multimedia Fusion 2 - Technical Support
    Replies: 0
    Last Post: 25th January 2008, 11:46 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
  •