Пятница, 29 Марта 2024, 13:15

Приветствую Вас Гость

[ Новые сообщения · Игроделы · Правила · Поиск ]
  • Страница 1 из 1
  • 1
Форум игроделов » Конструкторы игр и лёгкие в освоении системы разработки игр » Game Maker » Вопросы по Game Maker
Вопросы по Game Maker
DeadDayДата: Понедельник, 22 Декабря 2014, 19:49 | Сообщение # 1
New game Studio
Сейчас нет на сайте
Подскажите как можно создать путь уже в
игре? Как сделать так, чтоб путь сохранялся до
определённого момента? И как сделать чтоб, этот путь
был отрисован?



New Games Studio
---------------------------------------------------------------------------------------
Проекты:
DeadDay - Online
--- Мертвый день: Выживание


Сообщение отредактировал DeadDay - Пятница, 26 Декабря 2014, 23:10
aFriendДата: Понедельник, 22 Декабря 2014, 20:18 | Сообщение # 2
участник
Сейчас нет на сайте
Цитата справка

mp_grid_path
This function computes a path through the given mp_grid.

mp_grid_path(id, path, xstart, ystart, xgoal, ygoal, allowdiag)
id - Index of the mp_grid that is to be used
path - index of the path that is to be used by the function
x start- Starting x coordinate of the new path
y start - Starting y coordinate of the new path
xgoal - Finishing x coordinate of the new path
ygoal - Finishing y coordinate of the new path
allowdiag - Indicates whether diagonal moves are allowed instead of just horizontal or vertical
Returns: Boolean.

Description
With this function you can create a path that will navigate from a start point to a finish point using an mp_grid that you have previously defined, avoiding any obstacles that have already been added into the grid. The xstart and ystart arguments indicate the start of the path in room coordinates, while xgoal, ygoal arguments indicate the destination. You can also select either horizontal/vertical movement only, or allow full diagonal movements by specifying true in the allowdiag argument. The function returns either true (it succeeded in finding a path) or false (it failed) as well as setting the chosen path.
Note that the path is independent of the current instance - it is a path through the grid, not a path for a specific instance, even though a specific instance may have the variable that stores the path index. You may also need to debug these paths to see how they are made and interact within the game environment, in which case you should be using the draw_path function.

NOTE: The path must have been previously created (either in code with path_add or as a resource) and will be replaced by the path generated by this function.

Example:

Код
globalvar grid;
  grid = mp_grid_create(0, 0, room_width div 32, room_height div 32, 32, 32);
  mp_grid_add_instances(grid, obj_wall, false);  
  with (obj_Enemy)
     {
     path = path_add();
     if mp_grid_path(grid, path, x, y, obj_Player.x, obj_Player.y, 1)
        {
        path_start(path, 0, 3, 0);
        }
     }


The above code creates a global variable "grid", then generates an mp_grid and assigns its index (id) to that variable for use in all further mp_grid function calls. It then adds all instances of "obj_Wall" into the grid before getting all instances of "obj_Enemy" to create a path and then use mp_grid_path to calculate a rout from their position to the position of "obj_Player". If a route exists then the object starts itself along the path.



Сообщение отредактировал aFriend - Понедельник, 22 Декабря 2014, 20:26
DeadDayДата: Пятница, 26 Декабря 2014, 23:11 | Сообщение # 3
New game Studio
Сейчас нет на сайте
Для перемещение объекта, я использую Jump to Position, но оно мне не очень подходит.
Длина перемещение у меня фиксированное 32рх. Но так как прыжок, для меня не подходит, то что лучше использовать для плавного перемещения? Но так, чтоб он переместился именно на 32рх?



New Games Studio
---------------------------------------------------------------------------------------
Проекты:
DeadDay - Online
--- Мертвый день: Выживание
aFriendДата: Суббота, 27 Декабря 2014, 00:02 | Сообщение # 4
участник
Сейчас нет на сайте
?
DeadDayДата: Суббота, 27 Декабря 2014, 19:50 | Сообщение # 5
New game Studio
Сейчас нет на сайте
aFriend, Да, спасибо!


New Games Studio
---------------------------------------------------------------------------------------
Проекты:
DeadDay - Online
--- Мертвый день: Выживание
Форум игроделов » Конструкторы игр и лёгкие в освоении системы разработки игр » Game Maker » Вопросы по Game Maker
  • Страница 1 из 1
  • 1
Поиск:

Все права сохранены. GcUp.ru © 2008-2024 Рейтинг