Create nice background effects with Flash Random Movement
Filed Under Actionscript 2, Flash, Users contributions • 4 Comments
This is a Flash effect you can use for a background effect or for a shoot’em up wave (hint! hint!)
I received this script from Ashker (the creator of Olympclicks)
« Hello Emanuele. Today I tried to make an object move in a circular motion in Flash, and i succeeded. I also discovered that i could make other random motions by changing a few variables.
Thought of some ideas it could be used for : background animations, creating new level designs, creatin paths for Enemies. »
That’s right!
With this simple script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | attachMovie("ball", "ball", 1)
ball._x = 250
ball._y = 200
timey = 0
fps = 3
xvel = 0
yvel = 3
xcha = .1
ycha = .1
i = 0
onEnterFrame = function(){
timey ++
if(timey == fps){
dave = _root.attachMovie("blob","blob" + i, _root.getNextHighestDepth())
dave._x = ball._x
dave._y = ball._y
timey = 0
i++
}
}
ball.onEnterFrame = function(){
this._x -= xvel
this._y -= yvel
xvel += xcha
yvel -= ycha
if(xvel >= 3 || xvel <= -3){
xcha = -xcha
}
if(yvel >= 3 || yvel <= -3){
ycha = -ycha
}
if(this._x > 500){
this._x = 0
}
if(this._x < 0){
this._x = 500
}
if(this._y > 400){
this._y = 0
}
if(this._y < 0){
this._y = 400
}
} |
playing with xvel, yvel, xcha and ycha you can achieve a wide range of effects.
Ashker invites you all to play with these variables and eventually publish here the most interesting results.
Here are some random effect you can make:
Download the source code and share interesting values, and I’ll show you how to use them in a shoot’em up.
They can be easily customized to meet the unique requirements of your project.
4 Responses to “Create nice background effects with Flash Random Movement”
Leave a Reply
- My epic fail with ClickBank
- Get up to $100,000 for your next Flash game with Mochi GAME Developer Fund
- Create a dynamic content animated footer ad for your site in just 9 jQuery lines – 17 lines version
- Sell sitelocked version of your Flash games and even .fla sources to Free Online Games
- Protect your work from ActionScript code theft with SWF Protector
- Create a dynamic content animated footer ad for your site in just 9 jQuery lines
- Understanding Box2D’s one-way platforms, aka CLOUDS
- Triqui MochiAds Arcade plugin for WordPress upgraded to 1.2
- Box2D Flash game creation tutorial – part 2
- 11 Flash isometric engines you can use in your games
- Create a Lightbox effect only with CSS - no javascript needed
- Flash game creation tutorial - part 1
- Create a Flash Racing Game Tutorial
- Flash game creation tutorial - part 2
- Make a Flash game like Flash Element Tower Defense - Part 2
- Flash game creation tutorial - part 3
- Make a Flash game like Flash Element Tower Defense - Part 1
- Create a flash draw game like Line Rider or others - part 1
- Triqui MochiAds Arcade plugin for WordPress official page
- Create a flash artillery game - step 1
- Flash game creation tutorial – part 5.2 (4.88/5)
- Create a flash artillery game – step 1 (4.79/5)
- Create a Flash Racing Game Tutorial (4.76/5)
- Create a flash artillery game – step 2 (4.74/5)
- Create a survival horror game in Flash tutorial – part 1 (4.73/5)
- Creation of a Flash arcade site using WordPress – step 2 (4.73/5)
- Flash game creation tutorial – part 2 (4.71/5)
- Flash game creation tutorial – part 1 (4.70/5)
- Create a flash draw game like Line Rider or others – part 1 (4.69/5)
- Creation of a platform game with Flash – step 2 (4.68/5)


(10 votes, average: 3.80 out of 5)



Nice to see it, but:
The longer you play it, the slower it goes…
Sorry, mistake ^^ It’s not slowing down…
I accidentily left this running for awhile and it slowed down completely and ended up freezing internet explorer when i tryed to close it.
It’s probably because the balls are created but not deleted.
nope Matt, it’s because you use IE. :)