How to create a camera shake with Unbounded scroll (solved)

Get help using Construct 2

Post » Tue Aug 12, 2014 5:01 pm

Hi guys

I wanted to know how to create a camera shake in a 940x640 windows size,layout and margin...

i am not using unbound scrolling,
Because when i use it the screen goes messed up :O

EDIT:
i solved the problem so i will tell you how i did it...

So my layout is 960x640 and i'm making a runner like the Construct 2 template and i want to create a camera shake, what i did was

Set unbounded scrolling to YES

Create a square sprite in any place
set an every tick that says -- > Every Tick -> Square set position to LayoutWidth /2 and LayoutHeigth /2

Then set Scroll To Behaviour to the SQUARE (not the player)

After that set your trigger,
i used "Character on land" ---> shake 1 second



Hope it helps, for my example it worked...
Last edited by leomachado666 on Tue Aug 12, 2014 11:26 pm, edited 1 time in total.
B
7
S
2
Posts: 57
Reputation: 591

Post » Tue Aug 12, 2014 5:26 pm

A few thinigs a learned about screen shake. I assume you know about the shake action available for a sprite that has the behavior scroll added to it. If not then that's where you find it :) .. how ever things i found are that the screen will not shake if the viewport is to close to the edge of the layout. Took me a few times to understand why but then i figured (face-palmed more like it) the screen cant possibly show me and area that does not exists which is what would happen if the screen wanted to shake but the viewport is right up to the edge of the layout. You will need your layout to be bigger but prevent the viewport from scrolling to the edge leaving just enough room that if you shake the screen the viewport has some wiggle room on the layout.
B
20
S
7
G
1
Posts: 221
Reputation: 2,077

Post » Tue Aug 12, 2014 5:35 pm

So, which one should i increase? the layout size,margin or window size?... also i suppose the screen shake goes on the character...
B
7
S
2
Posts: 57
Reputation: 591

Post » Tue Aug 12, 2014 5:59 pm

@leomachado666 So the window is what the user sees. Everything beyond it on the layout is out of view... for it to shake the window needs to have viewable area on the Layout on all sides. so inrease your layout size to something larger than the window size. Then make sure your window/view port never gets to close to the edge of the layout. this way when you want the window/viewport to shake there is avaiable layout for it to show on all sides.

Sorry this crood mock up but it will help to visualize it.
help1.png


Your window is what shakes. It needs available space on all sides to move.
You do not have the required permissions to view the files attached to this post.
B
20
S
7
G
1
Posts: 221
Reputation: 2,077

Post » Tue Aug 12, 2014 6:10 pm

If you have trouble with shake at the edge of the screen, you can have a look at my modified plugins: viewtopic.php?t=87207&start=0
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Tue Aug 12, 2014 6:18 pm

@blackhornet - Really nice plugin!... takes the guess work out of it. He will still need a larger layout but wont have to worry about scrolling to edge now.
B
20
S
7
G
1
Posts: 221
Reputation: 2,077

Post » Tue Aug 12, 2014 6:37 pm

@troublesum
I'm setting the layout to 960x640
margings 950,630
Windows size 930x610

On player landed, shake 1 second...

but it doesn't work :(
B
7
S
2
Posts: 57
Reputation: 591

Post » Tue Aug 12, 2014 7:09 pm

@leomachado666
Is your window (viewable area) located on the very edge of the layout when you attempt to shake? When you shake the window attempts to move a few pixels in all directions. If your window is located directly on the edge of the layout then there are no available pixels to show and it will prevent the window from shaking.

Here made you a quick example. When I set scroll enabled to the blue sprite the window moves to the center of the layout becuase thats where the prite is. this leaves room on all sides of the layout for the window to shake. Click the blue sprite to shake.
shake.capx
You do not have the required permissions to view the files attached to this post.
B
20
S
7
G
1
Posts: 221
Reputation: 2,077

Post » Tue Aug 12, 2014 11:17 pm

Te thing is i need to do it with a 960x640 layout :/
edit:
Problem solved

I will edit the first post with the solution!!
B
7
S
2
Posts: 57
Reputation: 591


Return to How do I....?

Who is online

Users browsing this forum: Bobbyneal100, Kin, mickclarke, mikehive, tinhofiel, TRMG and 49 guests