Steam 설치
로그인
|
언어
简体中文(중국어 간체)
繁體中文(중국어 번체)
日本語(일본어)
ไทย(태국어)
Български(불가리아어)
Čeština(체코어)
Dansk(덴마크어)
Deutsch(독일어)
English(영어)
Español - España(스페인어 - 스페인)
Español - Latinoamérica(스페인어 - 중남미)
Ελληνικά(그리스어)
Français(프랑스어)
Italiano(이탈리아어)
Bahasa Indonesia(인도네시아어)
Magyar(헝가리어)
Nederlands(네덜란드어)
Norsk(노르웨이어)
Polski(폴란드어)
Português(포르투갈어 - 포르투갈)
Português - Brasil(포르투갈어 - 브라질)
Română(루마니아어)
Русский(러시아어)
Suomi(핀란드어)
Svenska(스웨덴어)
Türkçe(튀르키예어)
Tiếng Việt(베트남어)
Українська(우크라이나어)
번역 관련 문제 보고
Create event:
var cell_width = 32;
var cell_height = 32;
var hcells = room_width div cell_width;
var vcells = room_height div cell_height;
global.grid = mp_grid_create (0,0, hcells, vcells, cell_width, cell_height);
path = path_add();
// collisions
mp_grid_add_instances (global.grid, obj_wall, false);
_______
and an end game event to destroy the grid
mp_grid_destroy(global.grid);
then in my obj_enemy i have the followings
Create ev:
/// Initialize enemy
image_speed = .2;
spd = 5
///Create the path
path = path_add();
Step ev:
if (mp_grid_path(global.grid, path,x,y, obj_player.x, obj_player.y, 1)) {
path_start(path,4,path_action_stop, false);
}
I also set the obj_grid to be initialized first in my room
//-------------------------------------------------------------------
globalvar grid;
grid = mp_grid_create(32,32,MAX_X/32,MAX_Y/32,32,32);
mp_grid_add_instances(grid,parent_impassable,1);
with (parent_enemy) { //for every enemy on-screen
path = path_add();
mp_grid_path(grid, path, x, y, obj_player.x, obj_player.y, 1)
path_start(path, movement_speed, "", 1);
}
phy_position_x += sign(obj_player.x - x)*spd;
phy_position_y += sign(obj_player.y - y)*spd;
to make them move in a straight line, but ofc they get stuck in walls, since it's not pathfinding.
I don't really know what to do
var path_x = path_get_x(path, pos);
var path_y = path_get_y(path, pos);
var pdir = point_direction(phy_position_x, phy_position_y, path_x, path_y);
var vx = lengthdir_x(force, pdir);
var vy = lengthdir_y(force, pdir);
var distance = point_distance(phy_position_x, phy_position_y, path_x, path_y)
phy_speed_x = vx;
phy_speed_y = vy;