这个函数在当前调试部分中创建一个指定图像索引的引用子画面的子画面视图。
使用ref_create创建的引用同时传递给精灵和图像索引。
注意 此调试控制跨越两列。
dbg_sprite(sprite_ref, image_index_ref[, label, width, height]);
参数 | 类型 | 描述 |
---|---|---|
sprite_ref | Reference | 对保存精灵索引的变量的引用,使用ref_create创建 |
image_index_ref | Reference | 对保存要显示的图像索引的变量的引用,使用ref_create创建 |
label | String | 可选显示在精灵视图旁边的标签 |
width | Real | 可选 绘制精灵的宽度。如果下一个参数中未提供高度值,则保持精灵的宽高比并相应调整高度。 默认为精灵的宽度。 |
height | Real | 可选 绘制精灵的高度。如果前面的参数中未提供宽度值,则宽度将保持其原始值。 默认为精灵的高度。 |
N/A
Create Event
ref_to_sprite = ref_create(self, "sprite_index");
ref_to_image_index = ref_create(self, "image_index");
dbg_sprite(ref_to_sprite, ref_to_image_index);
上面的代码为实例的精灵设置了一个基本的精灵视图。代码被添加到仅执行一次的事件,例如创建事件。
首先,使用ref_create创建两个引用:一个指向当前实例的sprite_index变量(存储在ref_to_sprite中),另一个指向实例的image_index变量(存储在ref_to_image_index中)。接下来,使用dbg_sprite创建sprite视图,参数为之前创建的两个引用。
sprite的帧将根据image_index的值而改变,因此在sprite视图中以动画方式绘制。当实例的sprite_index改变时,sprite也会改变。