panning a view port window not entire layout

Get help using Construct 2

Post » Wed Feb 13, 2013 10:06 pm

trying to do something like the way starcraft does and I've seen another html 5 based game that does it with JavaScript so I know its possible just figuring out how to do it construct is eluding me.

I have 2 layers one is my "HUD" which has a sprite entire game size with a transparent "window" cut out, second layer has a tiled background 100 times the size of the game layout.

trying to get where I can drag the tiled background around but constrain it to the "window" of the sprite HUD.

I tried the drag&drop 2 with boundary plugins but then it makes it so I can't drag the background past the sides at all

thanks for any help
B
6
S
1
G
1
Posts: 19
Reputation: 664

Post » Wed Feb 13, 2013 10:28 pm

never mind I figured it out had to set the boundary left right top and bottom based on the layout co-ords and not my HUD sprite took some math to figure out the x and y for each but it works
B
6
S
1
G
1
Posts: 19
Reputation: 664

Post » Wed Feb 13, 2013 10:54 pm

Any chance you can share a sample CAPX of the behavior you have come up with? I am very interested in the method used. Or maybe just a screenshot of the event sheet.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Wed Feb 13, 2013 11:17 pm

there are no events involved just rex's boundary behavior applied to the tiled background.

basically its all math so what I had to do was add a tiled background mine is 89000 x 52000 (i know its huge but its for a 800x800 map grid and each grid is 110x65 pixels) and add the boundary behavior.

find the pixel point of the top and bottom of the window

mine was 33 and 539

the 33 is the bottom. add them together (572) subtract that from the background height (51428) enter that as a negative number for top (-51428)

find the pixel point of the left and right of the window

mine was 22 and 866

the 22 is the right. add them together (888) subtract that from the background width (88112) enter that as a negative number for left (-88112)

enter the numbers into the top, bottom, left and right properties for the boundary behavior on the tiled background.briermay2013-02-13 23:17:29
B
6
S
1
G
1
Posts: 19
Reputation: 664


Return to How do I....?

Who is online

Users browsing this forum: Artpunk and 13 guests