Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   Движение клипа с помощью стрелок клавиатуры (http://www.flasher.ru/forum/showthread.php?t=93294)

iNils 19.03.2007 07:55

Если бы вы пользовались поиском по форуму, то нашли бы эту ссылку раз 5.

terbooter 19.03.2007 11:56

Если автору интересно, вот
http://www.dionaholding.ru/news/articles/tbg_flash
неплохие туториалы по созданию tile based игр

J0x 20.07.2007 17:12

_rotation
 
Ребята, а вот вопрос:
как сделать, чтобы при нажатии на клавиши "вверх" или "вниз", нос косм.корабля немного отклонялся от горизонтального положения.
А при отпускании, он обратно возвращался в горизонтальное поолжение.
Мне не надо, чтобы он вокруг своей оси двигался.

Код:

starship._rotation=starship._rotation+3;
это естественно не подходит.

Нужно примерно задать интервал углов до куда может корабль поворачивать, только я не могу сообразить как.

Вот скрипт корабля:

Код:

_root.starshiphead.iID1 = setInterval(movieShip, 40, _root.starship, 10);
//функция 1: движение starship
function movieShip(starship, step) {
        if (Key.isDown(Key.RIGHT)) {
                starship._x = _root.starship._x+step;
        if (Key.isDown(Key.LEFT)) {
                starship._x = _root.starship._x-step;
        }

        if (Key.isDown(Key.DOWN)) {
                starship._y = _root.starship._y+step;
                //starship._rotation=starship._rotation+3;
        }
        if (Key.isDown(Key.UP)) {
                starship._y = _root.starship._y-step;
                //starship._rotation=starship._rotation-3
        }
}


J0x 20.07.2007 17:43

попробовал так, тоже не получается:

Код:

//функция 1: движение starship
function movieShip(starship, step) {
    if (Key.isDown(Key.DOWN)) {
          starship._y = _root.starship._y+step;
          starship._rotation=starship._rotation+stepRptation;
    }
    if (Key.isDown(Key.UP)) {
          starship._y = _root.starship._y-step;
          starship._rotation=starship._rotation-stepRptation;
    }
}

//интервал rotation
createRotataoinInt = setInterval(createRotataoin, 0);
stepRptation = 3;
minRotataoin = -300;
maxRotataoin = 60;
function createRotataoin(minRotataoin, maxRotataoin){
    if((starship._rotation=starship.minRotataoin)||(starship._rotation=starship.maxRotataoin)){
          stepRptation = 0;
    }
}



Часовой пояс GMT +4, время: 16:41.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.