ViewportBottom problem

0 favourites
  • 5 posts
  • I have some interface buttons. They are bounded to viewports values like this:

    Those, which lined with red color, adds some value to ViewportTop, and the green one substracts from ViewportBottom.

    Here is the code:

    (Layer #2 is an "interface" layer with 0 X and Y parallax)

    It works fine in default Construct 2 preview (without Fullscreen), but this is what I got on mobile devices (with Fullscreen on, of course):

    It is obvious, that ViewportLeft and Top are always = 0 in this case, so there might be no problems with adding some values to 0. Seems like there IS some trouble with substracting from ViewportBottom, which is always different, BUT ViewportRight is always different too, but it works well.

    I cant get what is wrong. Please help!

  • I might be wrong about this, but, if the canvas resizes, ViewportLeft might not always = 0.

    You could try making your own ViewportBottom. I think it would be something like scrolly + (WindowHeight/2). This might not work though if you are using a layer with a parallax of 0.

  • I might be wrong about this, but, if the canvas resizes, ViewportLeft might not always = 0.

    You could try making your own ViewportBottom. I think it would be something like scrolly + (WindowHeight/2). This might not work though if you are using a layer with a parallax of 0.

    But anyway, what is the problem with this logic? These viewports could take any values, but it must always display my button on a position I entered. Top works, Bottom is not, why?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh, I discovered what the problem was.

    "Else" wasn't working as I expected to, I had to specify the animation.

    Did I miss meaning of "else" or it is an program's logic issue?

  • else doesn't do any picking, so if there are multiple buttons, the else can be unpredictible.

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