User Tag List

Page 5 of 5 FirstFirst ... 3 4 5
Results 41 to 48 of 48

Thread: set X to X -0.3 moves by -1.0 : bug or feature?

  1. #41
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Posts
    1,300
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    You should always think of the built in X and Y position values as being "write only" - always use alterable values to store an object's position coordinates as floats, and never retrieve an object's built in X or Y position (except in the rare case where you really do want the position it's actually drawn at instead).

    I appreciate that the example above with the moving arrows is just to highlight a point, but it's not something you should ever be doing.
    It should be:
    Arrow: Set xPos to: xPos("Arrow") - 0.0001
    Arrow: Set X position to xPos("Arrow")
    ...where "xPos" is an alterable value

    As long as you're doing that, sub-pixel movements will work fine, and no object will ever be drawn more than 1 pixel out of position. Bear in mind that objects with negative positions are likely going to be offscreen anyway...

    Personally, I use round() whenever setting an object's position (not during movement calculations, but when setting the final position), since that's the most accurate and will give the smoothest movement, and realistically, the performance difference is not going to be noticeable.

  2. #42
    Clicker 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)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,125
    Mentioned
    76 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by BartekB View Post
    Fusion's position actions use int() on the final result.
    Aha - the final part is the key that I was not considering. In X = X position - 0.001 I was fixated only on the -0.001 part, expecting that it should be truncated to 0. But as you say, Fusion truncates the entirety, so X - 0.001 becomes 49.999 or whatever.

  3. #43
    Clicker 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)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,125
    Mentioned
    76 Post(s)
    Tagged
    0 Thread(s)
    @MuddyMole : That's good advice in general, and it indeed would have prevented my problems, but it's unfortunately not appropriate for what I'm currently doing. You see, I'm controlling lots of little particles (in this case, leaves). The particles use Bouncing Ball to move on their own, but certain things (such as Spryke colliding with them) can cause additional movement. It would actually be quite expensive to position every single leaf with Leaf: Set X position to xPos("Leaf") when there are so many of them. It's much cheaper to leave most of them alone (the Bouncing Ball movement will take care of movement on its own) and just add some extra XY position only to those which need it, such as the ones Spryke has collided with (and even then, I only add the extra XY every few ticks, not on every frame). But in order to be able to add XY position to a leaf, I first need to read its XY position, since the bouncing ball has moved it somewhere without my events knowing where. So I end up with Leaf: Set X position to x("Leaf") + extraXPos("Leaf").

    And as you can see towards the end of the GIF, I apply an ease-out movement to the leaves, meaning that I keep diminishing extraXPos("Leaf") towards zero. The problem was that for those leaves moving left, even when extraXPos("Leaf") became really tiny like -0.001, they would perpetually move by 1 pixel instead of easing out to a stop. My solution was just to apply int(): Leaf: Set X position to x("Leaf") + int(extraXPos("Leaf")). That seems to come with a little performance cost, but nothing too bad.



  4. #44
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)
    elvisish's Avatar
    Join Date
    Oct 2014
    Posts
    618
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Is bouncing ball more performant than using a custom bouncing ball engine forEach particle?

  5. #45
    Clicker 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)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,125
    Mentioned
    76 Post(s)
    Tagged
    0 Thread(s)
    I don't actually know, but I do assume so.

  6. #46
    Clicker

    Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jun 2006
    Location
    Killeen, TEXAS
    Posts
    1,037
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Sigh. He can never be told

  7. #47
    Clicker 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)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,125
    Mentioned
    76 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by elvisish View Post
    Is bouncing ball more performant than using a custom bouncing ball engine forEach particle?
    I just did a quick test and the bouncing ball movement definitely seems quicker. About 15% higher framerate with the bouncing ball, in my test. And that's just for moving things constantly in one direction. If you had to code in the actual bouncing, randomising of direction on creation, automatic animation switching, etc., I'm sure a roll-your-own method would be costlier still.

  8. #48
    Clicker Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleiOS Export ModuleInstall Creator Pro
    Fusion 2.5 (Steam)
    elvisish's Avatar
    Join Date
    Oct 2014
    Posts
    618
    Mentioned
    14 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I've always been worried about collision detection for built-in movements, but for visual effects like particles it wouldn't matter so much.

Page 5 of 5 FirstFirst ... 3 4 5

Similar Threads

  1. Grass that moves when the player walks over it.
    By BrianK in forum Multimedia Fusion 2 - Technical Support
    Replies: 9
    Last Post: 12th July 2017, 07:25 PM
  2. Replies: 1
    Last Post: 28th May 2015, 07:12 PM
  3. Advanced Special Moves Example
    By N64Mario in forum Guides, Tutorials, Examples, Widgets
    Replies: 1
    Last Post: 4th March 2014, 12:58 PM
  4. Moves left more than right
    By Holden in forum File Archive
    Replies: 8
    Last Post: 28th March 2008, 02:47 AM
  5. space bar moves it
    By delusan in forum The Games Factory 2 - Technical Support
    Replies: 4
    Last Post: 27th May 2007, 05:35 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
  •