diff --git a/Manual/contents/GameMaker_Language/GML_Overview/Instance Keywords/other.htm b/Manual/contents/GameMaker_Language/GML_Overview/Instance Keywords/other.htm index fc8953f3e..edd41c570 100644 --- a/Manual/contents/GameMaker_Language/GML_Overview/Instance Keywords/other.htm +++ b/Manual/contents/GameMaker_Language/GML_Overview/Instance Keywords/other.htm @@ -49,6 +49,13 @@
In previous versions of GameMaker other only changed in the following cases:
+This behaviour can be enabled by the Legacy Other Behaviour game option.
Scope doesn't change inside a struct declaration, so other refers to the same scope as self (the current scope), meaning the struct or instance that's initialising the struct:
var _struct =
diff --git a/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Instances/Instance_Variables/alarm.htm b/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Instances/Instance_Variables/alarm.htm
index 97c06cf9d..cc7de9bd8 100644
--- a/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Instances/Instance_Variables/alarm.htm
+++ b/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Instances/Instance_Variables/alarm.htm
@@ -14,7 +14,7 @@
이 1차원 배열 은 인스턴스에 있을 수 있는 모든 경보의 현재 값을 가져오거나 해당 경보를 설정하는 데 사용할 수 있습니다. 객체의 각 인스턴스에는 12개의 알람이 내장되어 있으며 각 알람에는 이 변수가 0에 도달할 때 실행되는 자체 event 가 있습니다.
경보는 각 단계가 시작될 때, 단계 시작 이벤트 이후 에 기본 단계 이벤트 이전 에, 그리고 프레임에 대해 무엇이든 렌더링되기 전에 카운트다운됩니다. 즉, 단계 시작 이벤트에서 알람을 alarm_set()>1 로 설정하면 해당 이벤트가 동일한 프레임에서 실행되지만(단계 시작이 완료된 후 알람이 0으로 카운트다운됨 alarm_get()>) Step 이벤트는 다음 프레임에서 실행됩니다.
알람이 0에 도달하면(이벤트가 트리거되었지만) 다음 단계로 -1로 내려갈 때 알람이 종료되지 않는다는 점에 유의해야 합니다. 따라서 어떤 이유로든 알람을 중지해야 하는 경우 해당 배열을 설정해야 합니다 값을 0이 아닌 -1로 설정합니다. 알람 시간은 게임 단계 에서 계산되며 값이 30이면 30단계, 60이면 60단계 등...
참고 조치나 코드가 없는 알람은 실행되지 않습니다. 하지만 댓글만 있고 코드가 없어도 알람은 카운트다운됩니다.
알람 배열을 직접 설정할 수 있지만(배열을 사용하여 현재 알람 값을 직접 검색할 수도 있습니다), 어떤 상황에서는 이것이 가장 적절한 방법이 아니므로 함수를 사용할 수도 있습니다. 알람을 설정하고 기능을 알람 값을 가져옵니다.
alarm[val];
(-1 if the alarm isn't running)
if canshoot
{
- if (keyboard_check_pressed(vk_space))
+ if (keyboard_check_pressed(vk_space))
{
canshoot = false;
alarm[0] = room_speed;
diff --git a/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Instances/instance_create_layer.htm b/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Instances/instance_create_layer.htm
index 54aed71ff..f40aeb20a 100644
--- a/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Instances/instance_create_layer.htm
+++ b/Manual/contents/GameMaker_Language/GML_Reference/Asset_Management/Instances/instance_create_layer.htm
@@ -1,4 +1,4 @@
-
+
This function gets information on a room from storage and returns it as a struct. You can choose to exclude information through the given optional arguments.
-The function cannot be used to get the current state of an active room (the current room or an already visited persistent room). In this case it returns the original state of the room.
-The room must have been previously created using The Asset Browser or added in-game using room_add.
-The format of the returned struct is as follows:
-room_info_struct =
-
- {
-
- instances:
-
- [
-
- {/* Instance Info Struct */},
-
- {/* Instance Info Struct */},
-
- ],
-
- layers:
-
- [
-
- {
-
- elements:
-
- [
-
- {/* Layer Element Info Struct */},
-
- {
-
- /* Example */
-
- type: layerelementtype_tilemap,
-
- tiles: [/* Tile Map Data */]
-
- }
-
- ]
-
- },
-
- ],
-
- views:
-
- [
-
- {/* View Info Struct */},
-
- ]
-
- }
The tables below list all the possible structs that can be contained in the returned struct:
- -This is the main struct returned by the function. All variables listed below are present at the root of this returned struct:
-Variable Name | -Data Type | -Description | -
---|---|---|
width | -Real | -The width of the room | -
height | -Real | -The height of the room | -
creationCode | -Script Function | -The index of the script function that contains this room's creation code | -
physicsWorld | -Boolean | -Whether the room has a physics world | -
physicsGravityX | -Real | -The physics world's gravity component along the x axis | -
physicsGravityY | -Real | -The physics world's gravity component along the y axis | -
physicsPixToMeters | -Real | -The physics world's pixel-to-metre scale | -
persistent | -Boolean | -Whether the room is persistent | -
enableViews | -Boolean | -Whether views are enabled for the room | -
clearDisplayBuffer | -Boolean | -Whether to clear the display buffer before drawing the room | -
clearViewportBackground | -Boolean | -Whether to clear viewports' backgrounds before drawing to them | -
colour | -Colour | -The clear colour used when clearDisplayBuffer is set to true | -
instances | -Array of Room Instance Info Struct | -An array listing all instances placed in the room with basic information on them | -
layers | -Array of Room Layer Info Struct | -An array listing all room layers, in order of increasing depth | -
views | -Array of Room View Info Struct | -An array listing all views, ordered by view index | -
This type of struct represents one instance in the room.
-These structs are found in the instances array, which is part of the main struct returned by the function.
-Variable Name | -Data Type | -Description | -
---|---|---|
id | -Object Instance | -The instance ID | -
object_index | -String | -The name of the object this is an instance of (use asset_get_index to get the actual object) | -
x | -Real | -The x coordinate of the instance's position | -
y | -Real | -The y coordinate of the instance's position | -
xscale | -Real | -The x scale of the instance | -
yscale | -Real | -The y scale of the instance | -
angle | -Real | -The rotation angle of the instance | -
image_index | -Real | -The image index used by the instance | -
image_speed | -Real | -The image speed of the instance | -
colour | -Colour | -The blend colour used to draw the instance | -
creation_code | -Script Function | -The index of the script function that contains the instance's creation code | -
pre_creation_code | -Script Function | -The index of the script function that contains the instance's pre-creation code | -
This type of struct represents one layer in the room.
-These structs are found in the layers array, which is part of the main struct returned by the function.
-Variable Name | -Data Type | -Description | -
---|---|---|
id | -Real | -The layer handle | -
name | -String | -The name of the layer | -
visible | -Boolean | -Whether the layer is visible | -
depth | -Real | -The depth of the layer | -
xoffset | -Real | -The x offset of the layer | -
yoffset | -Real | -The y offset of the layer | -
hspeed | -Real | -The horizontal speed of the layer | -
vspeed | -Real | -The vertical speed of the layer | -
effectEnabled | -Boolean | -Whether the layer filter/effect is currently enabled | -
effectToBeEnabled | -Boolean | -Whether the layer filter/effect should be enabled/disabled in the next frame (the next value of effectEnabled) | -
effect | -FX Struct | -A struct containing the effect's parameters (-1 if no layer effect is set) | -
shaderID | -Shader Asset | -The shader to be applied to the layer (layer_shader) | -
elements | -Array of Room Layer Element Info Struct | -An array listing all elements on the layer. Each element type struct contains information specific to it. | -
This type of struct represents one view in the room.
-These structs are found in the views array, which is part of the main struct returned by the function.
-Variable Name | -Data Type | -Description | -
---|---|---|
visible | -Boolean | -Whether the view is visible | -
cameraID | -Camera ID | -The camera assigned to this view | -
xview | -Real | -The x coordinate of the view camera's position | -
yview | -Real | -The y coordinate of the view camera's position | -
wview | -Real | -The width of the view's camera | -
hview | -Real | -The height of the view's camera | -
hspeed | -Real | -The horizontal movement speed of the view | -
vspeed | -Real | -The vertical movement speed of the view | -
xport | -Real | -The x position on screen where the view is drawn | -
yport | -Real | -The y position on screen where the view is drawn | -
wport | -Real | -The width of the viewport | -
hport | -Real | -The height of the viewport | -
object | -Object Asset | -The object of which the first instance in the room should be followed by the camera | -
hborder | -Real | -The horizontal border around the instance of the object to follow | -
vborder | -Real | -The vertical border around the instance of the object to follow | -
This type of struct represents one element in a layer.
-These structs are found in the elements array, which is part of a layer struct.
-Variable Name | -Data Type | -Description | -
---|---|---|
All Element Types | -||
id | -Real | -The unique ID of the element | -
type | -Layer Element Type Constant | -The type of element | -
Background Element Type | -||
sprite_index | -Sprite Asset | -The sprite used by the background | -
image_index | -Real | -The sprite's subimage | -
xscale | -Real | -The scale along the x axis | -
yscale | -Real | -The scale along the y axis | -
htiled | -Boolean | -Whether to tile the background image horizontally | -
vtiled | -Boolean | -Whether to tile the background image vertically | -
stretch | -Boolean | -Whether to stretch the background so it fills the entire room | -
visible | -Boolean | -Whether the background should be visible | -
blendColour | -Colour | -The blend colour to draw the background with | -
blendAlpha | -Real | -The alpha value between 0 and 1 to use | -
image_speed | -Real | -The image speed of the background | -
speed_type | -Sprite Speed Constant | -The units in which image_speed is expressed, either spritespeed_framespersecond or spritespeed_framespergameframe | -
name | -String | -The name of the background | -
Instance Element Type | -||
inst_id | -Object Instance | -The ID of the instance | -
Sprite Element Type | -||
sprite_index | -Sprite Asset | -The sprite index of this sprite element | -
image_index | -Real | -The subimage of the sprite | -
x | -Real | -The x coordinate of the sprite's position | -
y | -Real | -The y coordinate of the sprite's position | -
image_xscale | -Real | -The scale of the image along the x axis | -
image_yscale | -Real | -The scale of the image along the y axis | -
image_angle | -Real | -The image angle | -
image_alpha | -Real | -The alpha value between 0 and 1 | -
image_blend | -Colour | -The blend colour | -
image_speed | -Real | -The animation speed of the image, expressed in speed_type units | -
speed_type | -Sprite Speed Constant | -The units in which image_speed is expressed, either spritespeed_framespersecond or spritespeed_framespergameframe | -
name | -String | -The name of the sprite element as given in The Room Editor (default is graphic_*) | -
Tile Map Element Type | -||
x | -Real | -The x position (or offset) of the tile map in the room | -
y | -Real | -The y position (or offset) of the tile map in the room | -
tileset_index | -Tile Set Asset | -The tile set that this tile map uses | -
data_mask | -Real | -The bitmask value for the tile map | -
tiles | -Array of Real | -This variable is only present when the tilemap_data parameter is set to true. It is a one-dimensional array that contains all the tile map data, listed row by row. | -
width | -Real | -The width in cells of the tile map | -
height | -Real | -The height in cells of the tile map | -
name | -String | -The tile map's name | -
Particle System Element Type | -||
ps | -Particle System Asset | -The particle system | -
x | -Real | -The x coordinate of the particle system's position | -
y | -Real | -The y coordinate of the particle system's position | -
angle | -Real | -The angle by which the particle system is rotated | -
xscale | -Real | -The scale along the x axis of the particle system | -
yscale | -Real | -The scale along the y axis of the particle system | -
blend | -Colour | -The blend colour to use to draw the particle system | -
alpha | -Real | -The alpha value between 0 and 1 to use | -
name | -String | -The name of the particle system element as defined in The Room Editor (default is particle_*) | -
Tile Element Type | -||
visible | -Boolean | -Whether the tile is visible | -
sprite_index | -Sprite Asset | -The sprite this tile is on | -
x | -Real | -The x coordinate of the tile position | -
y | -Real | -The y coordinate of the tile position | -
width | -Real | -The width of the tile | -
height | -Real | -The height of the tile | -
image_xscale | -Real | -The scale factor along the x axis of the tile | -
image_yscale | -Real | -The scale factor along the y axis of the tile | -
image_angle | -Real | -The angle of the tile | -
image_blend | -Colour | -The blend colour to use to draw the tile | -
image_alpha | -Real | -The alpha to use | -
xo | -Real | -The x offset | -
yo | -Real | -The y offset | -
Sequence Element Type | -||
x | -Real | -The x coordinate of the sequence position | -
y | -Real | -The y coordinate of the sequence position | -
image_xscale | -Real | -The scale along the x axis of the entire sequence | -
image_yscale | -Real | -The scale along the y axis of the entire sequence | -
image_angle | -Real | -The angle by which the sequence is rotated | -
image_alpha | -Real | -The alpha value between 0 and 1 to use | -
image_blend | -Colour | -The blend colour to use to draw the sequence | -
image_speed | -Real | -The animation speed of the sequence, expressed in speed_type units | -
speedType | -Sprite Speed Constant | -The units in which image_speed is expressed, either spritespeed_framespersecond or spritespeed_framespergameframe | -
seq_id | -Sequence Asset | -The sequence asset | -
name | -String | -The name of the sequence element as defined in The Room Editor (default is graphic_*) | -
head_position | -Real | -The playhead position of the sequence | -
-
room_get_info(room, [views], [instances], [layers], [layer_elements], [tilemap_data]);
-Variable Name | +Data Type | +Description | +
---|---|---|
width | +Real | +The width of the room | +
height | +Real | +The height of the room | +
creationCode | +Script Function | +The index of the script function that contains this room's creation code | +
physicsWorld | +Boolean | +Whether the room has a physics world | +
physicsGravityX | +Real | +The physics world's gravity component along the x axis | +
physicsGravityY | +Real | +The physics world's gravity component along the y axis | +
physicsPixToMeters | +Real | +The physics world's pixel-to-metre scale | +
persistent | +Boolean | +Whether the room is persistent | +
enableViews | +Boolean | +Whether views are enabled for the room | +
clearDisplayBuffer | +Boolean | +Whether to clear the display buffer before drawing the room | +
clearViewportBackground | +Boolean | +Whether to clear viewports' backgrounds before drawing to them | +
colour | +Colour | +The clear colour used when clearDisplayBuffer is set to true | +
instances | +Array of Room Instance Info Struct | +An array listing all instances placed in the room with basic information on them | +
layers | +Array of Room Layer Info Struct | +An array listing all room layers, in order of increasing depth | +
views | +Array of Room View Info Struct | +An array listing all views, ordered by view index | +
This type of struct represents one instance in the room.
+These structs are found in the instances array, which is part of the main struct returned by the function.
+Variable Name | +Data Type | +Description | +
---|---|---|
id | +Object Instance | +The instance ID | +
object_index | +String | +The name of the object this is an instance of (use asset_get_index to get the actual object) | +
x | +Real | +The x coordinate of the instance's position | +
y | +Real | +The y coordinate of the instance's position | +
xscale | +Real | +The x scale of the instance | +
yscale | +Real | +The y scale of the instance | +
angle | +Real | +The rotation angle of the instance | +
image_index | +Real | +The image index used by the instance | +
image_speed | +Real | +The image speed of the instance | +
colour | +Colour | +The blend colour used to draw the instance | +
creation_code | +Script Function | +The index of the script function that contains the instance's creation code | +
pre_creation_code | +Script Function | +The index of the script function that holds the pre-creation code for this specific instance, i.e. the overrides for its Object Variables as set in the Room Editor. See: Pre-creation Code | +
This type of struct represents one layer in the room.
+These structs are found in the layers array, which is part of the main struct returned by the function.
+Argument | -Type | +Variable Name | +Data Type | Description | |
---|---|---|---|---|---|
room | -Room Asset | -The room to get the info from | +id | +Real | +The layer handle | +
name | +String | +The name of the layer | +|||
visible | +Boolean | +Whether the layer is visible | +|||
depth | +Real | +The depth of the layer | +|||
xoffset | +Real | +The x offset of the layer | +|||
yoffset | +Real | +The y offset of the layer | +|||
hspeed | +Real | +The horizontal speed of the layer | +|||
vspeed | +Real | +The vertical speed of the layer | +|||
effectEnabled | +Boolean | +Whether the layer filter/effect is currently enabled | +|||
effectToBeEnabled | +Boolean | +Whether the layer filter/effect should be enabled/disabled in the next frame (the next value of effectEnabled) | +|||
effect | +FX Struct | +A struct containing the effect's parameters (-1 if no layer effect is set) | +|||
shaderID | +Shader Asset | +The shader to be applied to the layer (layer_shader) | +|||
elements | +Array of Room Layer Element Info Struct | +An array listing all elements on the layer. Each element type struct contains information specific to it. | +
This type of struct represents one view in the room.
+These structs are found in the views array, which is part of the main struct returned by the function.
+Variable Name | +Data Type | +Description | +
---|---|---|
visible | +Boolean | +Whether the view is visible | +
cameraID | +Camera ID | +The camera assigned to this view | +
xview | +Real | +The x coordinate of the view camera's position | +
yview | +Real | +The y coordinate of the view camera's position | +
wview | +Real | +The width of the view's camera | +
hview | +Real | +The height of the view's camera | +
hspeed | +Real | +The horizontal movement speed of the view | +
vspeed | +Real | +The vertical movement speed of the view | +
xport | +Real | +The x position on screen where the view is drawn | +
yport | +Real | +The y position on screen where the view is drawn | +
wport | +Real | +The width of the viewport | +
hport | +Real | +The height of the viewport | +
object | +Object Asset | +The object of which the first instance in the room should be followed by the camera | +
hborder | +Real | +The horizontal border around the instance of the object to follow | +
vborder | +Real | +The vertical border around the instance of the object to follow | +
This type of struct represents one element in a layer.
+These structs are found in the elements array, which is part of a layer struct.
+Variable Name | +Data Type | +Description | +|||
---|---|---|---|---|---|
All Element Types | +|||||
id | +Real | +The unique ID of the element | +|||
type | +Layer Element Type Constant | +The type of element | +|||
Background Element Type | +|||||
sprite_index | +Sprite Asset | +The sprite used by the background | +|||
image_index | +Real | +The sprite's subimage | +|||
xscale | +Real | +The scale along the x axis | +|||
yscale | +Real | +The scale along the y axis | +|||
htiled | +Boolean | +Whether to tile the background image horizontally | +|||
vtiled | +Boolean | +Whether to tile the background image vertically | +|||
stretch | +Boolean | +Whether to stretch the background so it fills the entire room | +|||
visible | +Boolean | +Whether the background should be visible | +|||
blendColour | +Colour | +The blend colour to draw the background with | +|||
blendAlpha | +Real | +The alpha value between 0 and 1 to use | +|||
image_speed | +Real | +The image speed of the background | +|||
speed_type | +Sprite Speed Constant | +The units in which image_speed is expressed, either spritespeed_framespersecond or spritespeed_framespergameframe | +|||
name | +String | +The name of the background | +|||
Instance Element Type | +|||||
inst_id | +Object Instance | +The ID of the instance | +|||
Sprite Element Type | +|||||
sprite_index | +Sprite Asset | +The sprite index of this sprite element | +|||
image_index | +Real | +The subimage of the sprite | +|||
x | +Real | +The x coordinate of the sprite's position | +|||
y | +Real | +The y coordinate of the sprite's position | +|||
image_xscale | +Real | +The scale of the image along the x axis | +|||
image_yscale | +Real | +The scale of the image along the y axis | +|||
image_angle | +Real | +The image angle | +|||
image_alpha | +Real | +The alpha value between 0 and 1 | +|||
image_blend | +Colour | +The blend colour | +|||
image_speed | +Real | +The animation speed of the image, expressed in speed_type units | +|||
speed_type | +Sprite Speed Constant | +The units in which image_speed is expressed, either spritespeed_framespersecond or spritespeed_framespergameframe | +|||
name | +String | +The name of the sprite element as given in The Room Editor (default is graphic_*) | +|||
Tile Map Element Type | +|||||
x | +Real | +The x position (or offset) of the tile map in the room | +|||
y | +Real | +The y position (or offset) of the tile map in the room | +|||
tileset_index | +Tile Set Asset | +The tile set that this tile map uses | +|||
data_mask | +Real | +The bitmask value for the tile map | +|||
tiles | +Array of Real | +This variable is only present when the tilemap_data parameter is set to true. It is a one-dimensional array that contains all the tile map data, listed row by row. | +|||
width | +Real | +The width in cells of the tile map | +|||
height | +Real | +The height in cells of the tile map | +|||
name | +String | +The tile map's name | +|||
Particle System Element Type | +|||||
ps | +Particle System Asset | +The particle system | +|||
x | +Real | +The x coordinate of the particle system's position | +|||
y | +Real | +The y coordinate of the particle system's position | +|||
angle | +Real | +The angle by which the particle system is rotated | +|||
xscale | +Real | +The scale along the x axis of the particle system | +|||
yscale | +Real | +The scale along the y axis of the particle system | +|||
blend | +Colour | +The blend colour to use to draw the particle system | +|||
alpha | +Real | +The alpha value between 0 and 1 to use | +|||
name | +String | +The name of the particle system element as defined in The Room Editor (default is particle_*) | +|||
Tile Element Type | +|||||
visible | +Boolean | +Whether the tile is visible | +|||
sprite_index | +Sprite Asset | +The sprite this tile is on | +|||
x | +Real | +The x coordinate of the tile position | +|||
y | +Real | +The y coordinate of the tile position | +|||
width | +Real | +The width of the tile | +|||
height | +Real | +The height of the tile | +|||
image_xscale | +Real | +The scale factor along the x axis of the tile | +|||
image_yscale | +Real | +The scale factor along the y axis of the tile | +|||
image_angle | +Real | +The angle of the tile | +|||
image_blend | +Colour | +The blend colour to use to draw the tile | +|||
image_alpha | +Real | +The alpha to use | +|||
xo | +Real | +The x offset | +|||
yo | +Real | +The y offset | +|||
Sequence Element Type | +|||||
x | +Real | +The x coordinate of the sequence position | +|||
y | +Real | +The y coordinate of the sequence position | +|||
image_xscale | +Real | +The scale along the x axis of the entire sequence | +|||
image_yscale | +Real | +The scale along the y axis of the entire sequence | +|||
image_angle | +Real | +The angle by which the sequence is rotated | +|||
image_alpha | +Real | +The alpha value between 0 and 1 to use | +|||
image_blend | +Colour | +The blend colour to use to draw the sequence | |||
views | -Boolean | -Whether to include view information in the struct (defaults to true) | +image_speed | +Real | +The animation speed of the sequence, expressed in speed_type units |
instances | -Boolean | -Whether to include instance information in the struct (defaults to true) | +speedType | +Sprite Speed Constant | +The units in which image_speed is expressed, either spritespeed_framespersecond or spritespeed_framespergameframe |
layers | -Boolean | -Whether to include layer information in the struct (defaults to true) | +seq_id | +Sequence Asset | +The sequence asset |
layer_elements | -Boolean | -Whether to include layer element information in the struct (defaults to true, requires layers to be set to true) | +name | +String | +The name of the sequence element as defined in The Room Editor (default is graphic_*) |
tilemap_data | -Boolean | -Whether to include tile map data in the struct (defaults to true, requires layers and layer_elements to be set to true) | +head_position | +Real | +The playhead position of the sequence |
-
-
var _info = room_get_info(Room1);
-
- var _info_json = json_stringify(_info, true);
-
- show_debug_message(_info_json);
The above code gets the information of the room Room1, converts the returned struct to a JSON string using json_stringify, then outputs it in a debug message. All view, instance, layer, layer element and tile map information is included in the output.
--
-