Discuss Scratch

Plaxopolis
Scratcher
6 posts

How can I make a screen shake?

I'm making a mega man-type game, and I want to add a screen shake for a certain part.
2ab_cos_theta
Scratcher
12 posts

How can I make a screen shake?

Try just giving everything a script like this:
when I receive [Shake]
change x by (4)
wait (0.03) secs
change y by (3)
wait (0.03) secs
change x by (-2)
wait (0.03) secs
change y by (-6)
wait (0.03) secs
change x by (-2)
wait (0.03) secs
change y by (3)

I'm not sure if this will work, but it might.

Last edited by 2ab_cos_theta (Dec. 16, 2021 20:36:15)


if <(username) = [2ab_cos_theta]> then
set [isGeeky] to [true]
end
Plaxopolis
Scratcher
6 posts

How can I make a screen shake?

I'm not sure if this counts as necroposting but,
It worked, so thanks a lot!
helloworldbyeworld
Scratcher
1000+ posts

How can I make a screen shake?

2ab_cos_theta wrote:

Try just giving everything a script like this:
when I receive [Shake]
change x by (4)
wait (0.03) secs
change y by (3)
wait (0.03) secs
change x by (-2)
wait (0.03) secs
change y by (-6)
wait (0.03) secs
change x by (-2)
wait (0.03) secs
change y by (3)

I'm not sure if this will work, but it might.
Here's a variant that's a bit cleaner:

when I receive [shake v]
repeat (10)
change x by (pick random (-5) to (5))
change y by (pick random (-5) to (5))
wait (0.033) secs
end

It also follows a random sequence instead of following the same sequence every time.

Helloworldbyeworld | 1200+ posts
Have a great day
Hero_man_555
Scratcher
72 posts

How can I make a screen shake?



Wouldn't that mean that the shaking would de sync though? Each object would shake in a different way. I think another possible method would be to have a variable that changes randomly a few times a second and have the shake use that value instead.

Last edited by Hero_man_555 (Dec. 17, 2021 05:38:15)


Gentlemen, THIS is a signature.

Powered by DjangoBB