00:00
00:00
Newgrounds Background Image Theme

PalmVoe just joined the crew!

We need you on the team, too.

Support Newgrounds and get tons of perks for just $2.99!

Create a Free Account and then..

Become a Supporter!

Foss: Shake Screen.

4,035 Views | 43 Replies
New Topic Respond to this Topic

Response to Foss: Shake Screen. 2005-11-11 13:55:09


_global.shakeScreen = function(period:Number, strength:Number) {
_root.t = 0;
startX = _root._x;
startY = _root._y;
_root.onEnterFrame = function() {
_root._x = random(strength) - (strength / 2) + startX;
_root._y = random(strength) - (strength / 2) + startY;
_root.t++;
if (_root.t > period) {
_root._x = startX;
_root._y = startY;
_root.onEnterFrame = undefined;
}
};
};
just thought i'd share my version

Response to Foss: Shake Screen. 2005-11-11 14:36:55


Yeh, that's a good one.
Can you make it 3 lines long? ;)


BBS Signature

Response to Foss: Shake Screen. 2005-11-11 15:31:23


_global.shakeScreen = function(period:Number, strength:Number) {
(_root.t = 0, startX = _root._x, startY = _root._y);
_root.onEnterFrame = function() {
(_root._x = random(strength) - (strength / 2) + startX, _root._y = random(strength) - (strength / 2) + startY, _root.t++, _root.t > period ? (_root._x = startX, _root._y = startY, _root.onEnterFrame = undefined) : null);
};
};
shakeScreen(10, 10);

Response to Foss: Shake Screen. 2005-11-11 15:34:14


thats uber helpful -Toast- ta very much :)


Gamertag: Medieval Turkey.

I also make signatures - PM what you want, and I'll make it.

BBS Signature

Response to Foss: Shake Screen. 2005-11-11 15:34:39


oh you meant the entire code, well no i cant. but this doesnt have to be called along with an interval.
its just
shakeScreen(time,power)
for more convienience

Response to Foss: Shake Screen. 2005-11-11 15:35:25


At 11/11/05 03:34 PM, ImpotentBoy2 wrote: oh you meant the entire code, well no i cant. but this doesnt have to be called along with an interval.
its just
shakeScreen(time,power)
for more convienience

Yes, but if you have any other onEnterFrame functions on the _root then they won't work =\


Sup, bitches :)

BBS Signature

Response to Foss: Shake Screen. 2005-11-11 15:35:54


At 11/11/05 03:34 PM, lucozadedude wrote: thats uber helpful -Toast- ta very much :)

fuck, i mean impotentboy, lol i saw -Toast-'s post and instantly thought 'oooooh, toast :)' and now my dog has fallen asleep over my arm... must.... type.... i bookmarked this so thanks :)

impotentboy...... not toast.....

let me post...... before my dog kills my arm.....


Gamertag: Medieval Turkey.

I also make signatures - PM what you want, and I'll make it.

BBS Signature

Response to Foss: Shake Screen. 2005-11-11 15:39:20


At 11/11/05 03:35 PM, -liam- wrote:
At 11/11/05 03:34 PM, ImpotentBoy2 wrote: oh you meant the entire code, well no i cant. but this doesnt have to be called along with an interval.
its just
shakeScreen(time,power)
for more convienience
Yes, but if you have any other onEnterFrame functions on the _root then they won't work =\

_global.shakeScreen = function(period:Number, strength:Number) {
(_root.t = 0, startX = _root._x, startY = _root._y, _root.createEmptyMovieClip("screenShaker", _root.getNextHighestDepth()));
_root.screenShaker.onEnterFrame = function() {
(_root._x = random(strength) - (strength / 2) + startX, _root._y = random(strength) - (strength / 2) + startY, _root.t++, _root.t > period ? (_root._x = startX, _root._y = startY, _root.onEnterFrame = undefined) : null);
};
};
shakeScreen(10, 10);

BAM!

At 11/11/05 03:35 PM, lucozadedude wrote:
fuck, i mean impotentboy, lol i saw -Toast-'s post and instantly thought 'oooooh, toast :)' and now my dog has fallen asleep over my arm... must.... type.... i bookmarked this so thanks :)

BAM BAM!!

Response to Foss: Shake Screen. 2005-11-11 15:41:02


oops......

_global.shakeScreen = function(period:Number, strength:Number) {
(_root.t = 0, startX = _root._x, startY = _root._y, _root.createEmptyMovieClip("screenShaker", _root.getNextHighestDepth()));
_root.screenShaker.onEnterFrame = function() {
(_root._x = random(strength) - (strength / 2) + startX, _root._y = random(strength) - (strength / 2) + startY, _root.t++, _root.t > period ? (_root._x = startX, _root._y = startY, _root.screenShaker.onEnterFrame = undefined) : null);
};
};
shakeScreen(10, 10);

and uh... bam...

Response to Foss: Shake Screen. 2005-11-11 15:42:12


huh, oh fuck, this was made by toast, just ignore me now, i'm tired and my dog is sleeping on my arm making it super hard to type.

thanks to both of you, and let us pray i don't end up posting again to say "wait, i fucked up again" XD


Gamertag: Medieval Turkey.

I also make signatures - PM what you want, and I'll make it.

BBS Signature

Response to Foss: Shake Screen. 2005-11-11 16:21:11


_root.onEnterFrame=function(){_x+=random(3
)-1;_y+=random(3)-1;}

OMG ONE LINE


BBS Signature

Response to Foss: Shake Screen. 2005-11-11 16:24:34


Lol. I was wondering why no one was just thinking of making the screen's x and y random...everyone is making functions and crap >=( that's too confusing to noobs.


the events are merely fictional, written, directed, and acted out by all who create them

BBS Signature

Response to Foss: Shake Screen. 2005-11-11 16:26:07


At 11/11/05 04:21 PM, Afro_Ninja wrote: _root.onEnterFrame=function(){_x+=random(3
)-1;_y+=random(3)-1;}

OMG ONE LINE

Three (formatting lol), but still.. it's not as easy to use than:

shakeScreen(10);

or whatever =P


Sup, bitches :)

BBS Signature

Response to Foss: Shake Screen. 2005-11-11 16:51:31


At 11/11/05 04:26 PM, -liam- wrote:
At 11/11/05 04:21 PM, Afro_Ninja wrote: _root.onEnterFrame=function(){_x+=random(3
)-1;_y+=random(3)-1;}

OMG ONE LINE
Three (formatting lol), but still.. it's not as easy to use than:

shakeScreen(10);

or whatever =P

damn straight!