免費論壇 繁體 | 簡體
Sclub交友聊天~加入聊天室當版主
分享
Board logo

標題: [制作教程] RPG类伪透视系统 [打印本頁]

作者: longzu    時間: 2013-6-28 18:31     標題: RPG类伪透视系统

[attach]886[/attach]




资源

名称:

RPG

类伪透视

系统


资源作者:gducn


资源类型:演示&教程


使用语言:

简体中文


资源大小:25.0 KB



介绍说明:



这玩意儿应该算是个人原创吧^ ^类似于暗黑啊,等等RPG中

人物

被遮挡后的处理,不过这里需要利用单位来

模拟

地形装饰物,因此可能会对

地图

本身产生一定的压力。不过我在代码上已经加入了几个开关,可以有效的降低多余计算/运行次数。如果需要移植到多人的话,请自己尝试吧^ ^



如果你看不懂这段代码的话,个人建议不要乱用= =尽管比较简单。


代码效率或许还有待于优化。



以上。



关键代码:



jassfunction IsNotHero takes nothing returns boolean



if IsUnitType(GetFilterUnit(),UNIT_TYPE_HERO)==false then



call UnitAddAbility(GetFilterUnit(),’Aloc’)



return true



endif



return false



endfunction



function PerspclreWork takes nothing returns nothing



local real x=GetUnitX(gg_unit_Ewar_0759)



local real y=GetUnitY(gg_unit_Ewar_0759)



local real x1=GetUnitX(GetEnumUnit())



local real y1=GetUnitY(GetEnumUnit())



local real d=SquareRoot((x-x1)*(x-x1)+(y-y1)*(y-y1))



local integer t=R2I(0.255*d)



if t>255 then



set t=255



endif



call SetUnitVertexColor(GetEnumUnit(),255,255,255,t)



endfunction



function PerspclreDone takes nothing returns nothing



call SetUnitVertexColor(GetEnumUnit(),255,255,255,255)



endfunction



function Perspclre takes nothing returns nothing



if IsUnitInRegion(udg_rg,gg_unit_Ewar_0759) then



set udg_b=true



call ForGroup(udg_g,function PerspclreWork)



else



if udg_b then



set udg_b=false



call ForGroup(udg_g,function PerspclreDone)



endif



endif



endfunction



function SystemInit takes nothing returns nothing



local boolexpr b=Condition(function IsNotHero)



call GroupEnumUnitsInRect(udg_g,bj_mapInitialPlayableArea,b)



call DestroyBoolExpr(b)



set b=null



call RegionAddRect(udg_rg,gg_rct_r01)



call RegionAddRect(udg_rg,gg_rct_r02)



call RemoveRect(gg_rct_r01)



call RemoveRect(gg_rct_r02)



call TimerStart(CreateTimer(),0.1,true,function Perspclre)



call DestroyTrigger(GetTriggeringTrigger())



endfunction



下载地址:
http://www.400gb.com/file/23778124
http://d.119g.com/f/61FBEC85F21C30A6.html




歡迎光臨 龙组游戏联盟 (http://longzu.66rt.com/) Powered by Discuz! 7.2