Shake effect without scrollto?

Get help using Construct 2

Post » Tue Dec 09, 2014 1:47 am

Is there an easy way to get the shake effect without the scrollto behavior on an object?
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Tue Dec 09, 2014 3:12 am

if you have a lot of objects on screen and want all of them to shake, I don't think so, But if you only want to shake one object (or one family):

store the actual position of the object in variables.. then use a loop and set the postion to the variable +- random()
Image
B
58
S
13
G
6
Posts: 271
Reputation: 12,128

Post » Tue Dec 09, 2014 3:16 am

set the scroll manually using events?
B
77
S
13
G
8
Posts: 1,974
Reputation: 9,893

Post » Tue Dec 09, 2014 4:54 am

So the answer is no then?
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Tue Dec 09, 2014 7:51 am

viewtopic.php?t=67327&start=0

yeahhhhh~ the sticky topic helps a lot. it has some awesome stuff in there.
B
26
S
7
G
1
Posts: 83
Reputation: 2,575

Post » Wed Dec 10, 2014 5:55 am

Thanks everyone. For anyone that may be having this issue I was able to come up with the following solution.

1. I made a 1x1 sprite and gave it the scrollto behavior, which I set to disabled, and the timer behavior. I also made the sprite invisible by default.
2. In the event sheet I set the sprites position to my games camera position (your normal scrollto coordinates). You can trigger every tick but I just trigger it as needed since the default scrollto behavior for the sprite is set to disabled anyways.
3. In the event sheet set up your trigger for when you want the shake to occur. For me it's if a specific animation is playing. On trigger, set the sprites scrollto behavior to enabled. Add the shake event to the same trigger. Add a timer to the same trigger and set the time to the same amount of time as you set for the shake duration.
4. In the event sheet add a timer trigger so when the timer is finished it sets the sprites scrollto behavior back to disabled.

This worked perfectly for me with a short shake duration (0.4 seconds). I'm not sure how well it would work for long durations but it works great for what I need.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 40 guests