Главная | Регистрация | Вход | RSSПонедельник, 23.09.2024, 20:22

НеПотеряйка

Меню сайта
Наш опрос
Что для Вас "МОДЕРНИЗАЦИЯ ОБРАЗОВАНИЯ"?
Всего ответов: 210
Статистика

Онлайн всего: 5
Гостей: 5
Пользователей: 0

Дневник

Главная » 2013 » Апрель » 29 » Урок с ХабраХабр
Урок с ХабраХабр
16:17

Создание сцен для Flash игр с помощью StencylWorks

Если вкратце, то StencylWorks – это конструктор для создания Flash и iOS игр. Более подробное описание можно найти здесь.
Попробуем узнать, — действительно ли так быстро в нём можно создавать простые вещи, как это заявляют создатели платформы.
В этой статье мы попытаемся создать актера, сцену, применить к ним действия и тайлсеты.


Для создания игры в StencylWorks первое что необходимо, – это актёр (actor). В проектируемой игре все элементы, обладающие какими-либо действиями и поведением, являются актёрами.

После первого нажатия на библиотеку актеров ("Actors” library), вы увидите предупреждении о том, что игра еще не содержит актёров. В процессе создания игры разработчику будет показано множество подобных предупреждений, которые, по сути, являются подсказками для дальнейших действий.


Присвоим актёру имя и нажмем Create (Создать).



Вы увидите предупреждение о том, что созданный актёр не имеет анимации. По щелчку на это предупреждение заполним и этот пробел.



Присваиваем новой анимации имя, — например Walk left (Движение влево) и жмём на создание нового кадра (create a new frame).



Далее есть возможность импортировать анимацию кадр за кадром или загрузить изображение раскадровки и задать, сколько его строк и колонок нужно импортировать. Здесь же можно задать некоторые другие параметры,- например transparent color (так называемый "цвет прозрачности”).



Так как изображение раскадровки автоматически объединяется во фреймы, фактически мы сразу же получаем готовую анимацию движений влево-вправо, вверх и бега. В левой панели есть возможность предосмотра итоговой анимации, в главной панели анимация просматривается покадрово.


Путем повторения описанных выше действий, в игре создается новая анимация. Звездочкой (в панели слева) помечается анимация по-умолчанию, то есть та, которая применяется к актеру поначалу, как только он появляется в игре. Также анимация может состоять лишь из одного кадра.


Потратив сравнительно немного времени, мы получили анимированного персонажа. Пора задать для него управление. В нашем случае это делается путем присваивания имен используемым для этого клавишам. Теперь всё готово для создания тайлсета (tileset).


Тайлсет — это фон, порезанный на части, которые затем добавляются в игру.
Тайлсет создается не сложнее анимации, в данном случае используется компонент "Colorful Blocks” из раздела Media.


Актер и тайлсет – основные элементы любой сцены. А вот так она создается:


После создания сцены, перетаскиваем на неё наши тайлсеты и актеров.


И, наконец, требуется задать определенный набор поведений (behaviors), которые будут определять действия, например то, как актер движется.
Чтобы задать поведение, используется режим разработчика (design mode). Определим, как будет происходить движения актера вправо и влево.


Внизу на рисунке показан экран поведений (behavior screen), слева на нём – визуальное отображение кода, справа – набор элементов для создания различных комбинаций поведений актера.


Это конечная модель поведений нашего актера:


Давайте прокомментируем то, что мы сделали.
Блок always – тоже самое, что и Event.ENTER_FRAME листенер. Далее, если нажата стрелка "Вправо” то двигать нашего актера вправо с показом соответствующей анимации, остальные блоки визуального кода попробуйте расшифровать самостоятельно, думается, с этим особых проблем не будет.
Перевод визуального кода в листинг на ActionScript:
package scripts
{
 import flash.display.BlendMode;
 import flash.events.*;
 import flash.net.*;
 import flash.filters.*;
 
 import Box2DAS.Collision.*;
 import Box2DAS.Collision.Shapes.*;
 import Box2DAS.Common.*;
 import Box2DAS.Dynamics.*;
 import Box2DAS.Dynamics.Contacts.*;
 import Box2DAS.Dynamics.Joints.*;
 
 import stencyl.api.data.*;
 import stencyl.api.engine.*;
 import stencyl.api.engine.actor.*;
 import stencyl.api.engine.behavior.*;
 import stencyl.api.engine.bg.*;
 import stencyl.api.engine.font.*;
 import stencyl.api.engine.scene.*;
 import stencyl.api.engine.sound.*;
 import stencyl.api.engine.tile.*;
 import stencyl.api.engine.utils.*;
 
 import org.flixel.*;
 import mochi.as3.*;
 import flash.ui.Mouse;
 
 
 
 public dynamic class Design_13_13_Walkleftandright extends ActorScript
 { 
 override public function init():void
 {}
 override public function update():void
 {
 
 if (isKeyDown("right"))
 {
 actor.setXVelocity(7);
 actor.setAnimation("Walk right".toString());
 }
 
 else
 if (isKeyDown("left"))
 {
 actor.setXVelocity(-7);
 actor.setAnimation("Walk left".toString());
 }
 
 else
 {
 if (sameAs(actor.getXVelocity(), 7))
 {
 actor.setXVelocity(0);
 actor.setAnimation("Stand right".toString());
 }
 
 else
 if (sameAs(actor.getXVelocity(), -7))
 {
 actor.setXVelocity(0);
 actor.setAnimation("Stand left".toString());
 }
 }
 }
 override public function handleCollision(event:Collision):void
 {
 }
 override public function draw(g:Graphics, x:Number, y:Number):void
 {
 }
 
 public function Design_13_13_Walkleftandright(actor:Actor, scene:GameState)
 {
 super(actor, scene);
 nameMap["Actor"] = "actor";
 
 }
 
 override public function forwardMessage(msg:String):void
 {
 
 }
 }
}



Теперь применим описанное поведение к нашему актеру.


А что же насчет коллизий (столкновений, взаимодействий нашего актера с другими объектами сцены)? Всё это предусмотрено и изначально управляется настройками по-умолчанию.
А вот результат.

Текст подготовлен на основе вольного перевода статьи англоязычного блога итальянского разработчика игр.
Просмотров: 46568 | Добавил: i_elf | Рейтинг: 0.0/0 |
Всего комментариев: 7901 2 3 ... 78 79 »
790 SammyPam  
0
Boeing and NASA decide to move forward with historic crewed launch of new spacecraft
<a href=https://omgomg2shop.com>омг вход</a>
After years of delays and a dizzying array of setbacks during test flights, Boeing’s Starliner spacecraft is finally set to make its inaugural crewed launch.

The mission is on track to take off from Florida as soon as May 6, carrying NASA astronauts Suni Williams and Butch Wilmore to the International Space Station, marking what could be a historic and long-awaited victory for the beleaguered Starliner program.
https://omgomg2shop.com
omg сайт
“Design and development is hard — particularly with a human space vehicle,” said Mark Nappi, vice president and Starliner program manager at Boeing, during a Thursday news briefing. “There’s a number of things that were surprises along the way that we had to overcome. … It certainly made the team very, very strong. I’m very proud of how they’ve overcome every single issue that we’ve encountered and gotten us to this point.”

Boeing and NASA officials made the decision Thursday to move forward with the launch attempt in less than two weeks. However, Ken Bowersox, associate administrator for NASA’s Space Operations Mission Directorate, noted that May 6 is “not a magical date.”
“We’ll launch when we’re ready,” he said.

If successful, the Starliner will join SpaceX’s Crew Dragon spacecraft in making routine trips to the space station, keeping the orbiting outpost fully staffed with astronauts from NASA and its partner space agencies.

Such a scenario — with both Crew Dragon and Starliner flying regularly — is one for which the US space agency has long waited.

“This is history in the making,” NASA Administrator Bill Nelson said of the upcoming Starliner mission during a March 22 news conference. “We’re now in the golden era of space exploration.”

789 Jameskig  
0
New mission could shed light on the secrets of the moon’s ‘hidden side
<a href=https://cryptobosscasino03.com>cryptoboss</a>
Over the past few years, competing countries have turned the moon into a hotspot for activity not witnessed since the Apollo 17 astronauts departed from the lunar surface in 1972.

In one lunar region, Japan’s “Moon Sniper” mission has beaten the odds and survived three long, frigid lunar nights since its sideways landing on January 19.
https://cryptobosscasino03.com
cryptoboss casino бездепозитный бонус
Engineers at the Japan Aerospace Exploration Agency didn’t design the spacecraft to last through one lunar night, a two-week period of freezing darkness, but the Moon Sniper continues to thrive amid lunar extremes and send back new images of its landing site.

Elsewhere, an international team of astronomers believes it has homed in on a crater created a few million years ago when something massive slammed into the lunar surface — and sent a chunk of the moon’s far side, or the side that faces away from Earth, hurtling into space. The hunk of moon became a rare quasi-satellite, or asteroid that orbits near Earth.

The Tianwen-2 mission will visit the space rock later this decade. But first, China has set its sights on returning to the moon’s “hidden side.”
The Chang’e-6 mission, which launched Friday, is aiming to bring back the first samples from the South Pole-Aitken basin, or the largest and oldest crater on the moon. Since the Chang’e 4 mission in 2019, China remains the only country to have landed on the moon’s far side, sometimes called the “dark side” of the moon.

The “dark side” of the moon is actually a misnomer, experts say, and the remote lunar hemisphere receives illumination — scientists just don’t know as much about the region as they’d like.

The far side, with its thicker crust, is vastly different from the near side that was explored during the Apollo missions.

Scientists hope that returning samples from the far side could solve some of the biggest remaining lunar mysteries, including the moon’s true origin.

788 DanielDix  
0
New mission could shed light on the secrets of the moon’s ‘hidden side
<a href=https://cryptobosscasino03.com>crypto casino</a>
Over the past few years, competing countries have turned the moon into a hotspot for activity not witnessed since the Apollo 17 astronauts departed from the lunar surface in 1972.

In one lunar region, Japan’s “Moon Sniper” mission has beaten the odds and survived three long, frigid lunar nights since its sideways landing on January 19.
https://cryptobosscasino03.com
cryptoboss рабочее зеркало
Engineers at the Japan Aerospace Exploration Agency didn’t design the spacecraft to last through one lunar night, a two-week period of freezing darkness, but the Moon Sniper continues to thrive amid lunar extremes and send back new images of its landing site.

Elsewhere, an international team of astronomers believes it has homed in on a crater created a few million years ago when something massive slammed into the lunar surface — and sent a chunk of the moon’s far side, or the side that faces away from Earth, hurtling into space. The hunk of moon became a rare quasi-satellite, or asteroid that orbits near Earth.

The Tianwen-2 mission will visit the space rock later this decade. But first, China has set its sights on returning to the moon’s “hidden side.”
The Chang’e-6 mission, which launched Friday, is aiming to bring back the first samples from the South Pole-Aitken basin, or the largest and oldest crater on the moon. Since the Chang’e 4 mission in 2019, China remains the only country to have landed on the moon’s far side, sometimes called the “dark side” of the moon.

The “dark side” of the moon is actually a misnomer, experts say, and the remote lunar hemisphere receives illumination — scientists just don’t know as much about the region as they’d like.

The far side, with its thicker crust, is vastly different from the near side that was explored during the Apollo missions.

Scientists hope that returning samples from the far side could solve some of the biggest remaining lunar mysteries, including the moon’s true origin.

787 Stephenmam  
0
New mission could shed light on the secrets of the moon’s ‘hidden side
<a href=https://cryptobosscasino03.com>cryptoboss casino официальный</a>
Over the past few years, competing countries have turned the moon into a hotspot for activity not witnessed since the Apollo 17 astronauts departed from the lunar surface in 1972.

In one lunar region, Japan’s “Moon Sniper” mission has beaten the odds and survived three long, frigid lunar nights since its sideways landing on January 19.
https://cryptobosscasino03.com
online casino cryptoboss
Engineers at the Japan Aerospace Exploration Agency didn’t design the spacecraft to last through one lunar night, a two-week period of freezing darkness, but the Moon Sniper continues to thrive amid lunar extremes and send back new images of its landing site.

Elsewhere, an international team of astronomers believes it has homed in on a crater created a few million years ago when something massive slammed into the lunar surface — and sent a chunk of the moon’s far side, or the side that faces away from Earth, hurtling into space. The hunk of moon became a rare quasi-satellite, or asteroid that orbits near Earth.

The Tianwen-2 mission will visit the space rock later this decade. But first, China has set its sights on returning to the moon’s “hidden side.”
The Chang’e-6 mission, which launched Friday, is aiming to bring back the first samples from the South Pole-Aitken basin, or the largest and oldest crater on the moon. Since the Chang’e 4 mission in 2019, China remains the only country to have landed on the moon’s far side, sometimes called the “dark side” of the moon.

The “dark side” of the moon is actually a misnomer, experts say, and the remote lunar hemisphere receives illumination — scientists just don’t know as much about the region as they’d like.

The far side, with its thicker crust, is vastly different from the near side that was explored during the Apollo missions.

Scientists hope that returning samples from the far side could solve some of the biggest remaining lunar mysteries, including the moon’s true origin.

786 Лендинги для строителей  
0
Лендинг для строителей за 29990р с конверсией 12% в заявку - за 5 дней и почти без вашего участия.

Подробности или заказать
ТГ - https://t.me/i_lomak
WhatsApp - https://wa.me/79587617884

За 8 лет 415 довольных клиентов.

Пример 1 - http://lidgen-legend.tilda.ws/stroitelstvo-domov
Пример 2 - https://lidgen-legend.tilda.ws/stroitelstvo

785 Waltermug  
0
New mission could shed light on the secrets of the moon’s ‘hidden side
<a href=https://cryptobosscasino03.com>криптобосс казино</a>
Over the past few years, competing countries have turned the moon into a hotspot for activity not witnessed since the Apollo 17 astronauts departed from the lunar surface in 1972.

In one lunar region, Japan’s “Moon Sniper” mission has beaten the odds and survived three long, frigid lunar nights since its sideways landing on January 19.
https://cryptobosscasino03.com
cryptoboss casino
Engineers at the Japan Aerospace Exploration Agency didn’t design the spacecraft to last through one lunar night, a two-week period of freezing darkness, but the Moon Sniper continues to thrive amid lunar extremes and send back new images of its landing site.

Elsewhere, an international team of astronomers believes it has homed in on a crater created a few million years ago when something massive slammed into the lunar surface — and sent a chunk of the moon’s far side, or the side that faces away from Earth, hurtling into space. The hunk of moon became a rare quasi-satellite, or asteroid that orbits near Earth.

The Tianwen-2 mission will visit the space rock later this decade. But first, China has set its sights on returning to the moon’s “hidden side.”
The Chang’e-6 mission, which launched Friday, is aiming to bring back the first samples from the South Pole-Aitken basin, or the largest and oldest crater on the moon. Since the Chang’e 4 mission in 2019, China remains the only country to have landed on the moon’s far side, sometimes called the “dark side” of the moon.

The “dark side” of the moon is actually a misnomer, experts say, and the remote lunar hemisphere receives illumination — scientists just don’t know as much about the region as they’d like.

The far side, with its thicker crust, is vastly different from the near side that was explored during the Apollo missions.

Scientists hope that returning samples from the far side could solve some of the biggest remaining lunar mysteries, including the moon’s true origin.

784 JerryMam  
0
New mission could shed light on the secrets of the moon’s ‘hidden side
<a href=https://cryptobosscasino03.com>cryptoboss казино</a>
Over the past few years, competing countries have turned the moon into a hotspot for activity not witnessed since the Apollo 17 astronauts departed from the lunar surface in 1972.

In one lunar region, Japan’s “Moon Sniper” mission has beaten the odds and survived three long, frigid lunar nights since its sideways landing on January 19.
https://cryptobosscasino03.com
cryptoboss casino бездепозитный бонус
Engineers at the Japan Aerospace Exploration Agency didn’t design the spacecraft to last through one lunar night, a two-week period of freezing darkness, but the Moon Sniper continues to thrive amid lunar extremes and send back new images of its landing site.

Elsewhere, an international team of astronomers believes it has homed in on a crater created a few million years ago when something massive slammed into the lunar surface — and sent a chunk of the moon’s far side, or the side that faces away from Earth, hurtling into space. The hunk of moon became a rare quasi-satellite, or asteroid that orbits near Earth.

The Tianwen-2 mission will visit the space rock later this decade. But first, China has set its sights on returning to the moon’s “hidden side.”
The Chang’e-6 mission, which launched Friday, is aiming to bring back the first samples from the South Pole-Aitken basin, or the largest and oldest crater on the moon. Since the Chang’e 4 mission in 2019, China remains the only country to have landed on the moon’s far side, sometimes called the “dark side” of the moon.

The “dark side” of the moon is actually a misnomer, experts say, and the remote lunar hemisphere receives illumination — scientists just don’t know as much about the region as they’d like.

The far side, with its thicker crust, is vastly different from the near side that was explored during the Apollo missions.

Scientists hope that returning samples from the far side could solve some of the biggest remaining lunar mysteries, including the moon’s true origin.

783 Robertsef  
0
New mission could shed light on the secrets of the moon’s ‘hidden side
<a href=https://cryptobosscasino03.com>cryptoboss казино</a>
Over the past few years, competing countries have turned the moon into a hotspot for activity not witnessed since the Apollo 17 astronauts departed from the lunar surface in 1972.

In one lunar region, Japan’s “Moon Sniper” mission has beaten the odds and survived three long, frigid lunar nights since its sideways landing on January 19.
https://cryptobosscasino03.com
cryptoboss зеркало
Engineers at the Japan Aerospace Exploration Agency didn’t design the spacecraft to last through one lunar night, a two-week period of freezing darkness, but the Moon Sniper continues to thrive amid lunar extremes and send back new images of its landing site.

Elsewhere, an international team of astronomers believes it has homed in on a crater created a few million years ago when something massive slammed into the lunar surface — and sent a chunk of the moon’s far side, or the side that faces away from Earth, hurtling into space. The hunk of moon became a rare quasi-satellite, or asteroid that orbits near Earth.

The Tianwen-2 mission will visit the space rock later this decade. But first, China has set its sights on returning to the moon’s “hidden side.”
The Chang’e-6 mission, which launched Friday, is aiming to bring back the first samples from the South Pole-Aitken basin, or the largest and oldest crater on the moon. Since the Chang’e 4 mission in 2019, China remains the only country to have landed on the moon’s far side, sometimes called the “dark side” of the moon.

The “dark side” of the moon is actually a misnomer, experts say, and the remote lunar hemisphere receives illumination — scientists just don’t know as much about the region as they’d like.

The far side, with its thicker crust, is vastly different from the near side that was explored during the Apollo missions.

Scientists hope that returning samples from the far side could solve some of the biggest remaining lunar mysteries, including the moon’s true origin.

782 TimothyPoeve  
0
МОСКВА, 7 мая — РИА Новости. Правительство России, возглавляемое Михаилом Мишустиным, уйдет в отставку во вторник.
Сразу после инаугурации президента Владимира Путина нынешний кабинет министров сложит полномочия перед вступившим в должность главой государства.
<a href=https://xrumer.us/>Прогон по комментария</a>

781 BrianVog  
0
Учите инглиш с помощью телесериала Friends! Уроки разговорного английского а также пополнение лексического запаса через ключевые моменты сериала. Изучай английский по сериалу Друзья - эффективный а также увлекательный метод улучшить навыки понимания английским языком. Переходите на наш сайт <a href=https://serial-druzya.pp.ua/>https://serial-druzya.pp.ua/</a> и начинайте изучать инглиш уже сейчас.

1-10 11-20 21-30 ... 771-780 781-790
Имя *:
Email *:
Код *:
Форма входа

Поиск по сайту
Google Scholar

Мои сайты
  • Создать сайт
  • Творческий учитель
  • Сайт ООАКМР
  • Школьный сайт
  • Информатика учебник (будет)
  • Математические основы информатики
  • РоЖдЕнИе ИдЕи
  • ВиРтУаЛьНыЙ мУзЕй
  • О тебе и обо мне

  • Copyright MyCorp © 2024
    Бесплатный хостинг uCoz