
18.02.2004, 13:49
|
|
Регистрация: Dec 2002
Адрес: Сочи
Сообщений: 2,819
|
// Функция движения мува с поворотом за NKADR кол.во кадров
function dvmuva(name, frames, add_ugol, x, y) {
name.next_ugol += add_ugol;
name.next_xxx += x;
name.next_yyy += y;
name.needed_frames = frames;
name.speed = name.next_ugol/frames;
name.speedx = name.next_xxx/frames;
name.speedy = name.next_yyy/frames;
name.count = 0;
test += add_ugol;
testx += x;
testy += y;
name.onEnterFrame = function() {
this.count++;
this._rotation += this.speed;
this._x += this.speedx;
this._y += this.speedy;
this.next_ugol -= this.speed;
this.next_xxx -= this.speedx;
this.next_yyy -= this.speedy;
if (this.count == this.needed_frames) {
this.count = 0;
delete this.onEnterFrame;
}
};
}
На кнопке пишешь
on(press){
dvmuva(mc, 9, 90, 200,-50)//вставили значения аргументов
}//mc - инст.мувика, который, должен с поворотом 90гр.
//переместится по x на 200 пиксл., по y на -50 и произойдёт
//это за 9кадров.
|