Change parallax rate at runtime

0 favourites
  • 5 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • Hi

    Is there a way to change the parallax rate of a specific layer during runtime via an event?

    I need my hud to be stationairy (which is no problem).

    But, on mouseclick i need to zoom in on the hud, and be able to scroll the hud to mouse X and Y.

    For this (in my current understanding) the parallax X&Y of the hud layer needs a setting above 0.

    So i im searching for a way to change that parallax rate at runtime.

    Like this:

    A: On mouse button down set Layer "hud" parallax X rate to 20 & Set parallax Y rate to 20

    B: On mouse released set Layer "hud" parallax X Rate to 0 & Set parallax Y Rate to 0

    I have searched the forum but havent been succesfull.

    The zooming part is allready done.

    Thanx in advance for any effort trying to help.

    Savvy001

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Zooming is more about layer/layoutscale than parallax.

    And layerscale/layoutscale can be changed at runtime in the system expressions/actions.

  • put all the hud object in a family

    global number mXStart = 0
    global number mYStart = 0
    System: On start of layout
      -> hudFamily set xStart to self.X
      -> hudFamily set yStart to self.Y
    Mouse: on Left Click
      -> System: set mXStart to mouse.X
      -> System: set mYStart to mouse.Y
    Mouse: left button is down
      -> hudFamily set X to self.xStart+mouse.X-mXStart
      -> hudFamily set Y to self.yStart+mouse.Y-mYStart
  • Yann

    Thanx i think i understand.

    And it looks like the exact solution.

    Ill try it and report back.

    Kyatric

    Thanx.

  • Yann

    It worked!

    Thanx! <img src="smileys/smiley17.gif" border="0" align="middle">

    Here is a CapX for anyone who would like to embed this feature.

    http://www.mediafire.com/?e9i51orj9cs75c6

    Middle mouse click on the icon menu to zoom in and position to mouse

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)