How to lock outside view range

Get help using Construct 2

Post » Sat Jun 09, 2012 6:04 pm

Hi Everyone,

I didn't know where to ask this.

I use the Multi Touch plugin, and I have a problem.

This will be hard to explain but here is the thing:
The layout size is smaller than the view/window size. And it looks like, that the program doesnt care about it, I can grab the map outside the view area.
Here is a sample:
The user can grab the map outside the view area (where there is only black in the browser), like the area wouldnt be "locked down".

How can I disable outside the view area?
Posts: 1
Reputation: 252

Post » Wed Jun 13, 2012 3:53 pm

Whew! You say that your layout is smaller than your window, but thankfully in your project that is not the case.

Keep in mind that WindowWidth and WindowHeight are the dimensions of your view window, and (scrollx,scrolly) is the center of the view window over the layout.

So to keep from responding to touches outside the view window add the following conditions to each of the events that handles touch:

touch.X < scrollx-(WindowWidth/2)
touch.X > scrollx+(WindowWidth/2)
touch.Y < scrolly-(WindowHeight/2)
touch.Y > scrolly+(WindowHeight/2)

Here is the modified capx:

Posts: 281
Reputation: 11,918

Return to How do I....?

Who is online

Users browsing this forum: Maced0 and 3 guests