這篇介紹遊戲的關卡和紀錄方式

 

1. Level Complete State:
instance_number(obj): 會回傳目標instance的總數
room_exists(index): 如果目標room存在則回傳true
room_next(numb): 回傳下一間room的index
room_goto_next(): 進入下一個房間

Making More Levels:
Alt + Insert 或是 滑鼠右鍵選Duplicate可以複製Resource

Level Select Screen:
用Group和複製技巧與之前學的到建立不同的room

01.png

 

2. Saving The Game: 儲存遊戲的方式很多, 其中一種是用ini files來儲存
ini_open(name): 開啟目標ini檔
ini_write_real(section, key, value): 將目標Key和Value寫到ini檔內的section裡
ini_close(): 關閉目前的ini檔
Loading The Game:
ini_read_real(section, key, default): 讀取目標ini的section內的key和value值
sprite_index : 可以用來指定sprite的顯示圖片

Locking The Levels:
room_goto(index): 進到指定的room

02.png

 

3. 問題集
Q1: 甚麼是room變數?
A1: 它是一個只存在該room裡的global scope變數, 並且有唯一的ID

Q2: 如何複製一個room?
A2: Alt + Insert 或是 滑鼠右鍵選Duplicate

Q3: 什麼是ini file?
A3: 一個小的文字檔, 用來存取資料

Q4: ini_write_real() 是否將資料直接寫入檔案?
A4: 否, 只是先將資料寫在記憶體, 需要乎要ini_close()才會寫入

Q5: ini setion和ini key有什麼差別?
A5: ini section用來存一系列的key, ini key用來存value.

03.png    

arrow
arrow
    文章標籤
    GameMaker Levels and Saving
    全站熱搜

    RX1226 發表在 痞客邦 留言(0) 人氣()