简体   繁体   English

如何在游戏制作器中使对象再次可见

[英]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?我在游戏中有 2 个对象:obj_apple 和 obj_door(我未选中可见框)我的问题是,当所有 obj_apple 都被销毁时,如何使 obj_door 在房间中可见?

对象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 .另一种选择,这样你就不会在做每一步事件的检查,是把检查的数量obj_appledestroy的事件obj_apple

For example, in the destroy event of obj_apple you would have:例如,在obj_appledestroy事件中,您将拥有:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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