简体   繁体   中英

how to make an object visible again in game maker

Fist of all, I'm really sorry for my bad English and I pretty new to game maker .

I have 2 object in the game : obj_apple and obj_door( I unchecked visible box) my question is how can I make an obj_door visible in the room when all the obj_apple are destroyed?

对象obj_doorStep事件,放置代码( Add event -> Step -> Step -> 选项卡Control -> 部分Code ,第一个图标(执行代码)):

if !instance_exists(obj_apple) visible = true;

Another option, so you aren't making a check in every step event, is to put the check for the number of obj_apple in the destroy event of obj_apple .

For example, in the destroy event of obj_apple you would have:

if (instance_number(object_index) == 0) {
   with (obj_door) {
      visible = true;
   }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM