Урок 1. Делаем игру типа пакмана. В этом уроке шаг за шагом мы создадим игру типа пакмана, спрайты(изображения) монстров мы возьмем из примеров в ГМ. Часть 3. Модернизация игры. В этой части мы добавим полоску жизни пакману и сделаем стерляющего монстра. Добавим стреляющего монстра, сделав копию первого. Назовем его o_monster2 Вот модернизации его событий/действий (все старые события и действия мы не трогаем): [Create] Set the value of a variable - shoot - 1 [Step] If instance is aligned with grid Start of a block With a chance perform next action - 10 Start of a block If a variable has a value - shoot - 1 Start of a block Execute a piece of code: bul = instance_create(x,y,o_bullet) bul.direction = direction bul.speed = speed * 1.5 bul.image_single = image_single Set an alarm clock - 30 - alarm0 Set the value of a variable - shoot - 0 End of a block End of a block ... End of a block [alarm 0] Set the value of a variable - shoot - 1 Добавим спрайт - s_bullet Возьмем обычную монетку (coin), уберем Precise collision checking. Жмем Edit Sprite. 1. Images -> Colorize... -> 70 2. Выбираем 1 кадр (image 0), Edit - Copy, Edit - Paste; поворить еще 3 раза. 3. Жмем два раза на 2 кадр (image 1), Image -> Colorize -> 0 4. Жмем два раза на 3 кадр (image 1), Image -> Colorize -> 33 5. Жмем два раза на 4 кадр (image 1), Image -> Colorize -> 16 6. Жмем два раза на 5 кадр (image 1), Image -> Colorize -> 172 Спрайт готов! Добавляем объект o_bullet, ставим ему спрайт s_bullet, depth = 1. Добавляем событие столкновения с o_wall, в нем действие Destroy the instance. У объекта o_coin изменим depth на 2. Добавим действия объекту o_pacman: [Create] Set the value of a variable - health1 - 100 [Collision - o_bullet] Destroy the instance - other Set the value of a variable - health1, -10, relative. If a variable has a value - health1, 1, smaller than. Start of a block Set the value of a variable - health1 - 100. <Копируем все из события столкновения с o_monster> End of a block [Draw] Execute a piece of code draw_sprite(sprite_index,image_index,x,y) Draw a hor gradient: 10, 10, 10 + health1, 20, color1 - <красный>, color2 - <зеленый> И Duplicate события Collision - o_monster, на Collision - o_monster2. Осталось сделать, чтобы при смерти o_moster2 тоже возвращался на свое стартовое место. Это , я думаю, вы сделаете уже без моей помощи. Вот то что получилось у меня: pacman v1.01
|