C 坦克大戰學習總結

2021-07-09 08:33:54 字數 2275 閱讀 3685

新增資源在properties下的resource.resx新增資源

使用資源

工程名.properties.resource.資源名

實際本質,是乙個流。

soundplayer ex;

命名空間

system.media

賦值

1.ex.stream,用resource資源

2.ex.soundlocation,string型別,用路徑或url

常用方法

1.ex.play()

2.ex.playlooping()

3.ex.stop()

型別

directoryinfo 路徑

fileinfo 檔案

都繼承於 filesysteminfo

常用操作

directorinfo directory.getfiles()

遍歷路徑下的檔案,返回fileinfo

fileinfo file.name

返回檔名

listbox的東西都在items這個object裡面

所以只要知道如何對陣列進行操作,就能學會如何對listbox操作

常用操作

新增刪除清空操作

listbox.items.add();

其餘刪除等操作類似陣列,不多介紹

listbox本身的操作:

獲取當前指向位置的序號

listbox.selectedindex

獲取當前指向位置的變數的名字

listbox.text

更多的類似於排序,搜尋,多選,是否能用tap

以後若有空,弄個專題研究

觸發的常用事件

selectedindexchanged() 改變index的時候

型別random

一般用時間做種子

random random =newrandom((int)datetime.now.ticks);

常用操作

建構函式年月日時分秒 日曆 用utc或本地時間

過載

基本上 + - = > 《都過載了

**幾個常用的屬性

dayofweek 星期幾

dayofyear 一年的第幾天

一些靜態的

閏年,一月中的第幾天,現在時刻,現在的utc時刻,等

實際中要善用列舉

public

static scene instance //返回乙個scene物件

return instance;}}

可以做類用,也可以做庫用

using system.drawing;

許多與影象方面的庫

類 可以直接用resourse的資源庫賦值

在畫布上繪製圖形

.drawimage()

可以直接用is來判斷型別

as來轉換型別

ele 是乙個基類

if( ele is wall)

this.walllist.add(ele as wall);

判斷相交

.intersectswith

C 遊戲《坦克大戰》 坦克

這裡的各種型別,使用struct而不是enum,避免後面強制轉換。子彈資訊 public struct t bulletinfo 坦克型別 public struct t type 坦克行動方向 public struct t dir 公共引數 public struct t commpar 設計框...

坦克大戰 坦克類

坦克類 class tank public void setx int x public int gety public void sety int y y表示坦克的縱座標 int y 0 public tank int x,int y 定義坦克方向 0表示向上,1右,2下,3左 int direc...

java 坦克大戰

include include using namespace std void print int a void shellinsert int a,int n,int d 間隔d進行排序 a j x 插入 print a void shell int a,int n shell插入排序 void...