-
XRave
slowmotion in flash
dose anyone know how to make a button that allows the movie to slow down, like in slowmotion?
-
Senior Member
- The right of the People to create Flash movies shall not be infringed. -
-
XRave
it don't work properly, i want to change the speed of the whole film... it's frame-by-frame. OH! I AM SOOO SOOOOO DOOOOMED!
-
Senior Member
You cannot change the framerate of the whole movie dynamically only by changing the framerate manually under Modify-document. If you want to give that impression of slow motion then make a copy of your movie with a slower framerate and a button loading this copy into your parent movie at level0. But the movie will start from the beginning:
myBut.onPress = function() {
loadMovieNum("child.swf", 0);
};
- The right of the People to create Flash movies shall not be infringed. -
-
XRave
That's good thinking, but all meanings of this movie is like a film, and you can slow it down in the press of a button, just like in MATRIX & slow time in HELIATTACK3. So how can I do that with the AS:
******************
OnPress.........??
???????????????????
}
******************
I mean wat should the second line do??? If you can get this i would thank you sooo sooo much!
-
Happy FK'er
Heli attack 3 is fun aint it? I've played that game 100 times too many...
Anyway, heli attack uses a combination of tricks to make it seem like slowmotion. When it comes to non animated objects moving, such as bullets, the speed in which they travel is simply slowed down, like so.
Code:
movespeed = 10
_root.timephase = 1
bullet._x += movespeed * _root.timephase
when 'timephase' is 1, which is normal, the bullet moves 10 pixels per frame.
but if it were set to 0.5, it would move half the speed.
In this aspect, im sure the programmer would have needed a 'timephase' variable inside every object concerning movement.
As for objects that animate, such as the player running, the programmer more than likely halved the speed in which the frames of each movieclip progressed. like so:
Code:
onClipEvent(load){
advanceframe = false
timephase = 1
}
onClipEvent(EnterFrame){
if(timephase == 1){
player.play();
//the player animates normally
}else if(timephase == .5){
advanceframe=!advanceframe
if(advanceframe == true){
gotoAndStop(_player.currentframe + 1)
}
}
}
basically that means, when timephase = 1 (which is normal speed), the animation plays normally. but when the timephase is half, it only moves one frame every 2 frames that the main timeline moves.
"Good lord, you're wasting thousands of dollars worth of Interferon!"
"... and you're Interferon with our good time!"
-
XRave
ahhhh! A very good solution...... wait until i try that one out!!!
-
XRave
ohhh no....
The code is not working properly when it comes to the whole animation.... i still don't get the phrase " timephase " cause I don't think flash reconised it.
-
XRave
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
Uses MX 2004 Pro
How about using setInterval().
Code:
onMouseDown = function () {
stop();
slowItup = setInterval(function () { nextFrame();}, 300);
};
onMouseUp = function () {
clearInterval(slowItup);
play();
};
-
XRave
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
XRave
Cool! That Sort Of Worked... But The Animation Went All Bad And Had A Great Gap In Between The Frames....
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
XRave
but why don't Heliattack stumble like that....
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
XRave
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
-
Uses MX 2004 Pro
Originally Posted by tongxn
The Animation Went All Bad And Had A Great Gap In Between The Frames....
Yes, it has something to do with the movie starting over. To fix this, you could put an if() statement on the end frame of the Movie that checks a variable to see if slow motion is in effect. If it is, set the movie to gotoAndStop() on the first frame of animation, otherwise the movie will play as it normally would. The gotoAndStop() action (if in slow motion) will still play the movie but in slow motion, because the setInterval() will tell it to jump to it's next frame like it should. (see "slowDown.fla" in the attachment)
This is the code that should be on the first frame of your movie:
Code:
onMouseDown = function () {
stop();
slow = true;
slowItup = setInterval(function () { nextFrame();}, 300);
};
onMouseUp = function () {
slow = false;
clearInterval(slowItup);
play();
};
And this is the code that should be on the last frame of your movie:
Code:
if (slow) {
gotoAndStop(1);
}
Originally Posted by tongxn
but why don't Heliattack stumble like that....
I never heard of "heliattack", but I assume it's a game. If that's the case, then it's probably just a matter of setting any enemy, projectile, and hero's speed variables (the amount of pixels they are allowed to move per frame) to a lower number during a specific event/time.
So you could do something like the following (where all the code is found on the first frame of the main timeline):
Code:
speed = 20;
moveIt = function () {
this._x += speed;
if (this._x>Stage.width) {
this._x = -this._width;
}
};
for (i=0; i<4; i++) {
level = _root.getNextHighestDepth();
b = attachMovie("ball", "ball"+i, level, {_x:random(Stage.width), _y:random(Stage.height)});
b.onEnterFrame = moveIt;
}
attachMovie("hero", "hero", _root.getNextHighestDepth(), {_x:random(Stage.width), _y:random(Stage.height)});
hero.onEnterFrame = moveIt;
//
onMouseDown = function () {
speed = 2;
};
onMouseUp = function () {
speed = 20;
};
...where when you hold down the mouse button, the "speed" variable (which all the "ball" and "hero" MC's use to move) is changed from 20 to 2. This allows the MC's to only move 2 pixels per frame call. When you release the mouse, the "speed" variable is set back to 20 and the MC's return to there normal movement. (see "gameSlow.fla" in attachment).
Then again, it could be that to much is happening on screen, so Flash can't keep up and the game takes a performance hit. In which case the game slows down in an atempt to keep up with everything (much like the old nes games).
-
XRave
When you actually know what "OMG I have so much homework!" means, you won't want to be me.
Xrave
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|