-
[CS3] [AS2] How to make explosions rock the stage
Hi,
I was just wondering in this shooter game on how to make explosions rock the stage like in http://www.newgrounds.com/portal/view/480338 ,when a spaceship runs into you in AS2.
-
Senior Member
Assuming that you've already got a scrolling system set up, all you have to do is set it to "scroll" the screen slightly in each direction very quickly.
~Ork.
-
Well, my game doesn't scroll. Is there a way to do it then?
-
Senior Member
You could loop through all the objects on the stage and move them each in every direction by a little bit. Not entirely sure how your game is set up so I can't offer any useful code unfortunately but inside the loop it would be like so:
Code:
var rockAmount:Number = 5;
object._x += rockAmount;
object._y -= rockAmount;
object._x -= rockAmount;
object._y += rockAmount;
~Ork.
-
Thanks I'll try it.
If there a way I can do
Code:
_root._x+=5;
_root._x-=5;
?
-
Intermediate Game Dev
^As far as I know, that won't work. Rather, put everything in teh game in a container movi clip, and then use something like
PHP Code:
contanier._x += 5;
to move everything.
Needs an update...
-
Senior Member
You can use _root._x and _root.y but it's not a very good idea. Moving _root will move any interfaces as well as the game objects. A much better idea is what pseudobot said with the container movie clip. Though that might take a little while to set up, it's a lot better cause that way you can include some objects and not include others.
For scrolling games (and also for effects like this), I've found it's a good idea to use a "camera" object that displaces everything. ( a Point would work too but you need to import that class )
Something along these lines:
Code:
var camera:Object = new Object();
camera.x = 0;
camera.y = 0;
player._x = player.myX+camera.x;
player._y = player.myY+camera.y;
Thats probably a bit too unnecessarily complicated for just this, but it's something to keep in mind for later games.
~Ork.
-
-
I just have my entire game area in a MC... that MC will be rockin' when a building is destroyed... simple.
-
Hype over content...
Another way around it is to use bitmapData.draw();
You use draw to copy the entire screen to a bitmap, attach that to a mc and give the mc a low alpha ( Say around 50 ), a blur if you're feeling cheeky, and then just shake that. You then get a good double vision effect and it'll run nice and quickly 'cause you're just moving one movieclip with just one bitmap inside it.
Squize.
-
Senior Member
Originally Posted by Squize
Another way around it is to use bitmapData.draw();
You use draw to copy the entire screen to a bitmap, attach that to a mc and give the mc a low alpha ( Say around 50 ), a blur if you're feeling cheeky, and then just shake that. You then get a good double vision effect and it'll run nice and quickly 'cause you're just moving one movieclip with just one bitmap inside it.
Squize.
Very nice idea, thanks for the tip!
-
Senior Member
Here's a shake effect fla I accidentally created:
http://www.freeactionscript.com/2009...-shake-effect/
Accidentally because I was trying to make something else
-
I just move the main movie clips on the stage, it works quite well. Thanks guys for the tips. You guys are great.
-
FK founder & general loiterer
-
All you have to do is loop through something like this for a specified period of time:
_x += -5+random(10);
_y += -5+random(10);
It will be different each time and it'll shake whatever you want it to shake.
Not exactly rocket science.
Last edited by MikeMD; 02-14-2009 at 04:41 AM.
-
I was thinking about doing this and thought it would only look affective if container mc were eased through the positions.
So you don't necessarily need to ease the positions and will still look ok which I shall make note of.
May 2009 - Working on Thorenzitha RPG - episode 7
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
|