Currently only works with WebGL disabled
Picture in picture is an addon for Construct 2 which allows you to easily set up viewports within your game which capture other parts of the layout. It can be used to easily create split screen games or co-op games where seeing your partners view could help (see Portal 2 for example).
The plugin adds a PiP object which is blank in the editor and is just a viewport, see the demo for example. This viewport can then be used to show any part of the current layout. So you could have a character with the scrollto behaviour and then have a PiP object in the corner which shows you another player.
Each PiP viewport has three properties:
- Capture Type
This can either be set to 'Display Relative' or 'Viewport Relative' and sets the base capture area for the viewport. If the option is set to 'Display Relative' the viewport will capture the entire screen and scale it into the canvas. If the option is set to 'Viewport Relative' the viewport will capture an area the size of the viewport.
- Capture Scale
This is a percentage which describes the area captured by the viewport, if the scale is 100, it will not scale the image further than Capture Type. If the scale is 50 the image displayed on the viewport will be 2x bigger than when it was captured etc.
- Capture below
This can either be true or false, it sets whether the viewport will capture the entire rendered screen or just layers below it (to prevent guis being captured etc).
The PiP object has 5 actions:
- Enable/Disable viewport
Sets whether the viewport is displaying what it is capturing.
- Set viewport position
Sets the location to be captured by the viewport.
- Set capture type
Sets the 'Capture Type' property as described above
- Set capturing below
Sets the 'Capture below' property as described above.
- Set viewport scale
Sets the 'Capture Scale' property as described above.
The PiP object has no conditions.
The PiP object has 6 expressions:
Returns the value of the 'Capture below' property as an integer with 1 being true and 0 being false.
Returns the value of the 'Capture Scale' property as a float.
Returns the value of the 'Capture Type' property as an integer where 0 is 'Display Relative' and 1 is 'Viewport Relative'.
Returns whether the viewport is enabled as an integer with 1 being true and 0 being false.
Returns the x coordinate of the position the viewport is currently capturing.
Returns the y coordinate of the position the viewport is currently capturing.