Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /// @description
- var xoCell = x div CellWidth;
- var yoCell = y div CellHeight;
- var newCircle = scrMidpointCircle(xoCell, yoCell, radius);
- var circleLen = array_length(newCircle);
- var lay_id_shadows = layer_get_id("ShadowTiles");
- var map_id_shadows = layer_tilemap_get_id(lay_id_shadows);
- // Обнуляем старые линии видимости
- var linesLen = array_length(lineOfSight);
- if (linesLen > 0) {
- for (var i = 0; i < linesLen; ++i) {
- var lineLen = array_length(lineOfSight[i]);
- for (var j = 0; j < lineLen; ++j) {
- tilemap_set(map_id_shadows, 1,
- lineOfSight[i][j][0], lineOfSight[i][j][1]);
- }
- }
- }
- // Строим новые - до точек круга
- for (var i = 0; i < circleLen; ++i) {
- var line = scrBresenham(xoCell, yoCell, newCircle[i][0], newCircle[i][1], global.grid);
- var lineLen = array_length(line);
- for (var j = 0; j < lineLen; ++j) {
- tilemap_set(map_id_shadows, 0, line[j][0], line[j][1]);
- }
- array_push(lineOfSight, line);
- }
- // Обновляем наш круг
- circleSight = [];
- array_copy(circleSight, 0, newCircle, 0, array_length(newCircle));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement