Author Topic: shaking screen  (Read 3735 times)

billybob884

  • Contributor
  • Fanatic
  • **
  • Posts: 355
    • AOL Instant Messenger - billybob884
    • View Profile
shaking screen
« on: 2005-09-15, 08:56:55 AM »
hmmm, i was wondering, it seems that the further hte scrolling margins are off from the actual sprites size, the more hte screen seems to "vibrate" (when they're lower, that is), so i was wondering if it would be possible to use this to my advantage. maybe for one level where the screen should be shaking, i could just have some script that changes the scroll margines to, oh say, 2 pixils smaller than the dimensions of hte player sprite. that way (if im right aobut it only slightly shaking when its slightly off, i dont rmember), it would give hte effect of a vibrating screen. any thoughts about this?
"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." :: Hitchhiker's Guide to the Galaxy

durnurd

  • Lead Lemming
  • Expert
  • Fanatic
  • *****
  • Posts: 1234
  • Games completed so far: 0
    • MSN Messenger - durnurd@hotmail.com
    • View Profile
    • Find My Ed
shaking screen
« Reply #1 on: 2005-09-15, 06:14:57 PM »
Well, it wouldn't work very consistantly near the edges of the map, because when you are in the corner, it obviously doesn't keep scrolling and just show you black.  If you're going to write script, why not just write script to vibrate the screen manually (by either setting the view position or redrawing the map slightly offset in a random direction onAfterMoveSprites, being careful not to go below zero in either direction).  This would also allow you to more specifically control the vibration (rather than exploiting a "bug" in the program).

However, to make it work more consistently near the edges of the map if you do want to do it your way, you could dissallow the player to reach the actual boundaries of the map by creating a map larger than you need and make it look nice, but imposible to reach, on the outside, like this:
Code: [Select]

   @
   |  (nice design)
\/\/\/\/\/\/\/\/\/\/
/    ______   \
\    |play-   |   /
/    | able    |   \
\    | area   |   /
/    |______|   \
\                   /
\/\/\/\/\/\/\/\/\/\/
Edward Dassmesser

Dr Obvious

  • Regular
  • **
  • Posts: 53
    • View Profile
    • http://www.drobvious.net
shaking screen
« Reply #2 on: 2005-09-15, 06:51:02 PM »
A little off topic, but what is the line of code to set the view position or offset the map?  I only ask because in one part of one of my levels I need to force the screen to scroll up a few hundred pixels (which I can do by just jumping, but I would rather it happen automatically).

billybob884

  • Contributor
  • Fanatic
  • **
  • Posts: 355
    • AOL Instant Messenger - billybob884
    • View Profile
shaking screen
« Reply #3 on: 2005-09-15, 08:13:43 PM »
lol "it's not a bug, its a feature!"

but yea, if i ever do actually use this idea, ill probably have to use the scripting (ugh ;) ).
maybe in the mini-escape section after the "final boss level"... but thats still a ways pff
"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move." :: Hitchhiker's Guide to the Galaxy

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2761
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
shaking screen
« Reply #4 on: 2005-09-15, 08:36:22 PM »
Quote from: "Dr Obvious"
A little off topic, but what is the line of code to set the view position or offset the map?  I only ask because in one part of one of my levels I need to force the screen to scroll up a few hundred pixels (which I can do by just jumping, but I would rather it happen automatically).

ProjectObj.GamePlayer.MapScrollY = ProjectObj.GamePlayer.MapScrollY - 100

If this results in the player being outside the scrolling margins, however, the player will instantly scroll the map back down.

Dr Obvious

  • Regular
  • **
  • Posts: 53
    • View Profile
    • http://www.drobvious.net
shaking screen
« Reply #5 on: 2005-09-15, 09:34:05 PM »
Thanks, that will work great!