«

»

Apr 02

Scripted Grass For Banners / Games etc. Swishmax 4

Example:

Here is a simple way of generating random grass for banners etc using swishmax 4.

First Of All.
Open swishmax 4 and set you movie properties to the following, width = 553 height = 156 and frame rate to 25, background colour = whatever you want.

download the following grass *.emf vector
and import into swishmax 4 using the import Vector.

http://www.swish-designs.co.uk/blog/wp-content/plugins/downloads-manager/img/icons/default.gif download: Grass vector (1.40KB)
added: 02/04/2011
clicks: 82
description: Grass clump vector for swishmax 4 *.emf format.

Step.1

Once you have imported the grass vector into swishmax 4, group it as a movieclip and name it grass_2, add the following script to the movieclip, make sure the transofrm point is bottom center

1
2
3
4
onFrame (1) {
this._yscale=randomRange(60,140);
this._y=Stage.height;
}

On Scene_1 add the following code.

1
2
3
4
5
6
7
onFrame (1) {
    amount=Stage.width/30;
    for (blade=0; blade<amount; blade++) {
        duplicateMovieClip(_root.grass_2, "grass_2"+blade, blade);
        grass_2._x=30*blade;
    }
}

thats all their is to it. press Ctrl+t to test in player
export as swf 6 onwards.

VN:F [1.9.22_1171]
Rating: 5.0/5 (2 votes cast)
VN:F [1.9.22_1171]
Rating: +3 (from 3 votes)
Scripted Grass For Banners / Games etc. Swishmax 4, 5.0 out of 5 based on 2 ratings

Leave a Reply

7 visitors online now
4 guests, 3 bots, 0 members
Max visitors today: 19 at 03:18 pm UTC
This month: 27 at 05-17-2013 01:24 pm UTC
This year: 39 at 01-01-2013 12:46 pm UTC
All time: 109 at 12-07-2012 11:00 pm UTC