萌新,做了一个追光的效果,如图。 做法是在scene_map上添加一个window,用sprite加载一张图片,作为window的背景,设置锚点到屏幕中心,不断缩放。 当人物走到地图边缘、离开屏幕中心时,图片也应该随之调整位 ...
Window_Spotlight.prototype.update = function () { this._spotlightSprite.x = $gamePlayer.screenX(); this._spotlightSprite.y = $gamePlayer.screenY() - 18; if (this._canZoomOut) { this._spotlightSprite.scale.x += 0.01; this._spotlightSprite.scale.y += 0.01; if (this._spotlightSprite.scale.x >= 1.5) { this._canZoomOut = false; } } else { this._spotlightSprite.scale.x -= 0.01; this._spotlightSprite.scale.y -= 0.01; if (this._spotlightSprite.scale.x <= 1) { this._canZoomOut = true; } }};
Window_Spotlight.prototype.update = function () { this._spotlightSprite.x = $gamePlayer.screenX(); this._spotlightSprite.y = $gamePlayer.screenY() - 18; if (this._canZoomOut) { this._spotlightSprite.scale.x += 0.01; this._spotlightSprite.scale.y += 0.01; if (this._spotlightSprite.scale.x >= 1.5) { this._canZoomOut = false; } } else { this._spotlightSprite.scale.x -= 0.01; this._spotlightSprite.scale.y -= 0.01; if (this._spotlightSprite.scale.x <= 1) { this._canZoomOut = true; } } };
查看全部评分
折叠内容标题(非必须)
折叠内容
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2024-9-28 02:48
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.