第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何生成一個與所有數(shù)字都相等的數(shù)字

如何生成一個與所有數(shù)字都相等的數(shù)字

胡說叔叔 2021-06-29 21:13:41
    我正在制作一個具有多個級別的平臺游戲。我編寫了代碼,以便某個平臺對象僅在其級別屬性等于當前級別時才繪制并進行碰撞檢測。這對于大多數(shù)只出現(xiàn)在一層的平臺來說是好的,但我不確定如何讓平臺出現(xiàn)在所有層面(例如邊框)。是否有一個數(shù)字可以放入平臺字典中,該數(shù)字將等于所有整數(shù),以便它出現(xiàn)在每個級別上?我曾嘗試將 level 屬性設置為 true,但在 javaScript 中 true 等于 1,但不是任何其他數(shù)字。//The dictionary for a platformvar leftBorder = {    x:0,    y:0,    width:5,    height:canvas.height,    level: ??? //the level property that needs to equal any posative integer};if(leftBorder.level == currentLevel){    drawPlatform(leftBorder);}
查看完整描述

1 回答

?
明月笑刀無情

TA貢獻1828條經驗 獲得超4個贊

也許您可以添加第二個屬性來標識要在所有級別上繪制的邊框,并進行檢查。即有些像


//The dictionary for a platform

var leftBorder = {

    x:0,

    y:0,

    width:5,

    height:canvas.height,

    level: ???, //the level property that needs to equal any posative integer

    drawOnAllLevels: true

};



// Checks the levels are equal, if not checks if it should draw on all levels anyway

if(leftBorder.level == currentLevel || leftBorder.drawOnAllLevels){

    drawPlatform(leftBorder);

}


查看完整回答
反對 回復 2021-07-08
  • 1 回答
  • 0 關注
  • 218 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號