一部注釈付きです。 ---unit.tonyu(味方ユニット) 途中から---
setVisible(0); move=move; hp=hp; mhp=hp; name=name; n=n; mode=0; tikeiset(n); selected=0; while(1){ if(selected==1){ //選択されている場合 drawDxsprite(x,y,$pat_map+20,0,2,0,96,4); if(mode==1){//移動場所の描画 for(xx=-move+trunc(x/32);xx<=move+trunc(x/32);xx++){ for(yy=-move+trunc(y/32);yy<=move+trunc(y/32);yy++){ if(abs(trunc(x/32)-xx)+abs(trunc(y/32)-yy)<=move){ //距離によって描画するか決める drawDxsprite(xx*32+16,yy*32+16,$pat_map+20,0,2,0,96,4); } } } if(getkey(1)==1){//マウス押された(移動・未完成) if($d==1){ x=trunc($mousex/32)*32+16; y=trunc($mousey/32)*32+16; }else{ $d=0; } } } } drawsprite(x,y-16,p,0,-y/32);//キャラクター描画 update(); }
---turn.tonyu(コマンド処理)---
extends main;
(中略)
Imageset($pat_font,8,14,2); while(1){ //これよりステータス表示 if($unit==1){ for(t in $chars){ if(t is unit && t.selected==1){ drawtextbox(0,384,320,480,-40); drawsprite(80,430,$pat_map+12,0,-43); fillrect(30,425,30+(t.hp/t.mhp*100),435,$clBlue,-42); Imagetext(210,423,t.hp+"/"+t.mhp,1,-45); Imagetext(30,400,t.name,0,-45); tk=t.tikei.get($map.getat($mouseX,$mouseY)-32); if(tk>=0){ tk="+"+tk; } Imagetext(330,440,"Speed Change:"+tk+"%",0,-46); } } } if($unit==1){ //ユニット選択中にメニュー描画 drawtextbox(0,0,80,80,-30); drawtextbox(0,80,80,112,-30); drawsprite(24,24,$pat_map+21,0,-32); drawsprite(56,24,$pat_map+22,0,-32); drawsprite(24,56,$pat_map+23,0,-32); Imagetext(10,90,cmd.get(scmd),0,-33); if(onmouse(12,12,36,36)){//マウスが指定箇所にいる場合 scmd=1; }else if(onmouse(44,12,68,36)){ scmd=2; }else if(onmouse(12,44,36,68)){ scmd=3; }else{ scmd=0; } if(getkey(1)==1){ //マウス押されたとき if(scmd!=0){//行動ボタンの上で押したとき for(t in $chars){ if(t is unit && t.selected==1){ t.mode=scmd;//そのモードを選択中のユニットに転送 $d=1;//連打防止 } } } } } if(getkey(2)==1){ //右クリック(キャンセル) for(t in $chars){ if(t is unit && t.selected==1){ t.selected=0; t.mode=0; } } } //drawDxsprite(trunc($mousex/32)*32+16,trunc($mousey/32)*32+16,$pat_map+19,0,1,0,128,4); dhp-=(dhp-hp)*0.05;//カーソル表示 //これより地形情報表示 drawtextbox(320,384,640,480,-40); Imagetext(330,400,"("+trunc($mousex/32)+","+trunc($mousey/32)+")",0,-45); Imagetext(330,420,"Ground Type:",0,-45); drawsprite(440,427,$pat_font+$map.getat($mouseX,$mouseY)+63,0,-45); update(); }
|