«

»

Jan 28

Nodding Dog Script Swishmax 4

Demo:


click on the dogs head.

First Of All:
Open swishmax 4 and set your movies width and height.

Step.1
you will need a body_mc and a head_mc two seperate movieclips.
simply name the head movieclip head and add the following code to Scene_1

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
onFrame (1) {
bobbing_range = 30; 
nodding_range = 20; 
bobbing_hit = .5; 
nodding_hit = .1; 
bobbing_damp = .99;
nodding_damp = .985;
bobbing_angle = 0;
nodding_angle = 0;
bobbing_force = 0;
nodding_force = 0;
head_origin = head._y;
head.onEnterFrame = function(){
    if (bobbing_force){
        this._y = head_origin + Math.sin(bobbing_angle)*bobbing_force*bobbing_range/2;
        bobbing_angle += bobbing_hit*bobbing_force;
        bobbing_force *= bobbing_damp;
    } 
    if (nodding_force){
        this._rotation = Math.sin(nodding_angle)*nodding_force*nodding_range/2;
        nodding_angle += nodding_hit*nodding_force;
        nodding_force *= nodding_damp;
    }
}
head.onPress = function(){
    bobbing_angle = nodding_angle = 0;
    bobbing_force = nodding_force = 1;
}
}

thats it, press ctrl+t to test your movie.

http://www.swish-designs.co.uk/blog/wp-content/plugins/downloads-manager/img/icons/default.gif download: Nodding_dog (413.32KB)
added: 29/01/2011
clicks: 28
description: nodding dog script, swishmax 4

VN:F [1.9.22_1171]
Rating: 4.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
Nodding Dog Script Swishmax 4, 4.0 out of 5 based on 1 rating

Leave a Reply

6 visitors online now
3 guests, 3 bots, 0 members
Max visitors today: 14 at 02:43 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