-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploying to main from @ GamemakerChina/GameMaker-maunl-zh@d468218 🚀
- Loading branch information
Showing
128 changed files
with
128 additions
and
128 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
GameMaker_Language/GML_Reference/Asset_Management/Assets_And_Tags/asset_get_index.htm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><script type="text/javascript" language="JavaScript">function reDo(){innerWidth==origWidth&&innerHeight==origHeight||location.reload()}4==parseInt(navigator.appVersion)&&"Netscape"==navigator.appName&&(origWidth=innerWidth,origHeight=innerHeight,onresize=reDo),onerror=null</script><style type="text/css">p.WebHelpNavBar{text-align:right}</style><script type="text/javascript">gCommonRootRelPath=gRootRelPath="../../../..",gTopicId="8.2.2.3.1.0_1"</script><script type="text/javascript" src="../../../../template/scripts/rh.min.js"></script><script type="text/javascript" src="../../../../template/scripts/common.min.js"></script><script type="text/javascript" src="../../../../template/scripts/topic.min.js"></script><script type="text/javascript" src="../../../../template/scripts/topicwidgets.min.js"></script><script type="text/javascript" src="../../../../whxdata/projectsettings.js"></script><link rel="stylesheet" type="text/css" href="../../../../template/styles/topic.min.css"><link rel="stylesheet" type="text/css" href="../../../../template/Charcoal_Grey/topicheader.css"><meta name="topic-status" content="Draft"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>asset_get_index</title><meta name="generator" content="Adobe RoboHelp 2022"><link rel="stylesheet" href="../../../../assets/css/default.css" type="text/css"><script src="../../../../assets/scripts/main_script.js" type="module"></script><meta name="rh-authors" content="Mark Alexander"><meta name="topic-comment" content="Page explaining the function asset_get_index"><meta name="rh-index-keywords" content="asset_get_index"><meta name="search-keywords" content="asset_get_index"><meta name="is_pure" content="true"><meta name="brsnext" value="GameMaker_Language/GML_Reference/Asset_Management/Assets_And_Tags/asset_get_type.htm"><meta name="brsprev" value="GameMaker_Language/GML_Reference/Asset_Management/Assets_And_Tags/Assets_And_Tags.htm"></head><body><div class="topic-header rh-hide" id="rh-topic-header"><div class="logo"></div><div class="nav"><div class="title" title="asset_get_index"><span>asset_get_index</span></div><div class="gotohome" title="Click here to see this page in full context"><a href="#" onclick="rh._.goToFullLayout()">Click here to see this page in full context</a></div></div></div><div class="topic-header-shadow rh-hide" id="rh-topic-header-shadow"></div><h1><span data-field="title" data-format="default">asset_get_index</span></h1><p>此函数从游戏资产的名称中获取其唯一标识索引。</p><p>如果未找到资产,该函数将返回值 -1,否则将返回正在检查的资产的唯一索引 ID。然后,该 ID 可以在其他函数中使用,就像使用任何其他索引值一样,例如<span class="inline2"><a href="../Sprites/Sprite_Instance_Variables/sprite_index.htm">sprite_index</a></span>或<span class="inline2"><a href="../Paths/Path_Variables/path_index.htm">path_index</a></span>。请注意,虽然此函数可用于从字符串引用资产(请参见下面的示例),但您应始终确保该资产在使用前存在,否则可能会出现导致游戏崩溃的错误。</p><p> </p><h4>语法:</h4><p class="code"><span data-field="title" data-format="default">asset_get_index</span>(name);</p><table><tbody><tr><th>参数</th><th>类型</th><th>描述</th></tr><tr><td>name</td><td><span data-keyref="Type_String"><a target="_blank" href="../../../GML_Overview/Data_Types.htm">String</a></span></td><td>获取 (一个字符串) 的索引的游戏资源的名称。</td></tr></tbody></table><p> </p><h4>返回:</h4><p class="code"><span data-keyref="Type_Asset"><a target="_blank" href="../../../../The_Asset_Editors/The_Asset_Editors.htm">Asset</a></span> (any asset type)</p><p> </p><h4>例子:</h4><p class="code">var obj = asset_get_index("obj_Enemy_" + string(global.Level));<br><br>if (object_exists(obj))<br>{<br> instance_create_layer(random(room_width), random(room_height), "Enemy_Layer", obj);<br>}</p><p>The above code will get an object asset from a string, and if that asset exists, create an instance of the object in the game.</p><p> </p><p> </p><div class="footer"><div class="buttons"><div class="clear"><div style="float:left">Back: <a href="Assets_And_Tags.htm">资源和标签</a></div><div style="float:right">Next: <a href="asset_get_type.htm">asset_get_type</a></div></div></div><h5><span data-keyref="Copyright Notice">© Copyright YoYo Games Ltd. 2024 All Rights Reserved</span></h5></div></body></html> | ||
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head><script type="text/javascript" language="JavaScript">function reDo(){innerWidth==origWidth&&innerHeight==origHeight||location.reload()}4==parseInt(navigator.appVersion)&&"Netscape"==navigator.appName&&(origWidth=innerWidth,origHeight=innerHeight,onresize=reDo),onerror=null</script><style type="text/css">p.WebHelpNavBar{text-align:right}</style><script type="text/javascript">gCommonRootRelPath=gRootRelPath="../../../..",gTopicId="8.2.2.3.1.0_1"</script><script type="text/javascript" src="../../../../template/scripts/rh.min.js"></script><script type="text/javascript" src="../../../../template/scripts/common.min.js"></script><script type="text/javascript" src="../../../../template/scripts/topic.min.js"></script><script type="text/javascript" src="../../../../template/scripts/topicwidgets.min.js"></script><script type="text/javascript" src="../../../../whxdata/projectsettings.js"></script><link rel="stylesheet" type="text/css" href="../../../../template/styles/topic.min.css"><link rel="stylesheet" type="text/css" href="../../../../template/Charcoal_Grey/topicheader.css"><meta name="topic-status" content="Draft"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>asset_get_index</title><meta name="generator" content="Adobe RoboHelp 2022"><link rel="stylesheet" href="../../../../assets/css/default.css" type="text/css"><script src="../../../../assets/scripts/main_script.js" type="module"></script><meta name="rh-authors" content="Mark Alexander"><meta name="topic-comment" content="Page explaining the function asset_get_index"><meta name="rh-index-keywords" content="asset_get_index"><meta name="search-keywords" content="asset_get_index"><meta name="is_pure" content="true"><meta name="brsnext" value="GameMaker_Language/GML_Reference/Asset_Management/Assets_And_Tags/asset_get_type.htm"><meta name="brsprev" value="GameMaker_Language/GML_Reference/Asset_Management/Assets_And_Tags/Assets_And_Tags.htm"></head><body><div class="topic-header rh-hide" id="rh-topic-header"><div class="logo"></div><div class="nav"><div class="title" title="asset_get_index"><span>asset_get_index</span></div><div class="gotohome" title="Click here to see this page in full context"><a href="#" onclick="rh._.goToFullLayout()">Click here to see this page in full context</a></div></div></div><div class="topic-header-shadow rh-hide" id="rh-topic-header-shadow"></div><h1><span data-field="title" data-format="default">asset_get_index</span></h1><p>此函数从游戏资产的名称中获取其唯一标识索引。</p><p>如果未找到资产,该函数将返回值 -1,否则将返回正在检查的资产的唯一索引 ID。然后,该 ID 可以在其他函数中使用,就像使用任何其他索引值一样,例如<span class="inline2"><a href="../Sprites/Sprite_Instance_Variables/sprite_index.htm">sprite_index</a></span>或<span class="inline2"><a href="../Paths/Path_Variables/path_index.htm">path_index</a></span>。请注意,虽然此函数可用于从字符串引用资产(请参见下面的示例),但您应始终确保该资产在使用前存在,否则可能会出现导致游戏崩溃的错误。</p><p> </p><h4>语法:</h4><p class="code"><span data-field="title" data-format="default">asset_get_index</span>(name);</p><table><tbody><tr><th>参数</th><th>类型</th><th>描述</th></tr><tr><td>name</td><td><span data-keyref="Type_String"><a target="_blank" href="../../../GML_Overview/Data_Types.htm">String</a></span></td><td>获取 (一个字符串) 的索引的游戏资源的名称。</td></tr></tbody></table><p> </p><h4>返回:</h4><p class="code"><span data-keyref="Type_Asset"><a target="_blank" href="../../../../The_Asset_Editors/The_Asset_Editors.htm">Asset</a></span> (any asset type)</p><p> </p><h4>例子:</h4><p class="code">var obj = asset_get_index("obj_Enemy_" + string(global.Level));<br><br>if (object_exists(obj))<br>{<br> instance_create_layer(random(room_width), random(room_height), "Enemy_Layer", obj);<br>}</p><p>上面的代码将从字符串中获取对象资源,如果该资源存在,则在游戏中创建该对象的实例。</p><p> </p><p> </p><div class="footer"><div class="buttons"><div class="clear"><div style="float:left">Back: <a href="Assets_And_Tags.htm">资源和标签</a></div><div style="float:right">Next: <a href="asset_get_type.htm">asset_get_type</a></div></div></div><h5><span data-keyref="Copyright Notice">© Copyright YoYo Games Ltd. 2024 All Rights Reserved</span></h5></div></body></html> |
Oops, something went wrong.