![]() |
|
||||||||||
|
|||||||
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | Опции просмотра |
|
![]() |
![]() |
|
|||||
|
Если автору интересно, вот
http://www.dionaholding.ru/news/articles/tbg_flash неплохие туториалы по созданию tile based игр |
|
|||||
|
Ребята, а вот вопрос:
как сделать, чтобы при нажатии на клавиши "вверх" или "вниз", нос косм.корабля немного отклонялся от горизонтального положения. А при отпускании, он обратно возвращался в горизонтальное поолжение. Мне не надо, чтобы он вокруг своей оси двигался. это естественно не подходит. Нужно примерно задать интервал углов до куда может корабль поворачивать, только я не могу сообразить как. Вот скрипт корабля: _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
}
}
|
|
|||||
|
попробовал так, тоже не получается:
//функция 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, время: 19:14. |
|
|
« Предыдущая тема | Следующая тема » |
| Опции темы | |
| Опции просмотра | |
|
|