Scrolling Game Development Kit Forum

SGDK Version 1 => General Discussion => Topic started by: billybob884 on 2005-09-15, 08:56:55 AM

Title: shaking screen
Post by: billybob884 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?
Title: shaking screen
Post by: durnurd 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   |   /
/    |______|   \
\                   /
\/\/\/\/\/\/\/\/\/\/
Title: shaking screen
Post by: Dr Obvious 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).
Title: shaking screen
Post by: billybob884 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
Title: shaking screen
Post by: bluemonkmn 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.
Title: shaking screen
Post by: Dr Obvious on 2005-09-15, 09:34:05 PM
Thanks, that will work great!