Scroll to not working properly with global variable?

From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hi everyone,

    Please help me to find out the issue.

    When click on the blue circle it will add 0.01 to the Variable1 then the screen will scroll to a specific Y position but when the variable value is 0.06 scroll to action is not working

    If the variable1 value is 0.01 screen will scroll to Y axis 1500

    If the variable1 value is 0.02 screen will scroll to Y axis 2500

    It works fine till the value 0.05 but at 0.06 screen not scrolling to y axis 6500

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try this, in the LAYOUT PROPERTIES window, look for "Unbound Scrolling" and put a check in it. Then run your project. If it does what you want, then your layout is too small vertically for what you are trying to do. For scrollto to scroll to the position you are trying to scroll to, the position needs to be <= the height of the layout - the height of the window. If that doesn't work still, we would need access to your project to find the problem. A screenshot of your events isn't enough information.

    Plus, you can reduce your events/actions for setting the position to a single event.

    + System: Every tick -> System: Set scroll Y to 100000 × Variable1 + 500

    Since you already have an "Every Tick" event, if you put the single scroll action into that event, these 8 events would become 2.

  • Hi InDWrekt, Thank you for the reply.

    I checked the unbound scrolling as you said but still its not working. I think the problem is not with the unbound scrolling or size of the layout because it works perfectly till the value 0.05 the problem arise only at 0.06

    I am sharing the C3P. Please have a look

    https://drive.google.com/file/d/1ZYCljyuUU39xuQVfo9z2FkPWh6Aq4x-I/view?usp=sharing

  • It's caused by minute errors that are inherent in the values. Change your numbers to whole numbers and add 1 each time and it works fine.

  • Thank you for posting your project. calminthenight is correct but here is a little more information. When you set variable1 to 0.06, the system is registering it as 0.060000000000000005.I know that seems strange but is a problem that computers have when storing really small numbers. These 2 values to us are functionally the same but the computer sees it differently. If you change your variables to integers as calminthenight suggests, you won't have this problem. I am unclear why you are using the decimal value in this project in the first place but I would suggest converting to the decimal only where you need it.

  • As InDWrekt and calminthenight suggest you can simplify it.

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