ViewportBottom problem

Get help using Construct 2

Post » Sat Mar 14, 2015 7:41 pm

I have some interface buttons. They are bounded to viewports values like this:
Image
Those, which lined with red color, adds some value to ViewportTop, and the green one substracts from ViewportBottom.

Here is the code:
Image
(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):
ImageImageImageImage

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!
B
39
S
16
G
6
Posts: 238
Reputation: 7,895

Post » Sun Mar 15, 2015 8:26 am

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.
B
17
S
2
Posts: 66
Reputation: 1,382

Post » Sun Mar 15, 2015 11:22 am

WarpedOldMan wrote: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?
B
39
S
16
G
6
Posts: 238
Reputation: 7,895

Post » Sun Mar 15, 2015 3:04 pm

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?
You do not have the required permissions to view the files attached to this post.
B
39
S
16
G
6
Posts: 238
Reputation: 7,895

Post » Sun Mar 15, 2015 3:10 pm

else doesn't do any picking, so if there are multiple buttons, the else can be unpredictible.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093


Return to How do I....?

Who is online

Users browsing this forum: Diginampl, istero and 10 guests