File size: 118,889 Bytes
99b0de1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 | /*:
@target MV MZ
@plugindesc Dot movement system v1.9.6
@author unagi ootoro
@url https://raw.githubusercontent.com/unagiootoro/RPGMZ/master/DotMoveSystem.js
@help
It is a plugin that allows you to move in dot units.
【How to use】
Basically, it can be used just by installing it, but more detailed control is possible by setting the following contents.
■ Setting of movement unit
In the move route script
this.setMoveUnit (Movement unit (decimal between 0 and 1));
By writing, you can specify the movement unit per step.
For example, to move an event half a step
this.setMoveUnit(0.5);
It is described as.
■ Move to any angle in dot units
In the move route script
this.dotMoveByDeg (angle (integer from 0 to 359));
By writing, you can move in the direction of the angle specified in dot units.
■ Move the event in the direction of the player in dot units
In the move route script
this.dotMoveToPlayer();
By writing, you can move the event in the direction of the player in dot units.
■ Move to the specified coordinates
In the move route script
this.moveToTarget(X coordinate, Y coordinate);
You can move it toward the specified coordinates by writing.
※1 If it collides with a wall etc. on the way, the arrival coordinates will shift.
※2 The movement with respect to the specified coordinates is performed with the upper left of the character as the origin.
■ Event contact judgment settings
Annotate the very first event command on the EV page on the first page of the event
Event contact judgment can be set in more detail by describing the following contents in the annotation.
・ Contact range on the horizontal axis
<widthArea: Contact width (decimal number between 0 and 1)>
・ Contact range on the vertical axis
<heightArea: Contact width (decimal number between 0 and 1)>
If you set the event priority below the regular character or above the regular character,
Both the contact range on the horizontal axis and the contact range on the vertical axis are used as the contact range.
When set to the same as a normal character, the contact range on the horizontal axis will be changed when touching upward or downward.
When touching to the left or right, the contact range on the vertical axis is used.
If neither the horizontal axis nor the vertical axis is set, 0.5 will be applied.
■ Event size setting
Annotate the very first event command on the EV page on the first page of the event
You can set the size of the event in more detail by including the following in the annotation.
・ Horizontal size
<width: width (real numbers greater than or equal to 0.5>
・ Vertical size
<height: height (real numbers greater than or equal to 0.5)>
・ X coordinate display offset
<offsetX: offset (real number)>
・ Y coordinate display offset
<offsetY: offset (real number)>
For example, to set a 96 * 96 size character with width: 2 and height: 2, it will be as follows.
When displaying a character larger than 48 * 48, the display start position is different from the actual XY coordinates.
You need to adjust the display offset.
<width: 2>
<height: 2>
<offsetX: 0.5>
<offsetY: 1>
■ Other functions that can be used in scripts
Game_CharacterBase#isMoved()
Gets whether the character has moved into that frame.
Game_CharacterBase#calcFar(targetCharacter)
Gets the distance between the characters. The origin of the distance calculation uses the center point.
Game_CharacterBase#calcDeg(targetCharacter)
Gets the angle to the target character. The origin of the angle calculation uses the center point.
Game_CharacterBase#moveByDirection(direction)
Moves in the direction of the character direction in the movement unit specified by setMoveUnit.
【License】
This plugin is available under the terms of the MIT license.
*/
/*:ja
@target MV MZ
@plugindesc ドット移動システム v1.9.6
@author うなぎおおとろ
@url https://raw.githubusercontent.com/unagiootoro/RPGMZ/master/DotMoveSystem.js
@help
ドット単位での移動が可能になるプラグインです。
【使用方法】
基本的に導入するだけで使用可能ですが、以下の内容を設定することでより詳細な制御が可能になります。
■ 移動単位の設定
移動ルートのスクリプトで
this.setMoveUnit(移動単位(0~1の間の小数));
と記載することで、一歩あたりの移動単位を指定することができます。
例えば、イベントを半歩移動させるには
this.setMoveUnit(0.5);
と記載します。
■ ドット単位で任意の角度に移動させる
移動ルートのスクリプトで
this.dotMoveByDeg(角度(0~359の整数));
と記載することで、ドット単位で指定した角度の方向へ移動させることができます。
■ ドット単位でイベントをプレイヤーの方向に移動させる
移動ルートのスクリプトで
this.dotMoveToPlayer();
と記載することで、イベントをドット単位でプレイヤーの方向に移動させることができます。
■ 指定の座標に移動させる
移動ルートのスクリプトで
this.moveToTarget(X座標, Y座標);
と記載することで、指定した座標に向けて移動させることができます。
※1 途中で壁などに衝突した場合は到達座標がずれます。
※2 指定の座標に対する移動はキャラクターの左上を原点として行います。
■ イベント接触判定の設定
イベントの1ページ目のEVページの一番最初のイベントコマンドを注釈にしたうえで、
注釈に以下の内容を記載することでイベント接触判定をより詳細に設定することができます。
・横軸の接触範囲
<widthArea: 接触幅(0~1の間の小数)>
・縦軸の接触範囲
<heightArea: 接触幅(0~1の間の小数)>
イベントのプライオリティを通常キャラの下または通常キャラの上に設定した場合、
横軸の接触範囲と縦軸の接触範囲の両方を接触範囲として使用します。
通常キャラと同じに設定した場合、上または下方向に接触した場合は横軸の接触範囲が、
左または右方向に接触した場合は縦軸の接触範囲が使用されます。
横軸、縦軸ともに設定しなかった場合は0.5が適用されます。
■ イベントのサイズの設定
イベントの1ページ目のEVページの一番最初のイベントコマンドを注釈にしたうえで、
注釈に以下の内容を記載することでイベントのサイズをより詳細に設定することができます。
・横方向サイズ
<width: 横幅(0.5以上の実数>
・縦方向サイズ
<height: 縦幅(0.5以上の実数)>
・X座標表示オフセット
<offsetX: オフセット(実数)>
・Y座標表示オフセット
<offsetY: オフセット(実数)>
例えば96*96サイズのキャラクターをwidth: 2, height: 2で設定する場合は次のようになります。
48*48より大きいサイズのキャラクターを表示する場合、表示開始位置が実際のXY座標とは異なるため、
表示オフセットを調整する必要があります。
<width: 2>
<height: 2>
<offsetX: 0.5>
<offsetY: 1>
■ その他スクリプトで使用可能な関数
Game_CharacterBase#isMoved()
キャラクターがそのフレーム中に移動したか否かを取得します。
Game_CharacterBase#calcFar(targetCharacter)
キャラクター間の距離を取得します。距離計算の原点は中心点を使用します。
Game_CharacterBase#calcDeg(targetCharacter)
ターゲットのキャラクターに対する角度を取得します。角度計算の原点は中心点を使用します。
Game_CharacterBase#moveByDirection(direction)
キャラクターdirectionの方向にsetMoveUnitで指定した移動単位で移動させます。
【ライセンス】
このプラグインは、MITライセンスの条件の下で利用可能です。
*/
const DotMoveSystemPluginName = document.currentScript.src.match(/^.*\/(.+)\.js$/)[1];
const DotMoveSystemClassAlias = (() => {
"use strict";
const DIAGONAL_COST = 1 / Math.sin(Math.PI / 4);
class EventParamParser {
static getWidth(event) {
let width = 1;
let noteWidth = this.getAnnotationValue(event, "width");
if (noteWidth != null) width = parseFloat(noteWidth);
return width;
}
static getHeight(event) {
let height = 1;
let noteHeight = this.getAnnotationValue(event, "height");
if (noteHeight != null) height = parseFloat(noteHeight);
return height;
}
static getOffsetX(event) {
let offsetX = 0;
let noteOffsetX = this.getAnnotationValue(event, "offsetX");
if (noteOffsetX != null) offsetX = parseFloat(noteOffsetX);
return offsetX;
}
static getOffsetY(event) {
let offsetY = 0;
let noteOffsetY = this.getAnnotationValue(event, "offsetY");
if (noteOffsetY != null) offsetY = parseFloat(noteOffsetY);
return offsetY;
}
static getWidthArea(event) {
let widthArea = 0.5;
let noteWidthArea = this.getAnnotationValue(event, "widthArea");
if (noteWidthArea != null) widthArea = parseFloat(noteWidthArea);
return widthArea;
}
static getHeightArea(event) {
let heightArea = 0.5;
let noteHeightArea = this.getAnnotationValue(event, "heightArea");
if (noteHeightArea != null) heightArea = parseFloat(noteHeightArea);
return heightArea;
}
static getAnnotationValue(event, name) {
const note = this.getAnnotation(event);
const data = { note };
DataManager.extractMetadata(data);
if (data.meta[name]) return data.meta[name];
return null;
}
static getAnnotation(event) {
const eventData = event.event();
if (eventData) {
const noteLines = [];
const page0List = eventData.pages[0].list;
if (page0List.length > 0 && page0List[0].code === 108) {
for (let i = 0; i < page0List.length; i++) {
if (page0List[0].code === 108 || page0List[0].code === 408) {
noteLines.push(page0List[i].parameters[0]);
} else {
break;
}
}
return noteLines.join("\n");
}
}
return "";
}
}
class AStarNode {
get parent() { return this._parent; }
set parent(_parent) { this._parent = _parent; }
get x() { return this._x; }
get y() { return this._y; }
get f() { return this._f; }
set f(_f) { this._f = _f; }
get g() { return this._g; }
set g(_g) { this._g = _g; }
get closed() { return this._closed; }
set closed(_closed) { this._closed = _closed; }
constructor(...args) {
this.initialize(...args);
}
initialize(parent, x, y, f, g, closed = false) {
this._parent = parent;
this._x = x;
this._y = y;
this._f = f;
this._g = g;
this._closed = closed;
}
}
class AStarUtils {
// 8方向A*経路探索を行い最適ノードと初期ノードを返す
static computeRoute(character, startX, startY, goalX, goalY, searchLimit) {
if (startX === goalX && startY === goalY) {
return [null, null];
}
const openList = [];
const nodes = {};
const start = new AStarNode(null, startX, startY, $gameMap.distance(startX, startY, goalX, goalY), 0);
const posStart = startY * $gameMap.width() + startX;
openList.push(posStart);
nodes[posStart] = start;
let best = start;
while (openList.length > 0) {
let openListIdx1 = 0;
if (openList.length > 1) {
for (let i = 1; i < openList.length; i++) {
const nodeA = nodes[openList[i]];
const nodeB = nodes[openList[openListIdx1]];
if (nodeA.f < nodeB.f) openListIdx1 = i;
}
}
const pos1 = openList[openListIdx1];
const node1 = nodes[pos1];
const x1 = node1.x;
const y1 = node1.y;
const g1 = node1.g;
if (x1 === goalX && y1 === goalY) return [node1, start];
if (node1.g >= searchLimit) return [best, start];
node1.closed = true;
openList.splice(openListIdx1, 1);
for (let direction = 1; direction <= 9; direction++) {
if (direction === 5) continue;
const [horz, vert] = DotMoveUtils.direction2HorzAndVert(direction);
const x2 = $gameMap.roundXWithDirection(x1, horz);
const y2 = $gameMap.roundYWithDirection(y1, vert);
const pos2 = y2 * $gameMap.width() + x2;
let node2 = nodes[pos2];
if (node2 && node2.closed) continue;
let successPass = true;
if (direction % 2 === 0) {
if (!character.canPass(x1, y1, direction)) {
successPass = false;
}
} else {
if (!character.canPassDiagonally(x1, y1, horz, vert)) {
successPass = false;
}
}
if (!successPass) {
if (x2 === goalX && y2 === goalY) {
if (direction % 2 === 0) {
if (character.canPass(x1, y1, direction, { needCheckCharacters: false })) {
return [node1, start];
}
} else {
if (character.canPass(x1, y1, horz) || character.canPass(x1, y1, vert)) {
if (character.canPassDiagonally(x1, y1, horz, vert, { needCheckCharacters: false })) {
return [node1, start];
}
}
}
}
continue;
}
const cost = direction % 2 === 0 ? 1 : DIAGONAL_COST;
const g2 = g1 + cost;
const f2 = g2 + $gameMap.distance(x2, y2, goalX, goalY);
const openListIdx2 = openList.indexOf(pos2);
if (openListIdx2 < 0) {
node2 = new AStarNode(node1, x2, y2, f2, g2);
nodes[pos2] = node2;
openList.push(pos2);
} else if (f2 < node2.f) {
node2.f = f2;
node2.g = g2;
node2.parent = node1;
openList.splice(openListIdx2, 1);
openList.push(pos2);
}
if (node2.f - node2.g < best.f - best.g) best = node2;
}
}
return [best, start];
}
}
class DotMoveUtils {
static direction2deg(direction) {
switch (direction) {
case 8:
return 0;
case 9:
return 45;
case 6:
return 90;
case 3:
return 135;
case 2:
return 180;
case 1:
return 225;
case 4:
return 270;
case 7:
return 315;
}
}
static deg2direction(deg) {
deg = this.degNormalization(deg);
const t = Math.round(deg / 45);
if (t === 0 || t === 8) {
return 8;
} else if (t === 1) {
return 9;
} else if (t === 2) {
return 6;
} else if (t === 3) {
return 3;
} else if (t === 4) {
return 2;
} else if (t === 5) {
return 1;
} else if (t === 6) {
return 4;
} else if (t === 7) {
return 7;
} else {
throw new Error(`${deg} is not found`);
}
}
static deg2direction4(deg, lastDirection) {
deg = this.degNormalization(deg);
const t = Math.round(deg / 45);
if (t === 0 || t === 8) {
return 8;
} else if (t === 1) {
if (lastDirection === 8) return 8;
return 6;
} else if (t === 2) {
return 6;
} else if (t === 3) {
if (lastDirection === 6) return 6;
return 2;
} else if (t === 4) {
return 2;
} else if (t === 5) {
if (lastDirection === 2) return 2;
return 4;
} else if (t === 6) {
return 4;
} else if (t === 7) {
if (lastDirection === 4) return 4;
return 8;
} else {
throw new Error(`${deg} is not found`);
}
}
static degNormalization(deg) {
deg %= 360;
if (deg < 0) deg = 360 + deg;
return deg;
}
static rad2deg(rad) {
return (rad * 180 / Math.PI) + 90;
}
static deg2rad(deg) {
return (deg - 90) * Math.PI / 180;
}
static calcDistance(deg, dpf) {
const rad = this.deg2rad(deg);
let disX = dpf * Math.cos(rad);
let disY = dpf * Math.sin(rad);
const unit = 65536;
disX *= unit;
disX = Math.round(disX);
disX /= unit;
disY *= unit;
disY = Math.round(disY);
disY /= unit;
return new Point(disX, disY);
}
static calcDeg(fromPoint, targetPoint) {
const ox = $gameMap.deltaX(targetPoint.x, fromPoint.x);
const oy = $gameMap.deltaY(targetPoint.y, fromPoint.y);
const rad = Math.atan2(oy, ox);
return this.rad2deg(rad);
}
static calcFar(fromPoint, targetPoint) {
const xDiff = $gameMap.deltaX(targetPoint.x, fromPoint.x);
const yDiff = $gameMap.deltaY(targetPoint.y, fromPoint.y);
if (xDiff === 0 && yDiff === 0) return 0;
return Math.sqrt(xDiff**2 + yDiff**2);
}
static nextPointWithDirection(point, direction, unit = 1) {
let x = point.x;
let y = point.y;
const [xSign, ySign] = this.direction2XYSign(direction);
x += xSign * unit;
y += ySign * unit;
x = $gameMap.roundX(x);
y = $gameMap.roundY(y);
return new Point(x, y);
}
static prevPointWithDirection(point, direction, unit = 1) {
let x = point.x;
let y = point.y;
const [xSign, ySign] = this.direction2XYSign(direction);
x -= xSign * unit;
y -= ySign * unit;
x = $gameMap.roundX(x);
y = $gameMap.roundY(y);
return new Point(x, y);
}
static direction2XYSign(direction) {
const [horz, vert] = this.direction2HorzAndVert(direction);
const xSign = horz === 4 ? -1 : horz === 6 ? 1 : 0;
const ySign = vert === 8 ? -1 : vert === 2 ? 1 : 0;
return [xSign, ySign];
}
static direction2HorzAndVert(direction) {
let horz = 5, vert = 5;
switch (direction) {
case 8:
vert = 8;
break;
case 9:
horz = 6;
vert = 8;
break;
case 6:
horz = 6;
break;
case 3:
horz = 6;
vert = 2;
break;
case 2:
vert = 2;
break;
case 1:
horz = 4;
vert = 2;
break;
case 4:
horz = 4;
break;
case 7:
horz = 4;
vert = 8;
break;
}
return [horz, vert];
}
static horzAndVert2Direction(horz, vert) {
if (vert === 8 && horz === 6) {
return 9;
} else if (vert === 2 && horz === 6) {
return 3;
} else if (vert === 2 && horz === 4) {
return 1;
} else if (vert === 8 && horz === 4) {
return 7;
}
return 0;
}
static checkCollidedRect(rect1, rect2) {
if (DotMoveUtils.isCollidedRect(rect1, rect2)) {
const result = new CollisionResult(rect1, rect2);
if (result.collisionLengthX() > 0 && result.collisionLengthY() > 0) return result;
}
return null;
}
static isCollidedRect(rect1, rect2) {
if ((rect1.x > rect2.x && rect1.x < (rect2.x + rect2.width) || (rect1.x + rect1.width) > rect2.x && (rect1.x + rect1.width) < rect2.x + rect2.width || rect2.x >= rect1.x && (rect2.x + rect2.width) <= (rect1.x + rect1.width)) &&
(rect1.y > rect2.y && rect1.y < (rect2.y + rect2.height) || (rect1.y + rect1.height) > rect2.y && (rect1.y + rect1.height) < rect2.y + rect2.height || rect2.y >= rect1.y && (rect2.y + rect2.height) <= (rect1.y + rect1.height))) {
return true;
}
return false;
}
static mapCharactersCacheMasses(x, y, width, height) {
const masses = [];
if (x >= $gameMap.width()) x = $gameMap.width();
if (y >= $gameMap.height()) y = $gameMap.height();
const x1 = Math.floor(x);
const x2 = Math.ceil(x) + Math.ceil(width - 1);
const y1 = Math.floor(y);
const y2 = Math.ceil(y) + Math.ceil(height - 1);
for (let ix = x1; ix <= x2; ix++) {
for (let iy = y1; iy <= y2; iy++) {
const ix2 = $gameMap.roundX(ix);
const iy2 = $gameMap.roundY(iy);
const i = iy2 * $gameMap.width() + ix2;
masses.push(i);
}
}
return masses;
}
static enteringMassesEvents(x, y, width, height) {
const characters = [];
const masses = this.mapCharactersCacheMasses(x, y, width, height);
const mapCharactersCache = $gameTemp.mapCharactersCache();
for (const massIdx of masses) {
const massCharacters = mapCharactersCache.massCharacters(massIdx);
for (const character of massCharacters) {
if (!characters.includes(character) && (character instanceof Game_Event)) characters.push(character);
}
}
return characters;
}
static checkCorrectX1ToLoopedPos(x1, x2, w2) {
return x2 >= $gameMap.width() - w2 && x1 < w2;
}
static checkCorrectX2ToLoopedPos(x1, w1, x2) {
return x2 < w1 && x1 >= $gameMap.width() - w1;
}
static checkCorrectY1ToLoopedPos(y1, y2, h2) {
return y2 >= $gameMap.height() - h2 && y1 < h2;
}
static checkCorrectY2ToLoopedPos(y1, h1, y2) {
return y2 < h1 && y1 >= $gameMap.height() - h1;
}
}
// バージョンIDが同じ場合、Game_Map#setupはコールされないため、マップ遷移時の初期化処理はここで実施する
const _Scene_Map_start = Scene_Map.prototype.start;
Scene_Map.prototype.start = function() {
_Scene_Map_start.call(this);
// マップ遷移時に全てのムーバーをクリアする(メモリリーク対策)
$gameTemp.clearMovers();
// マップ遷移時にマップのイベント配置の初期設定を行う
$gameMap.initMapEventsCache();
// マップ遷移時にプレイヤーと既に衝突しているイベントは起動対象外にする
$gamePlayer.initCollideTriggerEventIds();
};
Game_Map.prototype.initMapEventsCache = function() {
// ループ時を考慮して実際のマップサイズ+1の幅の領域を確保する
$gameTemp.setupMapCharactersCache(this.width() + 1, this.height() + 1);
for (const event of this.events()) {
event.mover().initMapCharactersCache();
}
};
// マイナス値に対応
Game_Map.prototype.roundX = function(x) {
if (this.isLoopHorizontal()) {
x %= this.width();
if (x < 0) x = this.width() + x;
}
return x;
};
Game_Map.prototype.roundY = function(y) {
if (this.isLoopVertical()) {
y %= this.height();
if (y < 0) y = this.height() + y;
}
return y;
};
Game_Map.prototype.distance = function(x1, y1, x2, y2) {
const xDis = Math.abs(this.deltaX(x1, x2));
const yDis = Math.abs(this.deltaY(y1, y2));
if (xDis > yDis) {
return (xDis - yDis) + yDis * DIAGONAL_COST;
} else {
return (yDis - xDis) + xDis * DIAGONAL_COST;
}
};
class CollisionResult {
constructor(...args) {
this.initialize(...args);
}
initialize(targetRect, collisionRect) {
this._targetRect = targetRect;
this._collisionRect = collisionRect;
const collisionLengthX = this.calcCollisionLengthX();
const collisionLengthY = this.calcCollisionLengthY();
const margin = 1.0 / 65536;
this._collisionLengthX = collisionLengthY < margin ? 0 : collisionLengthX;
this._collisionLengthY = collisionLengthX < margin ? 0 : collisionLengthY;
}
get targetRect() { return this._targetRect; }
get collisionRect() { return this._collisionRect; }
getCollisionLength(axis) {
if (axis === "x") {
return this._collisionLengthX;
} else {
return this._collisionLengthY;
}
}
collisionLengthX() {
return this._collisionLengthX;
}
collisionLengthY() {
return this._collisionLengthY;
}
calcCollisionLengthX() {
if (this._targetRect.x > this._collisionRect.x) {
const len = (this._collisionRect.x + this._collisionRect.width) - this._targetRect.x;
return len > this._targetRect.width ? this._targetRect.width : len;
} else {
return (this._targetRect.x + this._targetRect.width) - this._collisionRect.x;
}
}
calcCollisionLengthY() {
if (this._targetRect.y > this._collisionRect.y) {
const len = (this._collisionRect.y + this._collisionRect.height) - this._targetRect.y;
return len > this._targetRect.height ? this._targetRect.height : len;
} else {
return (this._targetRect.y + this._targetRect.height) - this._collisionRect.y;
}
}
}
class MapCharactersCache {
constructor(...args) {
this.initialize(...args);
}
initialize(width, height) {
this._cache = new Array(width * height);
}
massCharacters(mass) {
if (this._cache[mass] == null) return [];
return this._cache[mass];
}
addMapCharactersCache(mass, character) {
if (this._cache[mass] == null) this._cache[mass] = [];
if (!this._cache[mass].includes(character)) {
this._cache[mass].push(character);
}
}
removeMapCharactersCache(mass, character) {
if (this._cache[mass] != null) {
this._cache[mass] = this._cache[mass].filter(chr => chr !== character);
}
}
}
// キャラクターの衝突判定を実施する。
// このクラスからキャラクターの状態を書き換えることはない。
class CharacterCollisionChecker {
constructor(...args) {
this.initialize(...args);
}
initialize(character) {
this._character = character;
this._characterRealPosMode = true;
// マップイベントのキャッシュ更新用に移動前の座標と変更前のサイズを保持する
const point = character.positionPoint();
this._lastRect = new Rectangle(point.x, point.y, 1, 1);
}
checkCollision(x, y, d) {
let collisionResults = [];
collisionResults.push(...this.checkCollisionMasses(x, y, d));
// マップの範囲有効判定をマスの衝突確認で実施する必要があるため
// すり抜けを行う場合このタイミングでreturnする
if (this._character.isThrough() || this._character.isDebugThrough()) return collisionResults;
collisionResults.push(...this.checkCollisionCharacters(x, y, d));
return collisionResults;
}
// characterRealPosModeがfalseの場合はキャラクターの衝突判定に整数座標を使用する
// この機能は経路探索のためにマス単位での衝突判定を可能にすることを主な目的としている
setCharacterRealPosMode(realPosMode) {
this._characterRealPosMode = realPosMode;
}
isCharacterRealPosMode() {
return this._characterRealPosMode;
}
checkCollisionMasses(x, y, d) {
let collisionResults = [];
let x1, y1, x2, y2;
const targetRect = new Rectangle(x, y, this._character.width(), this._character.height());
switch (d) {
case 8:
x1 = Math.floor(x);
x2 = Math.ceil(x) + Math.ceil(this._character.width() - 1);
y1 = Math.floor(y);
y2 = y1;
break;
case 6:
x1 = Math.ceil(x) + Math.ceil(this._character.width() - 1);
x2 = x1;
y1 = Math.floor(y);
y2 = Math.ceil(y) + Math.ceil(this._character.height() - 1);
break;
case 2:
x1 = Math.floor(x);
x2 = Math.ceil(x) + Math.ceil(this._character.width() - 1);
y1 = Math.ceil(y) + Math.ceil(this._character.height() - 1);
y2 = y1;
break;
case 4:
x1 = Math.floor(x);
x2 = x1;
y1 = Math.floor(y);
y2 = Math.ceil(y) + Math.ceil(this._character.height() - 1);
break;
}
for (let ix = x1; ix <= x2; ix++) {
for (let iy = y1; iy <= y2; iy++) {
collisionResults.push(...this.checkCollisionMass(targetRect, d, ix, iy));
}
}
if (collisionResults.length > 0) return collisionResults;
const cliffCollisionResult = this.checkCollisionCliff(targetRect, x, y, x1, y1, x2, y2, d);
collisionResults.push(...cliffCollisionResult);
return collisionResults;
}
checkCollisionMass(targetRect, d, ix, iy) {
const massRect = new Rectangle(ix, iy, 1, 1);
if (!this.checkPassMass(ix, iy, d)) {
const point = this._character.positionPoint();
const result = this.checkCollidedRectOverComplement(point.x, point.y, d, targetRect, massRect);
if (result) return [result];
}
return [];
}
checkCollisionCliff(targetRect, x, y, x1, y1, x2, y2, d) {
switch (d) {
case 8:
return this.checkCollisionXCliff(targetRect, x, x1, x2, y1, d);
case 6:
return this.checkCollisionYCliff(targetRect, y, y1, y2, x1, d);
case 2:
return this.checkCollisionXCliff(targetRect, x, x1, x2, y1, d);
case 4:
return this.checkCollisionYCliff(targetRect, y, y1, y2, x1, d);
}
return [];
}
checkCollisionXCliff(targetRect, x, x1, x2, y1, d) {
if (x1 === x2) return [];
if (!this.checkPassMass(x1, y1, 4) && !this.checkPassMass(x2, y1, 6)) {
let massRect;
if (x - x1 > this._character.minTouchWidth()) {
massRect = new Rectangle(x1, y1, 1, 1);
} else {
massRect = new Rectangle(x2, y1, 1, 1);
}
const point = this._character.positionPoint();
const result = this.checkCollidedRectOverComplement(point.x, point.y, d, targetRect, massRect);
if (result) return [result];
}
return [];
}
checkCollisionYCliff(targetRect, y, y1, y2, x1, d) {
if (y1 === y2) return [];
if (!this.checkPassMass(x1, y1, 8) && !this.checkPassMass(x1, y2, 2)) {
let massRect;
if (y - y1 > this._character.minTouchHeight()) {
massRect = new Rectangle(x1, y1, 1, 1);
} else {
massRect = new Rectangle(x1, y2, 1, 1);
}
const point = this._character.positionPoint();
const result = this.checkCollidedRectOverComplement(point.x, point.y, d, targetRect, massRect);
if (result) return [result];
}
return [];
}
checkCollisionCharacters(x, y, d) {
return [];
}
checkPassMass(x, y, d) {
const x2 = $gameMap.roundX(x);
const y2 = $gameMap.roundY(y);
if (!$gameMap.isValid(x2, y2)) {
return false;
}
if (this._character.isThrough() || this._character.isDebugThrough()) {
return true;
}
if (this.isMassCollisionNoTarget(x, y, d)) return true;
const prevPoint = DotMoveUtils.prevPointWithDirection(new Point(x2, y2), d);
if (!this._character.isMapPassable(prevPoint.x, prevPoint.y, d)) {
return false;
}
return true;
}
// キャラクターの位置が小数の場合、逆方向のマスの通行判定が正しく取得できないため、衝突判定対象外とする
isMassCollisionNoTarget(x, y, d) {
const point = this._character.positionPoint();
switch (d) {
case 8:
if (point.y + this._character.height() <= y + 1) {
return true;
}
break;
case 6:
if (point.x >= x) {
return true;
}
break;
case 2:
if (point.y >= y) {
return true;
}
break;
case 4:
if (point.x + this._character.width() <= x + 1) {
return true;
}
break;
}
return false;
}
checkPlayer(x, y, d) {
const collisionResults = [];
if (!$gamePlayer.isThrough()) {
const result = this.checkCharacter(x, y, d, $gamePlayer, { overComplementMode: true });
if (result) collisionResults.push(result);
}
return collisionResults;
}
checkFollowers(x, y, d) {
const collisionResults = [];
for (const follower of $gamePlayer.followers().data()) {
if (!follower.isThrough()) {
const result = this.checkCharacter(x, y, d, follower, { overComplementMode: true });
if (result) collisionResults.push(result);
}
}
return collisionResults;
}
checkEvents(x, y, d, notCollisionEventIds = []) {
const collisionResults = [];
for (const event of DotMoveUtils.enteringMassesEvents(x, y, this._character.width(), this._character.height())) {
if (event.isNormalPriority() && !event.isThrough() && !notCollisionEventIds.includes(event.eventId())) {
const result = this.checkCharacter(x, y, d, event, { overComplementMode: true });
if (result) collisionResults.push(result);
}
}
return collisionResults;
}
checkOtherEvents(x, y, d) {
return this.checkEvents(x, y, d, []);
}
checkVehicles(x, y, d) {
const collisionResults = [];
const boat = $gameMap.boat();
const ship = $gameMap.ship();
if (boat._mapId === $gameMap.mapId() && !$gamePlayer.isInBoat() && !boat.isThrough()) {
const result = this.checkCharacter(x, y, d, boat, { overComplementMode: true });
if (result) collisionResults.push(result);
}
if (ship._mapId === $gameMap.mapId() && !$gamePlayer.isInShip() && !ship.isThrough()) {
const result = this.checkCharacter(x, y, d, ship, { overComplementMode: true });
if (result) collisionResults.push(result);
}
return collisionResults;
}
checkCharacter(x, y, d, character, opt = { origX: null, origY: null, overComplementMode: false }) {
const realPoint = this._character.positionPoint();
let origX = opt.origX == null ? realPoint.x : opt.origX;
let origY = opt.origY == null ? realPoint.y : opt.origY;
const overComplementMode = opt.overComplementMode == null ? false : opt.overComplementMode;
const characterRealPoint = character.positionPoint();
let cx = this.isCharacterRealPosMode() ? characterRealPoint.x : character.x;
let cy = this.isCharacterRealPosMode() ? characterRealPoint.y : character.y;
if ($gameMap.isLoopHorizontal()) {
if (DotMoveUtils.checkCorrectX2ToLoopedPos(x, this._character.width(), cx)) {
cx += $gameMap.width();
} else if (DotMoveUtils.checkCorrectX1ToLoopedPos(x, cx, character.width())) {
x += $gameMap.width();
origX += $gameMap.width();
}
}
if ($gameMap.isLoopVertical()) {
if (DotMoveUtils.checkCorrectY2ToLoopedPos(y, this._character.height(), cy)) {
cy += $gameMap.height();
} else if (DotMoveUtils.checkCorrectY1ToLoopedPos(y, cy, character.height())) {
y += $gameMap.height();
origY += $gameMap.height();
}
}
const targetRect = new Rectangle(x, y, this._character.width(), this._character.height());
const characterRect = new Rectangle(cx, cy, character.width(), character.height());
if (overComplementMode) {
return this.checkCollidedRectOverComplement(origX, origY, d, targetRect, characterRect);
} else {
return DotMoveUtils.checkCollidedRect(targetRect, characterRect);
}
}
checkCollidedRectOverComplement(origX, origY, d, targetRect, collisionRect) {
switch (d) {
case 8:
if ((origY >= collisionRect.y + collisionRect.height) && (targetRect.y < collisionRect.y)) {
collisionRect.height += collisionRect.y - targetRect.y;
collisionRect.y = targetRect.y;
}
break;
case 6:
if ((origX + targetRect.width <= collisionRect.x) && (targetRect.x + targetRect.width > collisionRect.x + collisionRect.width)) {
collisionRect.width += (targetRect.x + targetRect.width) - (collisionRect.x + collisionRect.width);
}
break;
case 2:
if ((origY + targetRect.height <= collisionRect.y) && (targetRect.y + targetRect.height > collisionRect.y + collisionRect.height)) {
collisionRect.height += (targetRect.y + targetRect.height) - (collisionRect.y + collisionRect.height);
}
break;
case 4:
if ((origX >= collisionRect.x + collisionRect.width) && (targetRect.x < collisionRect.x)) {
collisionRect.width += collisionRect.x - targetRect.x;
collisionRect.x = targetRect.x;
}
break;
}
// 衝突幅の最大値はtargetRectに合わせられるため、targetRectとcollisionRectを逆にしてCollisionResultを生成する
return DotMoveUtils.checkCollidedRect(collisionRect, targetRect);
}
initMapCharactersCache() {
const rect = this._character.collisionRect();
const masses = DotMoveUtils.mapCharactersCacheMasses(rect.x, rect.y, rect.width, rect.height);
const mapCharactersCache = $gameTemp.mapCharactersCache();
for (const mass of masses) {
mapCharactersCache.addMapCharactersCache(mass, this._character);
}
}
updateMapCharactersCache() {
const rect = this._character.collisionRect();
const mapCharactersCache = $gameTemp.mapCharactersCache();
if (this._lastRect.x !== rect.x || this._lastRect.y !== rect.y || this._lastRect.width !== rect.width || this._lastRect.height !== rect.height) {
const beforeMasses = DotMoveUtils.mapCharactersCacheMasses(this._lastRect.x, this._lastRect.y, this._lastRect.width, this._lastRect.height);
const afterMasses = DotMoveUtils.mapCharactersCacheMasses(rect.x, rect.y, rect.width, rect.height);
for (const afterMass of afterMasses) {
if (!beforeMasses.includes(afterMass)) {
mapCharactersCache.addMapCharactersCache(afterMass, this._character);
}
}
for (const beforeMass of beforeMasses) {
if (!afterMasses.includes(beforeMass)) {
mapCharactersCache.removeMapCharactersCache(beforeMass, this._character);
}
}
this._lastRect = rect;
}
}
}
class PlayerCollisionChecker extends CharacterCollisionChecker {
checkCollisionCharacters(x, y, d) {
let collisionResults = [];
collisionResults.push(...this.checkOtherEvents(x, y, d));
collisionResults.push(...this.checkVehicles(x, y, d));
return collisionResults;
}
}
class EventCollisionChecker extends CharacterCollisionChecker {
checkCollisionCharacters(x, y, d) {
let collisionResults = [];
collisionResults.push(...this.checkPlayer(x, y, d));
if ($gamePlayer.followers().isVisible()) collisionResults.push(...this.checkFollowers(x, y, d));
collisionResults.push(...this.checkOtherEvents(x, y, d));
collisionResults.push(...this.checkVehicles(x, y, d));
return collisionResults;
}
checkPlayer(x, y, d) {
if (!this._character.isNormalPriority()) return [];
return super.checkPlayer(x, y, d);
}
checkFollowers(x, y, d) {
if (!this._character.isNormalPriority()) return [];
return super.checkFollowers(x, y, d);
}
checkOtherEvents(x, y, d) {
const notCollisionEventIds = [this._character.eventId()];
return this.checkEvents(x, y, d, notCollisionEventIds);
}
}
class FollowerCollisionChecker extends CharacterCollisionChecker {
checkCollisionCharacters(x, y, d) {
let collisionResults = [];
collisionResults.push(...this.checkOtherEvents(x, y, d));
collisionResults.push(...this.checkVehicles(x, y, d));
return collisionResults;
}
}
// 衝突判定を元にキャラクターの座標を更新する。
// 座標以外の状態は変更しない。
class CharacterController {
constructor(...args) {
this.initialize(...args);
}
initialize(character, collisionChecker) {
this._character = character;
this._collisionChecker = collisionChecker;
}
dotMoveByDirection(direction) {
if (direction === 0) return false;
return this.dotMoveByDeg(DotMoveUtils.direction2deg(direction));
}
dotMoveByDeg(deg) {
const direction = DotMoveUtils.deg2direction(deg);
const distance = this.calcDistance(deg);
return this.dotMoveByDistance(direction, distance);
}
dotMoveByDistance(direction, distance) {
let movedPoint = null;
switch (direction) {
case 8:
movedPoint = this.calcUp(distance);
break;
case 9:
movedPoint = this.calcUpRight(distance);
break;
case 6:
movedPoint = this.calcRight(distance);
break;
case 3:
movedPoint = this.calcRightDown(distance);
break;
case 2:
movedPoint = this.calcDown(distance);
break;
case 1:
movedPoint = this.calcDownLeft(distance);
break;
case 4:
movedPoint = this.calcLeft(distance);
break;
case 7:
movedPoint = this.calcLeftUp(distance);
break;
}
const realPoint = this._character.positionPoint();
const margin = this._character.distancePerFrame() / 256;
let moved = true;
if (this.reachPoint(realPoint, movedPoint, margin)) moved = false;
movedPoint.x = $gameMap.roundX(movedPoint.x);
movedPoint.y = $gameMap.roundY(movedPoint.y);
this._character.setPositionPoint(movedPoint);
return moved;
}
checkCharacter(x, y, direction, character) {
return this._collisionChecker.checkCharacter(x, y, direction, character);
}
checkCharacterStepDir(x, y, direction, character) {
const deg = DotMoveUtils.direction2deg(direction);
const dis = this.calcDistance(deg);
const x2 = x + dis.x;
const y2 = y + dis.y;
return this.checkCharacter(x2, y2, direction, character);
}
checkOtherEvents(x, y, d, isCharacterRealPos = true) {
this._collisionChecker.setCharacterRealPosMode(isCharacterRealPos);
const collisionResults = this._collisionChecker.checkOtherEvents(x, y, d);
this._collisionChecker.setCharacterRealPosMode(true);
return collisionResults;
}
checkVehicles(x, y, d, isCharacterRealPos = true) {
this._collisionChecker.setCharacterRealPosMode(isCharacterRealPos);
const collisionResults = this._collisionChecker.checkVehicles(x, y, d);
this._collisionChecker.setCharacterRealPosMode(true);
return collisionResults;
}
checkPlayer(x, y, d, isCharacterRealPos = true) {
this._collisionChecker.setCharacterRealPosMode(isCharacterRealPos);
const collisionResults = this._collisionChecker.checkPlayer(x, y, d);
this._collisionChecker.setCharacterRealPosMode(true);
return collisionResults;
}
calcUp(dis) {
const target = this._character.collisionRect();
const collisionResults = this.checkCollision(target.x, target.y + dis.y, 8);
if (this.canSlide(collisionResults, "x")) {
const collisionCharacterRect = collisionResults[0].targetRect;
if ($gameMap.isLoopHorizontal()) {
if (DotMoveUtils.checkCorrectX2ToLoopedPos(target.x, target.width, collisionCharacterRect.x)) {
collisionCharacterRect.x += $gameMap.width();
} else if (DotMoveUtils.checkCorrectX1ToLoopedPos(target.x, collisionCharacterRect.x, collisionCharacterRect.width)) {
target.x += $gameMap.width();
}
}
if (collisionCharacterRect.x >= (target.x + target.width - this.slideLengthX())) {
return this.calcLeftUp(dis, true, true);
} else if ((collisionCharacterRect.x + collisionCharacterRect.width) <= (target.x + this.slideLengthY())) {
return this.calcUpRight(dis, true, true);
}
}
if (dis.x < 0) {
return this.calcLeftUp(dis, false, false);
} else {
return this.calcUpRight(dis, false, false);
}
}
calcRight(dis) {
const target = this._character.collisionRect();
const collisionResults = this.checkCollision(target.x + dis.x, target.y, 6);
if (this.canSlide(collisionResults, "y")) {
const collisionCharacterRect = collisionResults[0].targetRect;
if ($gameMap.isLoopVertical()) {
if (DotMoveUtils.checkCorrectY2ToLoopedPos(target.y, target.height, collisionCharacterRect.y)) {
collisionCharacterRect.y += $gameMap.height();
} else if (DotMoveUtils.checkCorrectY1ToLoopedPos(target.y, collisionCharacterRect.y, collisionCharacterRect.height)) {
target.y += $gameMap.height();
}
}
if (collisionCharacterRect.y >= (target.y + target.height - this.slideLengthY())) {
return this.calcUpRight(dis, true, true);
} else if ((collisionCharacterRect.y + collisionCharacterRect.height) <= (target.y + this.slideLengthY())) {
return this.calcRightDown(dis, true, true);
}
}
if (dis.y < 0) {
return this.calcUpRight(dis, false, false);
} else {
return this.calcRightDown(dis, false, false);
}
}
calcDown(dis) {
const target = this._character.collisionRect();
const collisionResults = this.checkCollision(target.x, target.y + dis.y, 2);
if (this.canSlide(collisionResults, "x")) {
const collisionCharacterRect = collisionResults[0].targetRect;
if ($gameMap.isLoopHorizontal()) {
if (DotMoveUtils.checkCorrectX2ToLoopedPos(target.x, target.width, collisionCharacterRect.x)) {
collisionCharacterRect.x += $gameMap.width();
} else if (DotMoveUtils.checkCorrectX1ToLoopedPos(target.x, collisionCharacterRect.x, collisionCharacterRect.width)) {
target.x += $gameMap.width();
}
}
if (collisionCharacterRect.x >= (target.x + target.width - this.slideLengthX())) {
return this.calcDownLeft(dis, true, true);
} else if ((collisionCharacterRect.x + collisionCharacterRect.width) <= (target.x + this.slideLengthY())) {
return this.calcRightDown(dis, true, true);
}
}
if (dis.x < 0) {
return this.calcDownLeft(dis, false, false);
} else {
return this.calcRightDown(dis, false, false);
}
}
calcLeft(dis) {
const target = this._character.collisionRect();
const collisionResults = this.checkCollision(target.x + dis.x, target.y, 4);
if (this.canSlide(collisionResults, "y")) {
const collisionCharacterRect = collisionResults[0].targetRect;
if ($gameMap.isLoopVertical()) {
if (DotMoveUtils.checkCorrectY2ToLoopedPos(target.y, target.height, collisionCharacterRect.y)) {
collisionCharacterRect.y += $gameMap.height();
} else if (DotMoveUtils.checkCorrectY1ToLoopedPos(target.y, collisionCharacterRect.y, collisionCharacterRect.height)) {
target.y += $gameMap.height();
}
}
if (collisionCharacterRect.y >= (target.y + target.height - this.slideLengthY())) {
return this.calcLeftUp(dis, true, true);
} else if ((collisionCharacterRect.y + collisionCharacterRect.height) <= (target.y + this.slideLengthY())) {
return this.calcDownLeft(dis, true, true);
}
}
if (dis.y < 0) {
return this.calcLeftUp(dis, false, false);
} else {
return this.calcDownLeft(dis, false, false);
}
}
calcUpRight(dis, enableSlideX = this.needDiagonalSlideX(), enableSlideY = this.needDiagonalSlideY()) {
const target = this._character.collisionRect();
if (enableSlideX) {
const collisionResults1 = this.checkCollision(target.x, target.y + dis.y, 8);
if (this.canSlide(collisionResults1, "x")) {
dis = this.slideDistance(dis, target, collisionResults1, 45, "x", 6);
const slidedTarget = new Point(target.x + dis.x, target.y);
dis = this.correctUpDistance(slidedTarget, dis);
return new Point(target.x + dis.x, target.y + dis.y);
}
}
if (enableSlideY) {
const collisionResults2 = this.checkCollision(target.x + dis.x, target.y, 6);
if (this.canSlide(collisionResults2, "y")) {
dis = this.slideDistance(dis, target, collisionResults2, 45, "y", 8);
const slidedTarget = new Point(target.x, target.y + dis.y);
dis = this.correctRightDistance(slidedTarget, dis);
return new Point(target.x + dis.x, target.y + dis.y);
}
}
dis = this.correctUpDistance(target, dis);
target.y += dis.y;
dis = this.correctRightDistance(target, dis);
target.x += dis.x;
return new Point(target.x, target.y);
}
calcRightDown(dis, enableSlideX = this.needDiagonalSlideX(), enableSlideY = this.needDiagonalSlideY()) {
const target = this._character.collisionRect();
if (enableSlideY) {
const collisionResults1 = this.checkCollision(target.x + dis.x, target.y, 6);
if (this.canSlide(collisionResults1, "y")) {
dis = this.slideDistance(dis, target, collisionResults1, 135, "y", 2);
const slidedTarget = new Point(target.x, target.y + dis.y);
dis = this.correctRightDistance(slidedTarget, dis);
return new Point(target.x + dis.x, target.y + dis.y);
}
}
if (enableSlideX) {
const collisionResults2 = this.checkCollision(target.x, target.y + dis.y, 2);
if (this.canSlide(collisionResults2, "x")) {
dis = this.slideDistance(dis, target, collisionResults2, 135, "x", 6);
const slidedTarget = new Point(target.x + dis.x, target.y);
dis = this.correctDownDistance(slidedTarget, dis);
return new Point(target.x + dis.x, target.y + dis.y);
}
}
dis = this.correctRightDistance(target, dis);
target.x += dis.x;
dis = this.correctDownDistance(target, dis);
target.y += dis.y;
return new Point(target.x, target.y);
}
calcDownLeft(dis, enableSlideX = this.needDiagonalSlideX(), enableSlideY = this.needDiagonalSlideY()) {
const target = this._character.collisionRect();
if (enableSlideY) {
const collisionResults1 = this.checkCollision(target.x + dis.x, target.y, 4);
if (this.canSlide(collisionResults1, "y")) {
dis = this.slideDistance(dis, target, collisionResults1, 225, "y", 2);
const slidedTarget = new Point(target.x, target.y + dis.y);
dis = this.correctLeftDistance(slidedTarget, dis);
return new Point(target.x + dis.x, target.y + dis.y);
}
}
if (enableSlideX) {
const collisionResults2 = this.checkCollision(target.x, target.y + dis.y, 2);
if (this.canSlide(collisionResults2, "x")) {
dis = this.slideDistance(dis, target, collisionResults2, 225, "x", 4);
const slidedTarget = new Point(target.x + dis.x, target.y);
dis = this.correctDownDistance(slidedTarget, dis);
return new Point(target.x + dis.x, target.y + dis.y);
}
}
dis = this.correctDownDistance(target, dis);
target.y += dis.y;
dis = this.correctLeftDistance(target, dis);
target.x += dis.x;
return new Point(target.x, target.y);
}
calcLeftUp(dis, enableSlideX = this.needDiagonalSlideX(), enableSlideY = this.needDiagonalSlideY()) {
const target = this._character.collisionRect();
if (enableSlideY) {
const collisionResults1 = this.checkCollision(target.x + dis.x, target.y, 4);
if (this.canSlide(collisionResults1, "y")) {
dis = this.slideDistance(dis, target, collisionResults1, 315, "y", 8);
const slidedTarget = new Point(target.x, target.y + dis.y);
dis = this.correctLeftDistance(slidedTarget, dis);
return new Point(target.x + dis.x, target.y + dis.y);
}
}
if (enableSlideX) {
const collisionResults2 = this.checkCollision(target.x, target.y + dis.y, 8);
if (this.canSlide(collisionResults2, "x")) {
dis = this.slideDistance(dis, target, collisionResults2, 315, "x", 4);
const slidedTarget = new Point(target.x + dis.x, target.y);
dis = this.correctUpDistance(slidedTarget, dis);
return new Point(target.x + dis.x, target.y + dis.y);
}
}
dis = this.correctLeftDistance(target, dis);
target.x += dis.x;
dis = this.correctUpDistance(target, dis);
target.y += dis.y;
return new Point(target.x, target.y);
}
correctUpDistance(target, distance) {
return this.correctDistance(target, distance, 8);
}
correctRightDistance(target, distance) {
return this.correctDistance(target, distance, 6);
}
correctDownDistance(target, distance) {
return this.correctDistance(target, distance, 2);
}
correctLeftDistance(target, distance) {
return this.correctDistance(target, distance, 4);
}
// 衝突判定を行い、衝突矩形から衝突した長さを取得してその分だけ距離を戻す
// 衝突矩形が複数ある場合は最も衝突距離が長い分だけ距離を戻す
correctDistance(target, distance, dir) {
const axis = dir === 8 || dir === 2 ? "y" : "x";
const correctedDistance = new Point(distance.x, distance.y);
if (distance[axis] === 0) return correctedDistance;
let nextX = target.x;
let nextY = target.y;
if (axis === "x") {
nextX += distance.x;
} else {
nextY += distance.y;
}
const collisionResults = this.checkCollision(nextX, nextY, dir);
if (collisionResults.length === 0) return correctedDistance;
const len = this.getMaxCollisionLength(collisionResults, axis);
// 衝突距離が移動距離より長い場合、移動距離分だけ移動させる
if (len <= Math.abs(distance[axis])) {
const sign = dir === 8 || dir === 4 ? 1 : -1;
correctedDistance[axis] += len * sign;
} else {
correctedDistance[axis] -= distance[axis];
}
return correctedDistance;
}
getMaxCollisionLength(collisionResults, axis) {
const lens = collisionResults.map(result => {
return result.getCollisionLength(axis);
});
return Math.max(...lens);
}
// 衝突距離がキャラの移動距離以上であれば移動距離分スライドを行う
// 衝突距離がキャラの移動距離未満であれば衝突距離分スライドを行う
slideDistance(dis, target, collisionResults, deg, axis, dir4) {
const newDis = new Point(dis.x, dis.y);
const len = collisionResults[0].getCollisionLength(axis);
const diagDis = this.calcDistance(deg);
if (len < Math.abs(diagDis[axis])) {
newDis[axis] = diagDis[axis] < 0 ? -len : len;
} else if (len <= this.getSlideLength(axis)) {
newDis[axis] = diagDis[axis];
} else {
return newDis;
}
return this.correctDistance(target, newDis, dir4);
}
canSlide(collisionResults, axis) {
if (this.canSlideWithoutSlideLength(collisionResults)) {
const collisionLength = Math.max(...collisionResults.map(result => result.getCollisionLength(axis)));
if (collisionLength <= this.getSlideLength(axis)) {
return true;
}
}
return false;
}
// 衝突矩形が1つだけ、または全ての衝突矩形の座標が同じである場合、キャラをスライドさせる
canSlideWithoutSlideLength(collisionResults) {
if (collisionResults.length === 0) {
return false;
} else if (collisionResults.length === 1) {
return true;
} else {
const collisionRectX = collisionResults[0].targetRect.x;
const collisionRectY = collisionResults[0].targetRect.y;
return collisionResults.every(result => {
return result.targetRect.x === collisionRectX && result.targetRect.y === collisionRectY;
});
}
}
needDiagonalSlideX() {
return false;
}
needDiagonalSlideY() {
return false;
}
calcDistance(deg) {
return DotMoveUtils.calcDistance(deg, this._character.distancePerFrame());
}
checkCollision(x, y, dir) {
return this._collisionChecker.checkCollision(x, y, dir);
}
slideLengthX() {
return this._character.minTouchWidth();
}
slideLengthY() {
return this._character.minTouchHeight();
}
getSlideLength(axis) {
if (axis === "x") {
return this.slideLengthX();
} else {
return this.slideLengthY();
}
}
reachPoint(realPoint, targetPoint, margin) {
if (Math.abs(realPoint.x - targetPoint.x) <= margin &&
Math.abs(realPoint.y - targetPoint.y) <= margin) {
return true;
}
return false;
}
initMapCharactersCache() {
this._collisionChecker.initMapCharactersCache();
}
updateMapCharactersCache() {
this._collisionChecker.updateMapCharactersCache();
}
}
class PlayerController extends CharacterController {
initialize(character) {
super.initialize(character, new PlayerCollisionChecker(character));
}
needDiagonalSlideX() {
if (this._character.width() === 1) {
return true;
}
return false;
}
needDiagonalSlideY() {
if (this._character.height() === 1) {
return true;
}
return false;
}
}
class EventController extends CharacterController {
initialize(character) {
super.initialize(character, new EventCollisionChecker(character));
}
}
class FollowerController extends CharacterController {
initialize(character) {
super.initialize(character, new FollowerCollisionChecker(character));
}
slideLengthX() {
const len = super.slideLengthX();
return len + len / 2;
}
slideLengthY() {
const len = super.slideLengthY();
return len + len / 2;
}
needDiagonalSlideX() {
if (this._character.width() === 1) {
return true;
}
return true;
}
needDiagonalSlideY() {
if (this._character.height() === 1) {
return true;
}
return false;
}
}
// CharacterControllerを用いてキャラクターの座標を更新し、
// それに合わせてキャラクターの各種状態を更新する。
class CharacterMover {
constructor(...args) {
this.initialize(...args);
}
initialize(character) {
this._character = character;
this._controller = new CharacterController(character, new CharacterCollisionChecker(character));
this._moverData = character.moverData();
this._width = 1;
this._height = 1;
this._offsetX = 0;
this._offsetY = 0;
}
update() {
this.clearMovedFlagFromCharacterMoverUpdate();
if (this._moverData.targetCount > 0) {
if (!this.isMoved()) this.moveProcess();
}
if (this._moverData.targetCount === 0) {
this._moverData.moving = false;
this._moverData.moveDeg = null;
this._moverData.moveDir = null;
if (this._moverData.setThroughReserve != null) {
this._character._through = this._moverData.setThroughReserve;
this._moverData.setThroughReserve = null;
}
if (this._moverData.setMoveSpeedReserve != null) {
this._character._moveSpeed = this._moverData.setMoveSpeedReserve;
this._moverData.setMoveSpeedReserve = null;
}
this._character.refreshBushDepth();
}
}
width() {
return this._width;
}
height() {
return this._height;
}
offsetX() {
return this._offsetX;
}
offsetY() {
return this._offsetY;
}
stopMove(isCancelMove) {
this._moverData.stopping = true;
if (isCancelMove) this._moverData.targetCount = 0;
}
resumeMove() {
this._moverData.stopping = false;
}
checkCollision(x, y, direction) {
return this._controller.checkCollision(x, y, direction);
}
checkCharacter(x, y, direction, character) {
return this._controller.checkCharacter(x, y, direction, character);
}
checkCharacterStepDir(x, y, direction, character) {
return this._controller.checkCharacterStepDir(x, y, direction, character);
}
isCollidedWithEvents(x, y, d) {
const collisionResults = this._controller.checkOtherEvents(x, y, d, false);
for (const result of collisionResults) {
if (result.collisionLengthX() >= this._character.minTouchWidth() || result.collisionLengthY() >= this._character.minTouchHeight()) {
return true;
}
}
return false;
}
isCollidedWithVehicles(x, y, d) {
const collisionResults = this._controller.checkVehicles(x, y, d, false);
for (const result of collisionResults) {
if (result.collisionLengthX() >= this._character.minTouchWidth() || result.collisionLengthY() >= this._character.minTouchHeight()) {
return true;
}
}
return false;
}
// Game_Player#updateでCharacterMover#updateがGame_Player#moveByInputの後にコールされるため移動済みフラグのクリアをメソッド化する
clearMovedFlagFromCharacterMoverUpdate() {
this.clearMovedFlag();
}
clearMovedFlag() {
this._moverData.moved = false;
}
// 移動が行われた場合、ここで毎フレーム移動処理を行う
moveProcess() {
let moved;
if (this._moverData.stopping) return;
if (this._moverData.targetCount === 0) return;
if (this._moverData.moveDeg != null) {
moved = this._controller.dotMoveByDeg(this._moverData.moveDeg);
} else {
moved = this._controller.dotMoveByDirection(this._moverData.moveDir);
}
if (moved) {
this._moverData.moved = true;
this._moverData.moving = true;
this._character.setMovementSuccess(true);
this._character.incrementTotalDpf();
if (this._moverData.targetCount > 0) this._moverData.targetCount--;
} else {
this._character.setMovementSuccess(false);
this._moverData.moving = false;
this._moverData.targetCount = 0;
}
this._character.checkEventTriggerTouchFront(this._character.direction());
}
startMove(targetCount, moveDeg, moveDir) {
this._moverData.targetCount = targetCount;
this._moverData.moveDir = moveDir;
this._moverData.moveDeg = moveDeg;
this.moveProcess();
}
calcTargetCount(fromPoint, targetPoint) {
const far = DotMoveUtils.calcFar(fromPoint, targetPoint);
return Math.round(far / this._character.distancePerFrame());
}
dotMoveByDirection(direction) {
const deg = DotMoveUtils.direction2deg(direction);
const direction4 = DotMoveUtils.deg2direction4(deg, this._character.direction());
this.setDirection(direction4);
this.startMove(1, null, direction);
}
dotMoveByDeg(deg) {
const direction4 = DotMoveUtils.deg2direction4(deg, this._character.direction());
this.setDirection(direction4);
this.startMove(1, deg, null);
}
// はしご考慮
setDirection(d) {
if (this._character.isOnLadder()) {
this._character.setDirection(8);
} else {
this._character.setDirection(d);
}
}
isMoving() {
if (this._moverData.stopping) return false;
return this._moverData.moving;
}
isMoved() {
return this._moverData.moved;
}
moveByDirection(d, moveUnit) {
if (d % 2 === 0) {
return this.moveStraight(d, moveUnit);
} else if (d === 1 || d === 3 || d === 7 || d === 9) {
const [horz, vert] = DotMoveUtils.direction2HorzAndVert(d);
this.moveDiagonally(horz, vert, moveUnit);
}
}
moveStraight(d, moveUnit) {
const fromPoint = this._character.positionPoint();
const targetPoint = DotMoveUtils.nextPointWithDirection(fromPoint, d, moveUnit);
this.setDirection(d);
const targetCount = this.calcTargetCount(fromPoint, targetPoint);
this.startMove(targetCount, null, d);
}
moveDiagonally(horz, vert, moveUnit) {
if (this._character.direction() === this._character.reverseDir(horz)) {
this.setDirection(horz);
}
if (this._character.direction() === this._character.reverseDir(vert)) {
this.setDirection(vert);
}
const d = DotMoveUtils.horzAndVert2Direction(horz, vert);
const fromPoint = this._character.positionPoint();
const targetPoint = DotMoveUtils.nextPointWithDirection(fromPoint, d, moveUnit);
const targetCount = this.calcTargetCount(fromPoint, targetPoint);
this.startMove(targetCount, null, d);
}
moveToTarget(targetPoint) {
const fromPoint = this._character.positionPoint();
const deg = DotMoveUtils.calcDeg(fromPoint, targetPoint);
const dir = DotMoveUtils.deg2direction4(deg, this._character.direction());
this.setDirection(dir);
const targetCount = this.calcTargetCount(fromPoint, targetPoint);
this.startMove(targetCount, deg, null);
}
// 移動完了後のスルー状態設定を予約する
setThrough(through) {
this._moverData.setThroughReserve = through;
}
// 移動完了後の移動速度変更を予約する
setMoveSpeed(moveSpeed) {
this._moverData.setMoveSpeedReserve = moveSpeed;
}
}
class PlayerMover extends CharacterMover {
initialize(character) {
super.initialize(character);
this._controller = new PlayerController(character);
}
// CharacterMover#updateで移動済みフラグがクリアされないようにする
clearMovedFlagFromCharacterMoverUpdate() {
}
}
class EventMover extends CharacterMover {
initialize(character) {
super.initialize(character);
this._controller = new EventController(character);
this._width = null;
this._height = null;
this._offsetX = null;
this._offsetY = null;
this._widthArea = null;
this._heightArea = null;
}
update() {
super.update();
this._controller.updateMapCharactersCache();
}
initMapCharactersCache() {
this._controller.initMapCharactersCache();
}
width() {
if (this._width == null) {
this._width = EventParamParser.getWidth(this._character);
}
return super.width();
}
height() {
if (this._height == null) {
this._height = EventParamParser.getHeight(this._character);
}
return super.height();
}
offsetX() {
if (this._offsetX == null) {
this._offsetX = EventParamParser.getOffsetX(this._character);
}
return super.offsetX();
}
offsetY() {
if (this._offsetY == null) {
this._offsetY = EventParamParser.getOffsetY(this._character);
}
return super.offsetY();
}
widthArea() {
if (this._widthArea == null) {
this._widthArea = EventParamParser.getWidthArea(this._character);
}
return this._widthArea;
}
heightArea() {
if (this._heightArea == null) {
this._heightArea = EventParamParser.getHeightArea(this._character);
}
return this._heightArea;
}
isCollidedWithPlayerCharacters(x, y, d) {
const collisionResults = this._controller.checkPlayer(x, y, d, false);
for (const result of collisionResults) {
if (result.collisionLengthX() >= this._character.minTouchWidth() || result.collisionLengthY() >= this._character.minTouchHeight()) {
return true;
}
}
return false;
}
}
class FollowerMover extends CharacterMover {
initialize(character) {
super.initialize(character);
this._controller = new FollowerController(character);
}
}
// CharacterMoverのデータのうちセーブデータに保持する必要のあるものを持たせる
class MoverData {
get moved() { return this._moved; }
set moved(_moved) { this._moved = _moved; }
get targetCount() { return this._targetCount; }
set targetCount(_targetCount) { this._targetCount = _targetCount; }
get moving() { return this._moving; }
set moving(_moving) { this._moving = _moving; }
get setThroughReserve() { return this._setThroughReserve; }
set setThroughReserve(_setThroughReserve) { this._setThroughReserve = _setThroughReserve; }
get setMoveSpeedReserve() { return this._setMoveSpeedReserve; }
set setMoveSpeedReserve(_setMoveSpeedReserve) { this._setMoveSpeedReserve = _setMoveSpeedReserve; }
get moveDeg() { return this._moveDeg; }
set moveDeg(_moveDeg) { this._moveDeg = _moveDeg; }
get moveDir() { return this._moveDir; }
set moveDir(_moveDir) { this._moveDir = _moveDir; }
get stopping() { return this._stopping; }
set stopping(_stopping) { this._stopping = _stopping; }
constructor(...args) {
this.initialize(...args);
}
initialize() {
this._moved = false;
this._targetCount = 0;
this._moving = false;
this._setThroughReserve = null;
this._setMoveSpeedReserve = null;
this._moveDeg = null;
this._moveDir = null;
this._stopping = false;
}
}
const _Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
Game_CharacterBase.prototype.initMembers = function() {
_Game_CharacterBase_initMembers.call(this);
this._totalDpf = 0; // 歩数計算のために使用
this._moveUnit = 1; // 移動単位
this._moverData = new MoverData();
};
Game_CharacterBase.prototype.makeMover = function() {
return new CharacterMover(this);
};
Game_CharacterBase.prototype.mover = function() {
return $gameTemp.mover(this);
};
Game_CharacterBase.prototype.moverData = function() {
if (this._moverData == null) this._moverData = new MoverData();
return this._moverData;
};
const _Game_CharacterBase_update = Game_CharacterBase.prototype.update;
Game_CharacterBase.prototype.update = function() {
_Game_CharacterBase_update.call(this);
this.mover().update();
};
// 座標の補正は行わない
Game_CharacterBase.prototype.updateMove = function() {
};
Game_CharacterBase.prototype.isMoving = function() {
return this.mover().isMoving();
};
Game_CharacterBase.prototype.isMoved = function() {
return this.mover().isMoved();
};
Game_CharacterBase.prototype.moveUnit = function() {
return this._moveUnit;
};
Game_CharacterBase.prototype.setMoveUnit = function(moveUnit) {
this._moveUnit = moveUnit;
};
Game_CharacterBase.prototype.incrementTotalDpf = function() {
this._totalDpf += this.distancePerFrame();
if (this._totalDpf >= 1) {
this.increaseSteps();
this._totalDpf = 0;
}
};
Game_CharacterBase.prototype.moveStraight = function(d) {
this.mover().moveStraight(d, this._moveUnit);
};
Game_CharacterBase.prototype.moveDiagonally = function(horz, vert) {
this.mover().moveDiagonally(horz, vert, this._moveUnit);
};
Game_CharacterBase.prototype.positionPoint = function() {
return new Point(this._realX, this._realY)
};
Game_CharacterBase.prototype.centerPositionPoint = function() {
return new Point(this.centerRealX(), this.centerRealY())
};
Game_CharacterBase.prototype.setPositionPoint = function(point) {
this.setPosition(point.x, point.y);
// ループマップでsetPositionを行うと整数座標が範囲外の値になる場合があるため、それを防ぐ
if ($gameMap.isLoopHorizontal()) this._x %= $gameMap.width();
if ($gameMap.isLoopVertical()) this._y %= $gameMap.height();
};
const _Game_CharacterBase_jump = Game_CharacterBase.prototype.jump;
Game_CharacterBase.prototype.jump = function(xPlus, yPlus) {
// ループマップで加算後の整数座標がループ実施前の値になるようにする
this.setPosition(this._realX, this._realY);
_Game_CharacterBase_jump.call(this, xPlus, yPlus);
};
// 移動が完了してからスルー状態を設定する
Game_CharacterBase.prototype.setThrough = function(through) {
if (!this.isMoving()) {
this._through = through;
} else {
this.mover().setThrough(through);
}
};
// 移動が完了してから移動速度の変更を反映する
Game_CharacterBase.prototype.setMoveSpeed = function(moveSpeed) {
if (!this.isMoving()) {
this._moveSpeed = moveSpeed;
} else {
this.mover().setMoveSpeed(moveSpeed);
}
};
Game_CharacterBase.prototype.width = function() {
return this.mover().width();
};
Game_CharacterBase.prototype.height = function() {
return this.mover().height();
};
Game_CharacterBase.prototype.offsetX = function() {
return this.mover().offsetX();
};
Game_CharacterBase.prototype.offsetY = function() {
return this.mover().offsetY();
};
Game_CharacterBase.prototype.centerRealX = function() {
return this._realX + this.width() / 2;
};
Game_CharacterBase.prototype.centerRealY = function() {
return this._realY + this.height() / 2;
};
// タッチ幅(キャラクターとのタッチ判定に必要な幅)を取得する。
// タッチ幅はキャラクターのスライドやイベント起動用の衝突判定に使用する。
Game_CharacterBase.prototype.minTouchWidth = function() {
const width = this.width();
return width >= 1 ? 0.5 : width / 2;
};
Game_CharacterBase.prototype.minTouchHeight = function() {
const height = this.height();
return height >= 1 ? 0.5 : height / 2;
};
// スクロール座標にオフセットを反映させる
Game_CharacterBase.prototype.scrolledX = function() {
return $gameMap.adjustX(this._realX + this.offsetX());
};
Game_CharacterBase.prototype.scrolledY = function() {
return $gameMap.adjustY(this._realY + this.offsetY());
};
Game_CharacterBase.prototype.collisionRect = function() {
return new Rectangle(this._realX, this._realY, this.width(), this.height());
};
Game_CharacterBase.prototype.canPass = function(x, y, d, opt = { needCheckCharacters: true }) {
const x2 = $gameMap.roundXWithDirection(x, d);
const y2 = $gameMap.roundYWithDirection(y, d);
if (!$gameMap.isValid(x2, y2)) {
return false;
}
if (this.isThrough() || this.isDebugThrough()) {
return true;
}
if (!this.isMapPassable(x, y, d)) {
return false;
}
if (opt.needCheckCharacters) {
if (this.isCollidedWithCharacters(x2, y2, d)) {
return false;
}
}
return true;
};
Game_CharacterBase.prototype.canPassDiagonally = function(x, y, horz, vert, opt = { needCheckCharacters: true }) {
const x2 = $gameMap.roundXWithDirection(x, horz);
const y2 = $gameMap.roundYWithDirection(y, vert);
if (this.canPass(x, y, vert, opt) && this.canPass(x, y2, horz, opt)) {
if (this.canPass(x, y, horz, opt) && this.canPass(x2, y, vert, opt)) {
return true;
}
}
return false;
};
Game_CharacterBase.prototype.isCollidedWithEvents = function(x, y, d = this.direction()) {
return this.mover().isCollidedWithEvents(x, y, d);
};
Game_CharacterBase.prototype.isCollidedWithVehicles = function(x, y, d = this.direction()) {
return this.mover().isCollidedWithVehicles(x, y, d);
};
Game_CharacterBase.prototype.isCollidedWithCharacters = function(x, y, d = this.direction()) {
return this.isCollidedWithEvents(x, y, d) || this.isCollidedWithVehicles(x, y, d);
};
Game_CharacterBase.prototype.calcDeg = function(targetCharacter) {
return DotMoveUtils.calcDeg(this.centerPositionPoint(), targetCharacter.centerPositionPoint());
};
Game_CharacterBase.prototype.calcFar = function(targetCharacter) {
return DotMoveUtils.calcFar(this.centerPositionPoint(), targetCharacter.centerPositionPoint());
};
Game_Character.prototype.findDirectionTo = function(goalX, goalY, searchLimit = this.searchLimit()) {
const [best, start] = AStarUtils.computeRoute(this, this.x, this.y, goalX, goalY, searchLimit);
if (!best) return 0;
let node = best;
while (node.parent && node.parent !== start) {
node = node.parent;
}
const deltaX1 = $gameMap.deltaX(node.x, start.x);
const deltaY1 = $gameMap.deltaY(node.y, start.y);
if (deltaX1 === 0 && deltaY1 < 0) {
return 8;
} else if (deltaX1 > 0 && deltaY1 < 0) {
return 9;
} else if (deltaX1 > 0 && deltaY1 === 0) {
return 6;
} else if (deltaX1 > 0 && deltaY1 > 0) {
return 3;
} else if (deltaX1 === 0 && deltaY1 > 0) {
return 2;
} else if (deltaX1 < 0 && deltaY1 > 0) {
return 1;
} else if (deltaX1 < 0 && deltaY1 === 0) {
return 4;
} else if (deltaX1 < 0 && deltaY1 < 0) {
return 7;
}
const deltaX2 = this.deltaXFrom(goalX);
const deltaY2 = this.deltaYFrom(goalY);
if (Math.abs(deltaX2) > Math.abs(deltaY2)) {
if (deltaX2 > 0 && deltaY2 < 0) {
return 3;
} else if (deltaX2 > 0 && deltaY2 === 0) {
return 4;
} else if (deltaX2 > 0 && deltaY2 > 0) {
return 7;
} else if (deltaX2 < 0 && deltaY2 > 0) {
return 9;
} else if (deltaX2 < 0 && deltaY2 === 0) {
return 6;
} else if (deltaX2 < 0 && deltaY2 < 0) {
return 3;
}
} else if (deltaY2 !== 0) {
if (deltaY2 < 0 && deltaX2 < 0) {
return 3;
} else if (deltaY2 < 0 && deltaX2 === 0) {
return 2;
} else if (deltaY2 < 0 && deltaX2 > 0) {
return 1;
} else if (deltaY2 > 0 && deltaX2 > 0) {
return 7;
} else if (deltaY2 > 0 && deltaX2 === 0) {
return 8;
} else if (deltaY2 > 0 && deltaX2 < 0) {
return 9;
}
}
return 0;
};
Game_Character.prototype.updateRoutineMove = function() {
if (this._waitCount > 0) {
this._waitCount--;
} else {
// 移動中でない場合、ルート更新を行う
if (!this.isMoving()) {
this.setMovementSuccess(true);
const command = this._moveRoute.list[this._moveRouteIndex];
if (command) {
this.processMoveCommand(command);
this.advanceMoveRouteIndex();
}
}
}
};
Game_Character.prototype.moveRandom = function() {
const d = 2 + Math.randomInt(4) * 2;
// canPassは行わない
this.moveStraight(d);
};
Game_Character.prototype.dotMoveByDeg = function(deg) {
this.mover().dotMoveByDeg(deg);
};
Game_Character.prototype.moveByDirection = function(direction) {
this.mover().moveByDirection(direction, this._moveUnit);
};
Game_Character.prototype.dotMoveToPlayer = function() {
const deg = this.calcDeg($gamePlayer);
this.dotMoveByDeg(deg);
};
Game_Character.prototype.moveToTarget = function(x, y) {
this.mover().moveToTarget(new Point(x, y));
};
Game_Character.prototype.deltaRealXFrom = function(x) {
return $gameMap.deltaX(this.centerRealX(), x);
};
Game_Character.prototype.deltaRealYFrom = function(y) {
return $gameMap.deltaY(this.centerRealY(), y);
};
// 整数座標ではなく実数座標で処理するように変更
Game_Character.prototype.moveTowardCharacter = function(character) {
const sx = this.deltaRealXFrom(character.centerRealX());
const sy = this.deltaRealYFrom(character.centerRealY());
if (Math.abs(sx) > Math.abs(sy)) {
this.moveStraight(sx > 0 ? 4 : 6);
if (!this.isMovementSucceeded() && sy !== 0) {
this.moveStraight(sy > 0 ? 8 : 2);
}
} else if (sy !== 0) {
this.moveStraight(sy > 0 ? 8 : 2);
if (!this.isMovementSucceeded() && sx !== 0) {
this.moveStraight(sx > 0 ? 4 : 6);
}
}
};
Game_Character.prototype.moveAwayFromCharacter = function(character) {
const sx = this.deltaRealXFrom(character.centerRealX());
const sy = this.deltaRealYFrom(character.centerRealY());
if (Math.abs(sx) > Math.abs(sy)) {
this.moveStraight(sx > 0 ? 6 : 4);
if (!this.isMovementSucceeded() && sy !== 0) {
this.moveStraight(sy > 0 ? 2 : 8);
}
} else if (sy !== 0) {
this.moveStraight(sy > 0 ? 2 : 8);
if (!this.isMovementSucceeded() && sx !== 0) {
this.moveStraight(sx > 0 ? 6 : 4);
}
}
};
Game_Character.prototype.turnTowardCharacter = function(character) {
if (this.x === character.x && this.y === character.y) return;
const sx = this.deltaRealXFrom(character.centerRealX());
const sy = this.deltaRealYFrom(character.centerRealY());
if (Math.abs(sx) > Math.abs(sy)) {
this.setDirection(sx > 0 ? 4 : 6);
} else if (sy !== 0) {
this.setDirection(sy > 0 ? 8 : 2);
}
};
Game_Character.prototype.turnAwayFromCharacter = function(character) {
if (this.x === character.x && this.y === character.y) return;
const sx = this.deltaRealXFrom(character.centerRealX());
const sy = this.deltaRealYFrom(character.centerRealY());
if (Math.abs(sx) > Math.abs(sy)) {
this.setDirection(sx > 0 ? 6 : 4);
} else if (sy !== 0) {
this.setDirection(sy > 0 ? 2 : 8);
}
};
const _Game_Player_initMembers = Game_Player.prototype.initMembers;
Game_Player.prototype.initMembers = function() {
_Game_Player_initMembers.call(this);
this._needCountProcess = false;
this._gatherStart = false;
this._shipOrBoatTowardingLand = false; // 船から陸地に移動しているか否かを管理するフラグ
this._getOffVehicleIntPos = false; // 乗り物から降りる際に整数座標に着地するか否かを管理するフラグ
this._collideTriggerEventIds = [];
this._moveSpeedBeforeGetOnVehicle = this._moveSpeed;
};
Game_Player.prototype.makeMover = function() {
return new PlayerMover(this);
};
Game_Player.prototype.isMapPassable = function(x, y, d) {
const vehicle = this.vehicle();
if (vehicle) {
return vehicle.isMapPassable(x, y, d);
} else {
if (this._shipOrBoatTowardingLand) {
// 船から着陸中の場合は、陸から海の方向への当たり判定のみを行うようにする
const d2 = this.reverseDir(d);
const nextPoint = DotMoveUtils.nextPointWithDirection(new Point(x, y), d);
return $gameMap.isPassable(nextPoint.x, nextPoint.y, d2);
}
return Game_Character.prototype.isMapPassable.call(this, x, y, d);
}
};
Game_Player.prototype.executeMove = function(direction) {
this.mover().dotMoveByDirection(direction);
};
Game_Player.prototype.getInputDirection = function() {
return Input.dir8;
};
Game_Player.prototype.moveByInput = function() {
if (!this.isMoving() && this.canMove()) {
const direction = this.getInputDirection();
if (direction > 0) {
$gameTemp.clearDestination();
$gameTemp.setBeforeTouchMovedPoint(null);
this.executeMove(direction);
} else if ($gameTemp.isDestinationValid()) {
this.startTouchMove();
}
}
};
const _Game_Player_jump = Game_Player.prototype.jump;
Game_Player.prototype.jump = function(xPlus, yPlus) {
this.initCollideTriggerEventIds(this.x + xPlus, this.y + yPlus);
_Game_Player_jump.call(this, xPlus, yPlus);
};
Game_Player.prototype.startTouchMove = function() {
const x = $gameTemp.destinationX();
const y = $gameTemp.destinationY();
const direction = this.findDirectionTo(x, y);
if (direction > 0) {
const beforeTouchMovedPoint = $gameTemp.beforeTouchMovedPoint();
const currentPoint = new Point(this.x, this.y);
const nextPoint = DotMoveUtils.nextPointWithDirection(currentPoint, direction);
if (!beforeTouchMovedPoint || !(beforeTouchMovedPoint.x === nextPoint.x && beforeTouchMovedPoint.y === nextPoint.y)) {
if (x === nextPoint.x && y === nextPoint.y) {
this.mover().moveToTarget(nextPoint);
} else {
this.mover().moveByDirection(direction, 1);
}
$gameTemp.setBeforeTouchMovedPoint(currentPoint);
}
}
};
Game_Player.prototype.forceMoveOnVehicle = function() {
this._dashing = false;
this.setMoveSpeed(4);
this.setThrough(true);
const point = this.vehicle().positionPoint();
this.mover().moveToTarget(point);
this.setThrough(false);
};
Game_Player.prototype.forceMoveOffAirship = function() {
this.setMoveSpeed(4);
// リセットした乗り物の向きにプレイヤーを合わせる
this.setDirection(this.vehicle().direction());
// 整数座標への着地中は飛行船とプレイヤーの向きを固定化
// 固定化OFFはupdateVehicleGetOffで実施する
this.vehicle().setDirectionFix(true);
this.setDirectionFix(true);
if (this._getOffVehicleIntPos) {
// 乗り物から降りた時にハマらないように整数座標に着陸する
const targetPoint = new Point(this.x, this.y);
this.mover().moveToTarget(targetPoint);
}
};
Game_Player.prototype.forceMoveOffShipOrBoat = function() {
this.setMoveSpeed(4);
this.setThrough(true);
let fromPoint;
if (this._getOffVehicleIntPos) {
// 乗り物から降りた時にハマらないように整数座標に着陸する
fromPoint = new Point(this.x, this.y);
} else {
fromPoint = this.positionPoint();
}
const targetPoint = DotMoveUtils.nextPointWithDirection(fromPoint, this.direction());
this.mover().moveToTarget(targetPoint);
this.setThrough(false);
};
Game_Player.prototype.update = function(sceneActive) {
this.mover().clearMovedFlag();
const lastScrolledX = this.scrolledX();
const lastScrolledY = this.scrolledY();
this.updateDashing();
if (sceneActive) {
this.moveByInput();
}
// wasMovingの取得タイミングをmoveByInputの後に変更
const wasMoving = this.isMoving();
Game_Character.prototype.update.call(this);
this.updateRemoveCollideTriggerEventIds();
this.updateScroll(lastScrolledX, lastScrolledY);
this.updateVehicle();
if (!this.isMoving()) {
this.updateNonmoving(wasMoving, sceneActive);
}
if (this._needCountProcess) this.updateCountProcess(sceneActive);
this.followers().update();
};
Game_Player.prototype.updateRemoveCollideTriggerEventIds = function() {
if (this.isMoving() || this.isJumping()) return; // 船から降りた場合やジャンプ先のイベントを起動対象外にする
for (const eventId of this._collideTriggerEventIds) {
const event = $gameMap.event(eventId);
if (event) {
const result = this.mover().checkCharacter(this._realX, this._realY, this._direction, event);
if (result && result.collisionLengthX() >= event.widthArea() && result.collisionLengthY() >= event.heightArea()) {
continue;
}
}
this._collideTriggerEventIds = this._collideTriggerEventIds.filter(id => id !== eventId);
}
};
const _Game_Player_increaseSteps = Game_Player.prototype.increaseSteps;
Game_Player.prototype.increaseSteps = function() {
_Game_Player_increaseSteps.call(this);
// 歩数が増加した場合、歩数増加時の処理をupdateで実行するため、
// ここでフラグをtrueにしておく
this._needCountProcess = true;
};
Game_Player.prototype.updateCountProcess = function(sceneActive) {
if ($gameMap.isEventRunning()) return;
$gameParty.onPlayerWalk();
if ($gameMap.setupStartingEvent()) {
return;
}
if (sceneActive && this.triggerAction()) {
return;
}
this.updateEncounterCount();
this._needCountProcess = false;
};
Game_Player.prototype.updateNonmoving = function(wasMoving, sceneActive) {
if ($gameMap.isEventRunning()) {
this.initCollideTriggerEventIds();
} else {
if (wasMoving) {
this.checkEventTriggerHere([1, 2]);
if ($gameMap.setupStartingEvent()) {
return;
}
}
if (sceneActive && this.triggerAction()) {
return;
}
if (!wasMoving) {
$gameTemp.clearDestination();
$gameTemp.setBeforeTouchMovedPoint(null);
}
}
};
Game_Player.prototype.initCollideTriggerEventIds = function(x = this._realX, y = this._realY) {
this._collideTriggerEventIds = [];
for (const event of DotMoveUtils.enteringMassesEvents(x, y, this.width(), this.height())) {
const eventId = event.eventId();
const result = this.mover().checkCharacter(x, y, this._direction, event);
if (!result) continue;
if (result.collisionLengthX() >= event.widthArea() && result.collisionLengthY() >= event.heightArea()) {
this._collideTriggerEventIds.push(eventId);
}
}
};
Game_Player.prototype.getOnVehicle = function() {
const vehicleType = this.checkRideVehicles();
if (vehicleType) {
this._vehicleType = vehicleType;
this._vehicleGettingOn = true;
this._moveSpeedBeforeGetOnVehicle = this.moveSpeed();
this.forceMoveOnVehicle();
const point = this.vehicle().positionPoint();
this.initCollideTriggerEventIds(point.x, point.y);
this.gatherFollowers();
}
return this._vehicleGettingOn;
};
Game_Player.prototype.checkRideVehicles = function() {
const dir = this.direction();
const airship = $gameMap.airship();
const ship = $gameMap.ship();
const boat = $gameMap.boat();
let airshipResult = null;
let shipResult = null;
let boatResult = null;
if (airship._mapId === $gameMap.mapId() && !airship.isThrough()) {
airshipResult = this.mover().checkCharacter(this._realX, this._realY, dir, airship);
}
if (airshipResult && airshipResult.collisionLengthX() >= this.minTouchWidth() && airshipResult.collisionLengthY() >= this.minTouchHeight()) {
return "airship";
} else {
const nextPoint = DotMoveUtils.nextPointWithDirection(this.positionPoint(), this.direction());
if (ship._mapId === $gameMap.mapId() && !ship.isThrough()) {
shipResult = this.mover().checkCharacter(nextPoint.x, nextPoint.y, dir, ship);
}
if (shipResult && shipResult.collisionLengthX() >= this.minTouchWidth() && shipResult.collisionLengthY() >= this.minTouchHeight()) {
return "ship";
} else {
if (boat._mapId === $gameMap.mapId() && !boat.isThrough()) {
boatResult = this.mover().checkCharacter(nextPoint.x, nextPoint.y, dir, boat);
}
if (boatResult && boatResult.collisionLengthX() >= this.minTouchWidth() && boatResult.collisionLengthY() >= this.minTouchHeight()) {
return "boat";
}
}
}
return null;
};
Game_Player.prototype.getOffVehicle = function() {
if (this.isInAirship()) {
return this.getOffAirship();
} else {
return this.getOffShipOrBoat();
}
};
Game_Player.prototype.getOffAirship = function() {
if (this.vehicle().isLandOk(this.x, this.y, this.direction())) {
if (this.isGetOffCollided(this.positionPoint())) {
if (this.isGetOffCollided(new Point(this.x, this.y))) return this._vehicleGettingOff;
this._getOffVehicleIntPos = true;
}
this.getOffVehicleLastPhase();
}
return this._vehicleGettingOff;
};
Game_Player.prototype.getOffShipOrBoat = function() {
const d = this.direction();
if (this.vehicle().isLandOk(this.x, this.y, d)) {
this._shipOrBoatTowardingLand = true;
const x = (d === 8 || d === 2) ? this._realX : this.x;
const y = (d === 6 || d === 4) ? this._realY : this.y;
let point = new Point(x, y);
const nextPoint = DotMoveUtils.nextPointWithDirection(point, d);
if (this.isGetOffCollided(nextPoint)) {
// 着陸座標で衝突が発生する場合は整数座標に着陸する
const intPoint = new Point(this.x, this.y);
const nextIntPoint = DotMoveUtils.nextPointWithDirection(new Point(this.x, this.y), d)
if (this.isGetOffCollided(nextIntPoint)) {
this._shipOrBoatTowardingLand = false;
return false;
}
this._getOffVehicleIntPos = true;
point = intPoint;
}
this.setDirectionFix(true);
this.setMoveSpeed(4);
this.setThrough(true);
this.mover().moveToTarget(point);
this.setThrough(false);
}
return false;
};
Game_Player.prototype.isGetOffCollided = function(point) {
const tmpVehicleType = this._vehicleType;
const tmpThrough = this._through;
this._vehicleType = "walk";
this._through = false;
const results = this.mover().checkCollision(point.x, point.y, this.direction());
this._vehicleType = tmpVehicleType;
this._through = tmpThrough;
return results.length > 0;
};
Game_Player.prototype.getOffVehicleLastPhase = function() {
for (const follower of this.followers().data()) {
follower.setDirectionFix(false);
}
if (this._getOffVehicleIntPos) {
this.followers().synchronize(this.x, this.y, this.direction());
} else {
this.followers().synchronize(this._realX, this._realY, this.direction());
}
this.vehicle().getOff();
if (this.isInAirship()) {
this.forceMoveOffAirship();
} else {
this.forceMoveOffShipOrBoat();
this.setTransparent(false);
}
this._vehicleGettingOff = true;
this.setThrough(false);
this.makeEncounterCount();
};
Game_Player.prototype.updateTowardLandShipOrBoat = function() {
this.vehicle().syncWithPlayer();
if (!this.isMoving()) {
if (this._getOffVehicleIntPos) {
// 整数座標への移動完了後は確実に座標を整数に設定する
this.setPositionPoint(new Point(this.x, this.y));
this.vehicle().syncWithPlayer();
} else {
// 船で実数座標に着陸した場合の座標調整を実施する
const d = this.direction();
const x = (d === 8 || d === 2) ? this._realX : this.x;
const y = (d === 6 || d === 4) ? this._realY : this.y;
this.setPositionPoint(new Point(x, y));
}
this._shipOrBoatTowardingLand = false;
this.setDirectionFix(false);
this.getOffVehicleLastPhase();
}
};
Game_Player.prototype.updateVehicle = function() {
if (this._shipOrBoatTowardingLand) {
this.updateTowardLandShipOrBoat();
} else if (this.isInVehicle() && !this.areFollowersGathering()) {
if (this._vehicleGettingOn) {
this.updateVehicleGetOn();
} else if (this._vehicleGettingOff) {
this.updateVehicleGetOff();
} else {
this.vehicle().syncWithPlayer();
}
}
};
Game_Player.prototype.updateVehicleGetOff = function() {
// 飛行船着地中はプレイヤーと飛行船の位置を同期させる
if (this.isInAirship()) {
this.vehicle().syncWithPlayer();
}
if (this._gatherStart) {
if (!this.areFollowersGathering() && this.vehicle().isLowest()) {
if (this._getOffVehicleIntPos) {
// 整数座標への移動完了後は確実に座標を整数に設定する
this.setPositionPoint(new Point(this.x, this.y));
}
if (this.isInAirship()) {
this.vehicle().syncWithPlayer();
// 飛行船着地に完了した場合、正面を向く
this.vehicle().setDirectionFix(false);
this.setDirectionFix(false);
this.setDirection(2);
for (const follower of this.followers().data()) {
follower.setDirectionFix(false);
follower.setDirection(this.direction());
}
}
this._vehicleGettingOff = false;
this._vehicleType = "walk";
this.setMoveSpeed(this._moveSpeedBeforeGetOnVehicle);
this.setTransparent(false);
this._gatherStart = false;
this._getOffVehicleIntPos = false;
}
} else {
if (!this.isMoving()) {
this.gatherFollowers();
this._gatherStart = true;
this.initCollideTriggerEventIds(this._realX, this._realY);
}
}
};
Game_Player.prototype.moveForward = function() {
this.moveStraight(this.direction());
};
Game_Player.prototype.startMapEvent = function(x, y, triggers, normal) {
if ($gameMap.isEventRunning()) return;
const hasDecideTrigger = triggers.includes(0);
for (const event of DotMoveUtils.enteringMassesEvents(x, y, this.width(), this.height())) {
const eventId = event.eventId();
if (!hasDecideTrigger) {
if (this._collideTriggerEventIds.includes(eventId)) continue;
}
const result = this.mover().checkCharacter(x, y, this._direction, event);
if (!result) continue;
if (result.collisionLengthX() >= event.widthArea() && result.collisionLengthY() >= event.heightArea()) {
if (event.isTriggerIn(triggers) && event.isNormalPriority() === normal) {
if (!hasDecideTrigger) {
if (!this._collideTriggerEventIds.includes(eventId)) {
this._collideTriggerEventIds.push(eventId);
}
}
event.start();
}
}
}
};
Game_Player.prototype.startMapEventFront = function(x, y, d, triggers, normal, isTouch) {
if ($gameMap.isEventRunning()) return;
if (isTouch && (this.isThrough() || this.isDebugThrough())) return;
const dpf = this.distancePerFrame();
const deg = DotMoveUtils.direction2deg(d);
const dis = DotMoveUtils.calcDistance(deg, dpf);
const x2 = x + dis.x;
const y2 = y + dis.y;
for (const event of DotMoveUtils.enteringMassesEvents(x2, y2, this.width(), this.height())) {
const result = this.mover().checkCharacter(x2, y2, d, event);
if (!result) continue;
const axis = this._direction === 8 || this._direction === 2 ? "x" : "y";
const area = axis === "x" ? event.widthArea() : event.heightArea();
const otherAxis = axis === "y" ? "x" : "y";
const otherAxisLen = isTouch ? dpf * 0.75 : 0;
if (result.getCollisionLength(axis) >= area && result.getCollisionLength(otherAxis) >= otherAxisLen) {
if (event.isTriggerIn(triggers) && event.isNormalPriority() === normal) {
if (isTouch && event.isThrough()) continue;
event.start();
}
}
}
};
Game_Player.prototype.checkEventTriggerTouchFront = function(d) {
if (this.canStartLocalEvents()) {
// トリガー 0: 決定ボタン 1: プレイヤーから接触 2: イベントから接触
this.startMapEventFront(this._realX, this._realY, d, [1, 2], true, true);
}
};
Game_Player.prototype.checkEventTriggerHere = function(triggers) {
if (this.canStartLocalEvents()) {
this.startMapEvent(this._realX, this._realY, triggers, false);
}
};
Game_Player.prototype.checkEventTriggerThere = function(triggers) {
if (this.canStartLocalEvents()) {
const direction = this.direction();
this.startMapEventFront(this._realX, this._realY, this._direction, triggers, true, false);
if ($gameMap.isAnyEventStarting()) return;
let currentPoint = new Point(this._realX, this._realY);
while (true) {
let nextPoint = DotMoveUtils.nextPointWithDirection(currentPoint, direction);
let nextX = Math.round(nextPoint.x);
let nextY = Math.round(nextPoint.y);
if ($gameMap.isCounter(nextX, nextY)) {
this.startMapEventFront(nextPoint.x, nextPoint.y, this._direction, triggers, true, false);
if ($gameMap.isAnyEventStarting()) break;
} else {
break;
}
currentPoint = nextPoint;
}
}
};
// プレイヤーの場合は処理をしない
Game_Player.prototype.dotMoveToPlayer = function() {
};
Game_Event.prototype.makeMover = function() {
return new EventMover(this);
};
Game_Event.prototype.widthArea = function() {
return this.mover().widthArea();
};
Game_Event.prototype.heightArea = function() {
return this.mover().heightArea();
};
const _Game_Event_lock = Game_Event.prototype.lock;
Game_Event.prototype.lock = function() {
if (!this._locked) this.mover().stopMove(this._trigger === 2); // トリガーがイベントから接触の場合は移動をキャンセルする
_Game_Event_lock.call(this);
};
const _Game_Event_unlock = Game_Event.prototype.unlock;
Game_Event.prototype.unlock = function() {
if (this._locked) this.mover().resumeMove();
_Game_Event_unlock.call(this);
};
Game_Event.prototype.isCollidedWithCharacters = function(x, y, d = this.direction()) {
return (
Game_Character.prototype.isCollidedWithCharacters.call(this, x, y, d) ||
this.isCollidedWithPlayerCharacters(x, y, d)
);
};
Game_Event.prototype.isCollidedWithEvents = function(x, y, d = this.direction()) {
return Game_CharacterBase.prototype.isCollidedWithEvents.call(this, x, y, d);
};
Game_Event.prototype.isCollidedWithPlayerCharacters = function(x, y, d = this.direction()) {
return this.mover().isCollidedWithPlayerCharacters(x, y, d);
};
Game_Event.prototype.checkEventTriggerTouchFront = function(d) {
if ($gamePlayer.isThrough()) return;
if (this._trigger === 2) {
const result = this.mover().checkCharacterStepDir(this._realX, this._realY, d, $gamePlayer);
if (!result) return;
const axis = this._direction === 8 || this._direction === 2 ? "x" : "y";
const playerMinTouchWidthOrHeight = axis === "x" ? $gamePlayer.minTouchWidth() : $gamePlayer.minTouchHeight();
const eventMinTouchWidthOrHeight = axis === "x" ? this.minTouchWidth() : this.minTouchHeight();
const minTouchWidthOrHeight = Math.min(playerMinTouchWidthOrHeight, eventMinTouchWidthOrHeight);
const otherAxis = axis === "y" ? "x" : "y";
const otherAxisLen = this.distancePerFrame() * 0.75;
if (result.getCollisionLength(axis) >= minTouchWidthOrHeight && result.getCollisionLength(otherAxis) >= otherAxisLen) {
if (!this.isJumping() && this.isNormalPriority()) {
if (!$gameMap.isEventRunning()) this.start();
}
}
}
};
// 未使用だが元々の定義として存在するため処理を用意する
Game_Event.prototype.checkEventTriggerTouch = function(x, y) {
if ($gameMap.isEventRunning()) return;
if (this._trigger === 2) {
const result = this.mover().checkCharacter(x, y, this._direction, $gamePlayer);
if (!result) return;
const minTouchWidth = Math.min($gamePlayer.minTouchWidth(), this.minTouchWidth());
const minTouchHeight = Math.min($gamePlayer.minTouchHeight(), this.minTouchHeight());
if (result.collisionLengthX() >= minTouchWidth && result.collisionLengthY() >= minTouchHeight) {
if (!this.isJumping() && this.isNormalPriority()) {
this.start();
}
}
}
};
const _Game_Follower_initialize = Game_Follower.prototype.initialize;
Game_Follower.prototype.initialize = function(memberIndex) {
_Game_Follower_initialize.call(this, memberIndex);
this.setThrough(false);
};
Game_Follower.prototype.makeMover = function() {
return new FollowerMover(this);
};
// プレイヤーがスルー状態の場合、フォロワーのスルー状態にする
const _Game_Follower_isThrough = Game_Follower.prototype.isThrough;
Game_Follower.prototype.isThrough = function() {
const result = _Game_Follower_isThrough.call(this);
return result || $gamePlayer.isThrough();
};
Game_Follower.prototype.isDebugThrough = function() {
return $gamePlayer.isDebugThrough();
};
Game_Follower.prototype.update = function() {
Game_Character.prototype.update.call(this);
// フォロワーの移動速度はchaseCharacterで設定するため、ここでは設定しない
this.setOpacity($gamePlayer.opacity());
this.setBlendMode($gamePlayer.blendMode());
this.setWalkAnime($gamePlayer.hasWalkAnime());
this.setStepAnime($gamePlayer.hasStepAnime());
this.setDirectionFix($gamePlayer.isDirectionFixed());
this.setTransparent($gamePlayer.isTransparent());
};
Game_Follower.prototype.chaseCharacter = function(character) {
if (this.isJumping()) return;
if (this.isMoving()) return;
if (this.isTransparent()) return;
const far = this.calcFar(character);
if (far >= 1) {
this.changeFollowerSpeed(far);
if (far >= 5) {
// 前のキャラとの距離が5以上離れている場合はすり抜けを行う
this.setThrough(true);
const deg = this.calcDeg(character);
this.dotMoveByDeg(deg);
} else if (far >= 3 && this.isVisible()) {
// 前のキャラとの距離が3以上離れている、かつフォロワーが可視状態の場合は経路探索を行う
this.setThrough(false);
const dir = this.findDirectionTo(character.x, character.y, 6);
this.mover().moveByDirection(dir, 1);
} else {
// 前のキャラとの距離が1以上離れている場合は360度移動を行う
this.setThrough(false);
const deg = this.calcDeg(character);
this.dotMoveByDeg(deg);
}
}
};
Game_Follower.prototype.gatherCharacter = function(character) {
this.setThrough(true);
if (this.isGathered()) {
this.setPositionPoint(character.positionPoint());
this.setThrough(false);
} else {
this.setMoveSpeed($gamePlayer.moveSpeed());
const deg = this.calcDeg(character);
this.dotMoveByDeg(deg);
}
};
Game_Follower.prototype.changeFollowerSpeed = function(precedingCharacterFar) {
this.setMoveSpeed(this.calcFollowerSpeed(precedingCharacterFar));
};
Game_Follower.prototype.calcFollowerSpeed = function(precedingCharacterFar) {
if (precedingCharacterFar >= 4) {
return $gamePlayer.realMoveSpeed() + 1;
} else if (precedingCharacterFar >= 2) {
return $gamePlayer.realMoveSpeed() + 0.5;
} else if (precedingCharacterFar >= 1.5) {
return $gamePlayer.realMoveSpeed();
} else if (precedingCharacterFar >= 1) {
return $gamePlayer.realMoveSpeed() - 1;
} else {
return 0;
}
};
Game_Follower.prototype.isGathered = function() {
if (this.isMoving()) return false;
const margin = this.distancePerFrame() / 2;
const result = this.mover().checkCharacter(this._realX, this._realY, this.direction(), $gamePlayer);
if (!result) return false;
return result.collisionLengthX() >= ($gamePlayer.width() - margin) && result.collisionLengthY() >= ($gamePlayer.height() - margin);
};
const _Game_Followers_initialize = Game_Followers.prototype.initialize;
Game_Followers.prototype.initialize = function() {
_Game_Followers_initialize.call(this);
this._gatherCount = 0; // gatherタイムアウト監視用
};
if (Utils.RPGMAKER_NAME === "MV") {
Game_Followers.prototype.data = function() {
return this._data.clone();
};
}
Game_Followers.prototype.update = function() {
if (this.areGathering()) {
this.updateGather();
} else {
this.updateMove();
}
for (const follower of this._data) {
follower.update();
}
};
Game_Followers.prototype.updateMove = function() {
for (let i = 0; i < this._data.length; i++) {
const precedingCharacter = i > 0 ? this._data[i - 1] : $gamePlayer;
this._data[i].chaseCharacter(precedingCharacter);
}
};
Game_Followers.prototype.updateGather = function() {
if (this.areGathered()) {
this._gathering = false;
} else {
for (let i = this._data.length - 1; i >= 0; i--) {
const precedingCharacter = i > 0 ? this._data[i - 1] : $gamePlayer;
this._data[i].gatherCharacter(precedingCharacter);
}
}
};
const _Game_Followers_gather = Game_Followers.prototype.gather;
Game_Followers.prototype.gather = function() {
_Game_Followers_gather.call(this);
this._gatherCount = 0;
};
const _Game_Followers_areGathering = Game_Followers.prototype.areGathering;
Game_Followers.prototype.areGathering = function() {
this._gatherCount++;
return _Game_Followers_areGathering.call(this);
};
Game_Followers.prototype.areGathered = function() {
// 600フレーム経過してもgatherが終了しない場合、フリーズ回避のために強制的にgatherを終了する
if (this._gatherCount >= 600) {
this._gatherCount = 0;
return true;
}
// MVにはGame_Follower#isGatheredがないためGame_Followers#areGatheredの処理を再定義する
return this.visibleFollowers().every(follower => follower.isGathered());
};
const _Game_Vehicle_getOn = Game_Vehicle.prototype.getOn;
Game_Vehicle.prototype.getOn = function() {
_Game_Vehicle_getOn.call(this);
$gamePlayer.setPositionPoint(this.positionPoint());
};
const _Game_Temp_initialize = Game_Temp.prototype.initialize;
Game_Temp.prototype.initialize = function() {
_Game_Temp_initialize.call(this);
// なるべくドット移動関連の変数をセーブデータに持たせないため、ムーバーはGame_Tempに保持する。
this._movers = new Map();
// イベントとの衝突判定を高速化するため、マスごとにイベントを管理する
this._mapCharactersCache = null;
// タッチ移動時に移動前後で移動先のマスが変化する場合に移動処理がループする現象に対応する
this._beforeTouchMovedPoint = null;
};
Game_Temp.prototype.mover = function(character) {
if (this._movers.get(character)) return this._movers.get(character);
const mover = character.makeMover();
this._movers.set(character, mover);
return mover;
};
Game_Temp.prototype.clearMovers = function() {
this._movers = new Map();
};
Game_Temp.prototype.setupMapCharactersCache = function(width, height) {
this._mapCharactersCache = new MapCharactersCache(width, height);
};
Game_Temp.prototype.mapCharactersCache = function() {
return this._mapCharactersCache;
};
Game_Temp.prototype.beforeTouchMovedPoint = function() {
return this._beforeTouchMovedPoint;
};
Game_Temp.prototype.setBeforeTouchMovedPoint = function(point) {
this._beforeTouchMovedPoint = point;
};
// セーブデータに保持するクラスをwindowオブジェクトに登録する
window.MoverData = MoverData;
return {
EventParamParser,
AStarNode,
AStarUtils,
DotMoveUtils,
CollisionResult,
MapCharactersCache,
CharacterCollisionChecker,
PlayerCollisionChecker,
EventCollisionChecker,
FollowerCollisionChecker,
CharacterController,
PlayerController,
EventController,
FollowerController,
CharacterMover,
PlayerMover,
EventMover,
FollowerMover,
MoverData,
};
})();
|