就是我想要點滑鼠左鍵之後,變數+1
這要如何辦到?
|
|
|
//滑鼠左鍵、右鍵偵測
var x:int = 10;
function Update() {
if(Input.GetMouseButtonDown(0)) x += 1; //滑鼠左鍵+1
if(Input.GetMouseButtonDown(1)) x -= 1; //滑鼠右鍵-1
}
//鍵盤按鈕偵測
var y:int = 10;
function Update() {
if(Input.GetKeyDown("w")) y +=1; //按下w則y+1
if(Input.GetKeyDown("s")) y -=1; //按下s則y-1
}
如果看到喜歡的廣告,不仿點下去看看,或者+1作者,都可以給作者一些鼓勵唷!
沒有留言:
張貼留言