User Tag List

Results 1 to 6 of 6

Thread: Paint to Backdrop jumping when a Parallax Background

  1. #1
    Clicker Fusion 2.5

    Join Date
    Feb 2014
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Paint to Backdrop jumping when a Parallax Background

    Hi, so for my game one of the things that happen is when players kill enemies, the bodies will leave a blood mark on the background where they died, as well as a mark on the background every time they end up landing on the ground or a wall (leaving a surprisingly performance safe trail effect if the enemy is sliding along the floor, or a performance safe splatter if the enemy falls from a height).

    Now this is all fine and good, as it looks awesome and like I said it doesn't even hit performance all that bad. But what I'm concerned about is if any situation arises where I end up with a lot of blood, that will be so many 'objects' in game doing absolutely nothing but looking pretty. So what I would normally do is have the blood splatter paste its image as a backdrop and then remove that active object to increase performance for those situations that get extra messy. The problem is that this background is parallax, so when I paste the blood, even though the active object version is in the right location in the right layer, the backdrop version is affected by the parallax way more heavily. Depending on where the camera is in the level, the backdrop can jump a distance more than twice the length and width of the blood smear when it was an active object.

    Here is a link to the .mfa to show what I mean. Notice there is no issue in the top left corner, but in the right of the play area the splatter gets warped a huge distance when it becomes a backdrop.

    http://www.mediafire.com/download/c8...allax+Test.mfa

    Can anyone help me figure out how to fix it?

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Mmm, not moving blood-splats in layer 1 is not a suitable solution?
    (leaving them in non-parallaxed layer)

    Otherwise, you could setup a "re-placement" of bloodsplats before blitting in the background,
    basing on parallax difference ratio between layers/camera position... I suppose

  3. #3
    Clicker Fusion 2.5

    Join Date
    Feb 2014
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I would do the first solution but then it appears that the blood is floating in front of the background, which is bad for obvious reasons.

    I've tried setting up a replacement and managed to get it pretty close, but something is off about my formula. I've tried multiplying the position by the coefficient of the parallaxed layer but that only works for certain points in the map. Other areas it still has a pretty noticeable jump.

  4. #4
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Yeah, I would do the first solution but then it appears that the blood is floating in front of the background, which is bad for obvious reasons.
    Yeah, of course, sorry but that night I was a bit in a hurry and didn't consider well the issue!


    I've tried setting up a replacement and managed to get it pretty close, but something is off about my formula. I've tried multiplying the position by the coefficient of the parallaxed layer but that only works for certain points in the map. Other areas it still has a pretty noticeable jump.
    Yes, this is due to the fact that you have to consider scroll ("camera") position while parallaxing,
    because parallax starts when graphics actually scroll, that is, horizontally, half-frame from start (if you center the camera) and stops half-frame from the end. So with a window width of 640 in a 1200px frame you get 1200-640=560px of total parallax, which is 560*0.9(your parallax ratio)=504 and so a maximum of 560-504=56 px displacement in the last half screen.
    Thus (for X coord.), you should set up three zones:
    - left half screen non scrolling, no modification
    - central part scrolling with max ratio related to xposition
    - right half screen non scrolling with fixed 56px displacement (with 640 window in 1200 frame)

    I've setup an example (only for x coords):
    Parallax Test.mfa

    However, pasting in background while camera scrolls still causes a noticeable displacement,
    you should "stop" your mouse and spray...
    hope your charachter stands still while "splatting"

    Side note: is there a particular reason you're using dozens of texture objects instead of one single "motif" quick backdrop? (see example)

  5. #5
    Clicker Fusion 2.5

    Join Date
    Feb 2014
    Posts
    48
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Awesome, thanks.

    So for the equation I'd be using the dimmensions from the window of the game to start my calculations, not the frame?

    And no, there's not a really good reason why I did the background like that other than I was just quickly throwing one together out of the built in backdrops for this example. In the actual game the background is handled much more efficiently. Heck, in the actual game the mouse isn't even used. It was just like that for the example to have an easy way to splatter decals on the background anywhere its needed.

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleiOS Export Module
    Fusion 2.5 (Steam)
    schrodinger's Avatar
    Join Date
    Nov 2014
    Posts
    3,159
    Mentioned
    28 Post(s)
    Tagged
    1 Thread(s)
    Yes, or more precisely: you should use the game window to calculate the "safe zones",
    namely the zones where the pasted background need no displacement,
    these zones are in short "half window", because "camera" start to scroll from half window (and not half frame)
    and when the camera doesn't scroll there is no parallactic displacement to fix.

    If window dimensions are already decided and fixed you can hard-code them,
    otherwise you can retrieve them with the "window control" object,
    or by using the trick I placed in the example, with the "start of frame" condition that sets
    the global values "screen width" to screen x right pos. and "screen height" to y bottom pos.

    The equation does the following:
    1) if camera position < first half window: no modification
    2) if camera position > first half window < frame width -half window: you are scrolling!
    so position is corrected by this means:
    current position - (( current position - half window) - (( current position - half window ) * parallax ratio))
    in short, you are toggling the amount of parallax that has occurred
    3) if camera position > frame width - half window: fixed modify zone, camera is not scrolling but you get the total amount of parallaxing, namely:
    current position - (( frame width - full window ) * parallax ratio))

    Note: I would have better used a single action and a "immediate if" object,
    I think It should be more handy also because adding the Y displacement calculation may led to high redundancy in code...
    but I didn't know if you wanted to add extensions to your project.

    In the actual game the background is handled much more efficiently. Heck, in the actual game the mouse isn't even used. It was just like that for the example to have an easy way to splatter decals on the background anywhere its needed.
    Sorry, I didn't want to be tedious, it was just a quick tip in-case-you-didnt

Similar Threads

  1. Create a Painting APP - Tutorial
    By Sparckman in forum Guides, Tutorials, Examples, Widgets
    Replies: 7
    Last Post: 5th January 2015, 07:01 AM
  2. Parallax scrolling with background object speed
    By Ryan in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 21st November 2013, 07:39 PM
  3. Q about Background System Object and Parallax
    By Shawn in forum Multimedia Fusion 2 - Technical Support
    Replies: 8
    Last Post: 19th May 2009, 12:30 PM
  4. Parallax background
    By diomdennis in forum The Games Factory 2 - Technical Support
    Replies: 2
    Last Post: 20th March 2008, 04:11 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
  •