Jump to content


Photo
- - - - -

Screen Shake Example


  • Please log in to reply
22 replies to this topic

#1 wa1do_13

wa1do_13

    GMC Member

  • GMC Member
  • 591 posts
  • Version:GM:Studio

Posted 10 April 2009 - 10:06 PM

  • Title: Screen Shake Example
  • Description: An easy way to create a screen shaking effect.
  • GM Version: GM 7
  • Registered: No
  • File Type: .gmk
  • File Size: 0.04 MB
  • File Link:
    Host-A
    Mediafire
Additional Info:
This example shows you an easy way to create a screen shake. It also uses my Effiecient Menu System example to make the interface a little bit more appealing, although that is only in the "titlescreen" object, the screen shaking is contained in the other 3 objects.

Posted Image

Edited by wa1do_13, 06 June 2009 - 12:45 AM.

  • 0

#2 daman123125

daman123125

    AZN Game Programmer

  • GMC Member
  • 1955 posts
  • Version:GM8

Posted 11 April 2009 - 07:11 AM

Ah, it's on Host-A. It's weird that every time I try to download something from Host-A or WHFF, I just get a blank html page.

Do you mind making a mirror?
  • 0

#3 wa1do_13

wa1do_13

    GMC Member

  • GMC Member
  • 591 posts
  • Version:GM:Studio

Posted 11 April 2009 - 07:29 AM

Ah, it's on Host-A. It's weird that every time I try to download something from Host-A or WHFF, I just get a blank html page.

Do you mind making a mirror?


Okay, I've just put up a Mediafire link, although sometimes it doesn't really work for me. Hopefully it will this time.
  • 0

#4 daman123125

daman123125

    AZN Game Programmer

  • GMC Member
  • 1955 posts
  • Version:GM8

Posted 11 April 2009 - 10:37 PM

Pretty nice, but the shaking is just a bit choppy. Also, the color depth option in the options menu needs pro. I don't think the color depth is really needed.
  • 0

#5 sonosublime

sonosublime

    GMC Member

  • GMC Member
  • 247 posts
  • Version:GM8

Posted 05 June 2009 - 06:00 AM

It works really nicely. However, I am having trouble implementing into my 2D platform game. I already have the view following the player object. How can I make the view follow the camera object, while still keeping track of the player?

Also, will parallax scrolling backgrounds mess everything up?
  • 0

#6 scottlpool2003

scottlpool2003

    GMC Member

  • New Member
  • 2 posts

Posted 05 June 2009 - 09:52 AM

I agree with daman123125 the color depth is a bit off. It's a good module though think I'll use it. Thanks for the mirror link by the way, I had the same problem as daman123125.
  • 0

#7 wa1do_13

wa1do_13

    GMC Member

  • GMC Member
  • 591 posts
  • Version:GM:Studio

Posted 05 June 2009 - 10:51 PM

Sonosublime, just have the camera set itself to the x and y of the player, then follow the camera. The shaking will effect the camera while it's following the player. And yeah, the color depth is completely unnecessary, just a menu tidbit that I didn't know made it registered. I'll update this example momentarily with the screen shaking done from a script, the menu being better, the character movable, and the file being unregistered-compatible.
  • 0

#8 sonosublime

sonosublime

    GMC Member

  • GMC Member
  • 247 posts
  • Version:GM8

Posted 06 June 2009 - 02:29 AM

Sonosublime, just have the camera set itself to the x and y of the player, then follow the camera. The shaking will effect the camera while it's following the player. And yeah, the color depth is completely unnecessary, just a menu tidbit that I didn't know made it registered. I'll update this example momentarily with the screen shaking done from a script, the menu being better, the character movable, and the file being unregistered-compatible.


:D thank you so much, I got it working perfectly!
Would you like credit?
  • 0

#9 wa1do_13

wa1do_13

    GMC Member

  • GMC Member
  • 591 posts
  • Version:GM:Studio

Posted 06 June 2009 - 05:12 AM

As with most people, it's appreciated, but you don't have to. Glad to help :D
  • 0

#10 hithere

hithere

    GMC Member

  • New Member
  • 86 posts

Posted 24 July 2009 - 08:47 PM

wow.. i'm surprised at how easy it is to implement this in a game. =)
the screen shake code I've been trying was too complicated.. this is much better.. lol
  • 0

#11 BxdLunch

BxdLunch

    Demon Executive

  • New Member
  • 85 posts

Posted 24 July 2009 - 09:18 PM

Wow I've been looking for something like this, thanks!
  • 0

#12 hithere

hithere

    GMC Member

  • New Member
  • 86 posts

Posted 25 July 2009 - 07:34 AM

one problem i see tho..

if the main object (the one the camera follows) is at one of the 4 corners of the screen, there is no screen shake. I guess changing view_xview/view_yview may still be the best way to deal with screen shakes... dunno.
  • 0

#13 wa1do_13

wa1do_13

    GMC Member

  • GMC Member
  • 591 posts
  • Version:GM:Studio

Posted 25 July 2009 - 08:02 PM

Not sure what you expect, there's no more room to shake. This still shakes, but not in the directions of the corner (i.e. if you're at the top right, it only goes down and left). Or you could have your own camera objects stop following the player 10 pixels to the edge of a room. There's a lot of solutions, not really my problem, though.
  • 0

#14 wydo

wydo

    GMC Member

  • GMC Member
  • 50 posts

Posted 08 June 2010 - 02:03 AM

Great, thanks.
  • 0

#15 poetkathi

poetkathi

    Retired Staff

  • Retired Staff
  • 785 posts

Posted 17 June 2010 - 05:16 PM

Since it can't shake when the object being followed is near the edges, how about creating non visible walls along the edges of the room that stop the object being followed from going any further thus limiting the area in which the shake can be triggered? This is what I plan to try when I use it in one of my games. This is just what I wanted to do. Your example saves me months of trying a hundred different things to make it seem like the ground is shaking. It will be great in games where there's an explosion.

poetkathi
  • 0

#16 wa1do_13

wa1do_13

    GMC Member

  • GMC Member
  • 591 posts
  • Version:GM:Studio

Posted 17 June 2010 - 06:27 PM

Thanks, although I would recommend setting the object to not go past 10, room_width - 10, 10, and room_height - 10, so that you don't need to go through the process of setting tons of invisible objects around a room.
  • 0

#17 poetkathi

poetkathi

    Retired Staff

  • Retired Staff
  • 785 posts

Posted 18 June 2010 - 12:56 AM

Didn't think of that! :blink: Definitely easier than what I was going to do with in my games.

Thanks,
poetkathi
  • 0

#18 pqp239

pqp239

    GMC Member

  • GMC Member
  • 105 posts
  • Version:GM:HTML5

Posted 27 June 2010 - 11:50 AM

nice example :D . but it would be simpler if you did it with views.
  • 0

#19 Gonar

Gonar

    GMC Member

  • New Member
  • 161 posts

Posted 27 June 2010 - 08:06 PM

pqp239 try this might is what you look for
http://gmc.yoyogames...0
  • 0

#20 wa1do_13

wa1do_13

    GMC Member

  • GMC Member
  • 591 posts
  • Version:GM:Studio

Posted 27 June 2010 - 08:39 PM

@pqp239
It depends on what you consider easier. For me, having a separate object helps a lot because it's easy to access and I keep them really organized, so if I ever want to do anything with the camera, like change the area to focus on or follow a different object, there's an invisible object there that can simply change position. With views, coding gets a lot messier, so it pretty much depends on whether or not you enjoy having one more object or messier code. I personally prefer one more object.

@Gonar
Yeah... please try to not advertise your own topics on mine. It's not such a big deal this time, but it just kind of bugs me. As a user, whenever I'm browsing a game or something and I see "yo, check out my game", I always think it's just cluttering up the comments, so I'd greatly appreciate it if my own topics (and games) don't have such things in it.
  • 0




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users