yanzhllwc 发表于 2020-1-1 21:46 顺便问下楼主怎么实现例图中角色只有左右没有上下动作图的? |
在野月光族 发表于 2019-12-31 01:38 月光大大,其实我自己发的18楼那个代码就是全部了,并没有上下文、、、不知道是哪里错了,大大提到的rotation值,请问是什么呢? |
哇~谢谢各位大大了!容我研究一下下!! |
下面這個官方插件 可以做到 月光大的功能 不過 他只可以 4個方向轉而已 就是無法像 下面這兩個一樣 可以 全方向.... 而且跟很多插件衝突.... 01.本來找到GLV的MV Map Projectiles,但是相當難設定.. https://galvs-scripts.com/2016/09/13/mv-map-projectiles/ 02. 日本人做的這個 看起來很厲害...不過也是很難設定 https://tm.lucky-duet.com/viewtopic.php?t=7121 https://game.nicovideo.jp/atsumaru/games/gm9334 ----------------------------------- //============================================================================= // PlayerPointerTurn.js // ---------------------------------------------------------------------------- // Copyright (c) 2015 Triacontane // This software is released under the MIT License. // http://opensource.org/licenses/mit-license.php // ---------------------------------------------------------------------------- // Version // 1.1.0 2018/02/10 PD_8DirDash.js?券????游????孵??怠紋敹????賬?餈賢?????? // 1.0.0 2016/02/23 ?? // ---------------------------------------------------------------------------- // [Blog] : https://triacontane.blogspot.jp/ // [Twitter]: https://twitter.com/triacontane/ // [GitHub] : https://github.com/triacontane/ //============================================================================= /*: * @plugindesc ??喋餈質楚??啜?? * @author ??U?喋?? * * @help 蝘餃??航?芸???扎?潦? * ??嫘??扎?踴?嫘????整??? * * ???啜?喋?胯??押?扎?喋??喋??胯?????? * * ?拍閬?嚗? * 雿?⊥?扳憭?????賬??典耦?????8蝳?函?嚗? * ?怒??????整??? * ???啜?喋??????扼??? */ (function() { var isExistPlugin = function(pluginName) { return PluginManager._parameters.hasOwnProperty([pluginName.toLowerCase()]); }; //============================================================================= // Game_Player // ??喋?格???? //============================================================================= var _Game_Player_moveByInput = Game_Player.prototype.moveByInput; Game_Player.prototype.moveByInput = function() { if (!this.isMoving() && this.canMove() && TouchInput.isMoved()) { this.turnToPointer(); } _Game_Player_moveByInput.apply(this, arguments); }; Game_Player._8dirTable = [6, 9, 8, 7, 4, 1, 2, 3, 6]; Game_Player.prototype.turnToPointer = function() { var tx = TouchInput.x, ty = TouchInput.y, sx = this.screenX(), sy = this.screenY(); var dir; if (isExistPlugin('PD_8DirDash') && this._characterName.indexOf('Q') !== -1) { var degree = (Math.atan2(ty - sy, -(tx - sx)) / Math.PI + 1) / 2 * 8; dir = Game_Player._8dirTable[Math.round(degree)]; } else { dir = Math.abs(tx - sx) > Math.abs(ty - sy) ? (tx > sx ? 6 : 4) : (ty > sy ? 2 : 8); } this.setDirection(dir); }; //============================================================================= // TouchInput // ??喋?桐?蝵柴?撣詻閮 //============================================================================= TouchInput._onMouseMove = function(event) { var x = Graphics.pageToCanvasX(event.pageX); var y = Graphics.pageToCanvasY(event.pageY); this._onMove(x, y); }; })(); |
瞎猜一下,可能是长这样子的。 |
本帖最后由 yanzhllwc 于 2019-12-29 02:59 编辑 由于不会程序,所以尝试了很多写法,总之是不成功,最后决定把里面的内容简单化,写成了下面的样子: (function () { var _TouchInput__onMouseMove = TouchInput._onMouseMove; TouchInput._onMouseMove = function(event) { _TouchInput__onMouseMove.apply(this, arguments); this.mouseX = Graphics.pageToCanvasX(event.pageX); this.mouseY = Graphics.pageToCanvasY(event.pageY); }; var px = $gamePlayer._realX; var py = $gamePlayer._realY; var mx = TouchInput.mouseX; var my = TouchInput.mouseY; var targetShuttle = 0; if(px <= mx) { if (py >= my) { targetShuttle = 45; } else { targetShuttle = 135; } } else { if (py >= my) { targetShuttle = 315; } else { targetShuttle = 225; } }; $gameScreen.picture(5)._angle = targetShuttle; })(); 存了一个js放在了插件目录并在游戏中开启,自我感觉是先定义了鼠标的移动时XY坐标,之后用px,py,mx,my分别代表玩家XY坐标和鼠标XY坐标,引用 芯☆淡茹水 大佬的区域判断,让那个5号图片的角度值呈现45,135,225,315的变化,可是这样都不成功,那张图片完全没有变化、、不知道有没有大佬能帮我看看是什么小白问题导致了不成功、、、、、 |
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2025-1-26 09:28
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.