How do I stop the camera from scrolling outside of a sprite

Get help using Construct 2

Post » Thu Nov 27, 2014 1:31 pm

How do I stop the camera from scrolling outside of a sprite yet keep it's focus on the player?
I wish there was a way to make bound scrolling for sprites, similar to how it is for layouts.
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925

Post » Thu Nov 27, 2014 3:24 pm

There are, just control the scrolling manually via the Scroll to position system action rather than the scroll to behavior.

For exemple (a simple rectangle limitater), Area is a rectangle sprite, player is the target of the camera:

Every tick: System>Scroll To position:
X:clamp( Player.X , Area.BBoxLeft + OriginalWindowWidth/2 , Area.BBoxRight - OriginalWindowWidth/2)
Y:clamp( Player.Y , Area.BBoxTop + OriginalWindowHeight/2, Area.BBoxBottom - OriginalWindowHeight/2)

This should work however I may be incorrectly using the Originalwindowwidth and height (never tried them, and I assume a letterbox scale).

But you get the idea, a manual control is necessary.

As for "I wish there was a way to make bound scrolling for sprites, similar to how it is for layouts.", there could be inconsistency of what the result should do if there is a non rectangular form.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Thu Nov 27, 2014 11:01 pm

The resolution my game is running is 256x224, which is an 8:7 aspect ratio.
Would all the rectangle sprites have to be the same size? Also "non rectangular form"? I thought Construct2 could only do box/rectangle shapes.

Thanks for the help!
The moderators are corrupt and ban for no reason, especially that condescending neckbeard asshole Kyatric. The forums are filled with fanboys.
Banned User
B
22
S
7
G
1
Posts: 558
Reputation: 2,925


Return to How do I....?

Who is online

Users browsing this forum: ametueraspirant, dand and 25 guests