GameMaker Studio 2[场景编辑器](场景编辑器.md)允许您使用层在任何给定的场景中添加瓷片。顾名思义,tilemap层就是一组瓷片集合,它们在一个场景内被定义在同一深度,并且可以通过叠加层来控制不同元素的相互覆盖关系。您还可以利用代码在游戏运行过程中动态控制层的某些属性,进行添加或删除操作,甚至是修改图层所包含的元素。请注意,在房间编辑器中,每个层(Tile层)限制只能有一个瓷片集(tilemap),但是用代码控制则没有这种限制,您可以将多个瓷片集分配给一个单独的层,每个瓷片集都会具有自己惟一的ID和属性,因此:
* tile set是用来创建tile layers和tilemaps的资源。
* tile layer是您在房间编辑器中创建的,用来添加tilesets的图层。
* tilemap是您所在房间编辑器或代码中添加到一个层内的tile的集合,一整个tilemap是层上的一个独立元素。
下面列出了可以用于编辑tilemap图层的所有功能:
* layer_tilemap_get_id
* layer_tilemap_exists
* layer_tilemap_create
* layer_tilemap_destroy
* tilemap_tileset
* tilemap_clear
* tilemap_x
* tilemap_y
* tilemap_set
* tilemap_set_at_pixel
* tilemap_set_mask
* tilemap_set_global_mask
* tilemap_get_mask
* tilemap_get_global_mask
* tilemap_get_tileset
* tilemap_get_frame
* tilemap_get_tile_width
* tilemap_get_tile_height
* tilemap_get_width
* tilemap_get_height
* tilemap_get_x
* tilemap_get_y
* tilemap_get
* tilemap_get_at_pixel
* tilemap_get_cell_x_at_pixel
* tilemap_get_cell_y_at_pixel
* draw_tilemap
## 瓷片函数(Tile Functions)
Apart from the functions listed above to set tilemaps, you also have a number of functions that can be used to manipulate the data of individual tiles. A "blob" of tile data is made up of the tile index plus a few extra bits to show whether the tile has been rotated, flipped or mirrored. You also have the possibility of adding your own bitmask to the tile data, although this is for advanced users only as you will be masking off bits that are reserved for the tile index - essentially there are 19 bits reserved for your tile indices, but if you only use 8 of them, then you have eleven bits left over that can be used to create a custom mask. This mask can then be used and checked in code to create custom tile collisions or whatever. However, you would normally not need to create your own tiledata blobs, and would instead use the function tilemap_get to get the tiledata, then you would manipulate it using the functions below, and then you would set it again using tilemap_set.
除了上述用于设置瓷片集(tilemap)的函数之外,你还可以使用函数来操作单个瓷片(tiles)。单个瓷片图像“blob”是由瓷片索引及一些额外属性构成的,这些额外属性会标识瓷片是否旋转、垂直翻转或水平镜像翻转等。你还可以添加自己的位掩码(bitmask)标识,当然这是给有进阶功能需求的用户使用的,你可以屏蔽掉瓷片索引所使用的掩码位——理论上一共有19位可以用于索引标识,如果你只用了其中的8位,那就还剩下11位可以用来自定义掩码。你可以用这个自定义掩码来检查瓷片碰撞等你需要的特定功能。但是通常来说你不用自己创建瓷片单元,而是直接用“tilemap_get”函数来获取瓷片数据(tiledata),然后用下述函数来进行相关操作,最后用“tilemap_set”来设置并使用它。
以下为用于编辑tiles的函数列表:
* tile_get_empty
* tile_get_index
* tile_get_flip
* tile_get_mirror
* tile_get_rotate
* tile_set_empty
* tile_set_index
* tile_set_flip
* tile_set_mirror
* tile_set_rotate
* draw_tile
* draw_tile_ext
- 介绍
- 新手须知
- 版本授权
- 安装
- 更新
- 发布日志
- 所需SDK
- 账号
- 首选项设置
- 拖拽编程
- 扩展编辑器设置
- 基本项设置
- 图片编辑器设置
- 语言设置
- 市场设置
- 对象编辑器设置
- 插件设置
- 资源树设置
- 场景编辑器设置
- 运行库设置
- 样条编辑器设置
- 精灵编辑器设置
- 文本编辑器设置
- 瓷片编辑器设置
- 时间轴设置
- 输入
- 快速上手
- 概览
- 启动页
- 工作区
- 资源树
- 工作流
- 创建精灵
- 创建瓷片集
- 创建音频
- 创建对象
- 创建场景
- 编译
- 调试
- 快捷键
- 菜单
- 文件菜单
- 编辑菜单
- 构建菜单
- 窗口菜单
- 工具菜单
- 市场菜单
- 帮助菜单
- 布局菜单
- 附加信息
- 位运算符和二进制
- 命令行
- 出错信息
- 文件系统
- 导入非位图精灵
- JSDoc使用
- 微型WEB服务端
- 过时函数
- 纹理页
- 使用缓冲区
- 编辑器
- 扩展编辑器
- 字体编辑器
- 图像编辑器
- 内含文件编辑器
- 备注编辑器
- 对象编辑器
- 路径编辑器
- 场景编辑器
- 脚本编辑器
- 着色器编辑器
- 音频编辑器
- 精灵编辑器
- 瓷片集编辑器
- 时间轴编辑器
- 对象可用事件
- 异步事件
- 绘制事件
- 手势事件
- 其它
- 调试管理器
- 设备管理器
- YoYo资源市场
- 输出停靠栏
- 项目图生成器
- 最近使用窗口
- 远程工作
- 混音器
- 版本控制
- 设置项
- 音频组
- 配置项
- 跨平台配置
- 纹理组
- 游戏配置选项
- AmazonFire 配置
- Android配置
- HTML5配置
- iOS配置
- Linux配置
- Mac配置
- Windows配置
- WindowsUWP配置
- 脚本编程
- 拖放编程概览
- 拖放编程功能索引
- GML概览
- 代码
- 数组
- array_create
- array_copy
- array_equals
- array_length_1d
- array_height_2d
- array_length_2d
- 赋值
- 表达式
- 数据存取
- 功能性语法
- 函数
- 脚本
- 注释
- 关键词
- 变量及作用域
- variable_global_exists
- variable_global_get
- variable_global_set
- variable_instance_exists
- variable_instance_get
- variable_instance_get_names
- variable_instance_set
- 寻址变量
- 评估顺序
- 数据类型
- is_array
- is_bool
- is_int32
- is_int64
- is_matrix
- is_ptr
- is_real
- is_string
- is_undefined
- is_vec3
- is_vec4
- 变元计数
- 指针
- 内置变量属性
- async_load
- health
- lives
- score
- GML函数索引
- asset_get_index
- asset_get_type
- Compatibility_Functions
- Asynchronous Functions
- Audio
- Buffers
- Cameras And Display (摄像机和显示)
- Cameras(摄像机)
- camera_apply
- camera_create
- camera_create_view
- camera_destroy
- camera_get_active
- camera_get_begin_script
- camera_get_default
- camera_get_end_script
- camera_get_proj_mat
- camera_get_update_script
- camera_get_view_angle
- camera_get_view_border_x
- camera_get_view_border_y
- camera_get_view_height
- camera_get_view_mat
- camera_get_view_speed_x
- camera_get_view_speed_y
- camera_get_view_target
- camera_get_view_width
- camera_get_view_x
- camera_get_view_y
- camera_set_begin_script
- camera_set_default
- camera_set_end_script
- camera_set_proj_mat
- camera_set_update_script
- camera_set_view_angle
- camera_set_view_border
- camera_set_view_mat
- camera_set_view_pos
- camera_set_view_size
- camera_set_view_speed
- camera_set_view_target
- view_camera
- view_current
- view_enabled
- view_get_camera
- view_get_hport
- view_get_surface_id
- view_get_visible
- view_get_wport
- view_get_xport
- view_get_yport
- view_hport
- view_set_camera
- view_set_hport
- view_set_surface_id
- view_set_visible
- view_set_wport
- view_set_xport
- view_set_yport
- view_surface_id
- view_visible
- view_wport
- view_xport
- view_yport
- The Screen Display
- Controls
- Data_Structures(数据结构)
- ds_exists
- ds_set_precision
- DS Grids
- DS Lists(列表)
- ds_list_create
- ds_list_destroy
- ds_list_clear
- ds_list_empty
- ds_list_size
- ds_list_add
- ds_list_set
- ds_list_delete
- ds_list_find_index
- ds_list_find_value
- ds_list_insert
- ds_list_replace
- ds_list_shuffle
- ds_list_sort
- ds_list_copy
- ds_list_read
- ds_list_write
- ds_list_mark_as_list
- ds_list_mark_as_map
- DS Maps(映射表)
- ds_map_exists
- ds_map_create
- ds_map_add
- ds_map_clear
- ds_map_copy
- ds_map_replace
- ds_map_delete
- ds_map_empty
- ds_map_size
- ds_map_find_first
- ds_map_find_last
- ds_map_find_next
- ds_map_find_previous
- ds_map_find_value
- ds_map_read
- ds_map_write
- ds_map_destroy
- ds_map_secure_save
- ds_map_secure_save_buffer
- ds_map_secure_load
- ds_map_secure_load_buffer
- ds_map_add_list
- ds_map_add_map
- ds_map_replace_list
- ds_map_replace_map
- DS Priority Queues
- DS Queues
- DS Stacks
- Debugging
- Drawing
- draw_enable_drawevent
- draw_flush
- Colour(颜色)
- colour_get_blue
- colour_get_green
- colour_get_hue
- colour_get_red
- colour_get_saturation
- colour_get_value
- draw_clear
- draw_clear_alpha
- draw_get_alpha
- draw_get_colour
- draw_getpixel
- draw_getpixel_ext
- draw_set_alpha
- draw_set_colour
- make_colour_hsv
- make_colour_rgb
- merge_colour
- Forms
- draw_arrow
- draw_button
- draw_circle
- draw_circle_colour
- draw_ellipse
- draw_ellipse_colour
- draw_healthbar
- draw_line
- draw_line_colour
- draw_line_width
- draw_line_width_colour
- draw_path
- draw_point
- draw_point_colour
- draw_rectangle
- draw_rectangle_colour
- draw_roundrect
- draw_roundrect_colour
- draw_roundrect_colour_ext
- draw_roundrect_ext
- draw_set_circle_precision
- draw_triangle
- draw_triangle_colour
- GPU
- gpu_get_alphatestenable
- gpu_get_alphatestref
- gpu_get_blendenable
- gpu_get_blendmode
- gpu_get_blendmode_dest
- gpu_get_blendmode_destalpha
- gpu_get_blendmode_ext
- gpu_get_blendmode_ext_sepalpha
- gpu_get_blendmode_src
- gpu_get_blendmode_srcalpha
- gpu_get_colorwriteenable
- gpu_get_cullmode
- gpu_get_fog
- gpu_get_state
- gpu_get_texfilter
- gpu_get_texfilter_ext
- gpu_get_texrepeat
- gpu_get_texrepeat_ext
- gpu_get_zfunc
- gpu_get_ztestenable
- gpu_get_zwriteenable
- gpu_pop_state
- gpu_push_state
- gpu_set_alphatestenable
- gpu_set_alphatestref
- gpu_set_blendenable
- gpu_set_blendmode
- gpu_set_blendmode_ext
- gpu_set_blendmode_ext_sepalpha
- gpu_set_colorwriteenable
- gpu_set_cullmode
- gpu_set_fog
- gpu_set_state
- gpu_set_texfilter
- gpu_set_texfilter_ext
- gpu_set_texrepeat
- gpu_set_texrepeat_ext
- gpu_set_zfunc
- gpu_set_ztestenable
- gpu_set_zwriteenable
- Lighting
- draw_get_lighting
- draw_light_define_ambient
- draw_light_define_direction
- draw_light_define_point
- draw_light_enable
- draw_light_get
- draw_light_get_ambient
- draw_set_lighting
- Mipmapping
- gpu_get_tex_max_aniso
- gpu_get_tex_max_aniso_ext
- gpu_get_tex_max_mip
- gpu_get_tex_max_mip_ext
- gpu_get_tex_min_mip
- gpu_get_tex_min_mip_ext
- gpu_get_tex_mip_bias
- gpu_get_tex_mip_bias_ext
- gpu_get_tex_mip_enable
- gpu_get_tex_mip_enable_ext
- gpu_get_tex_mip_filter
- gpu_get_tex_mip_filter_ext
- gpu_set_tex_max_aniso
- gpu_set_tex_max_aniso_ext
- gpu_set_tex_max_mip
- gpu_set_tex_max_mip_ext
- gpu_set_tex_min_mip
- gpu_set_tex_min_mip_ext
- gpu_set_tex_mip_bias
- gpu_set_tex_mip_bias_ext
- gpu_set_tex_mip_enable
- gpu_set_tex_mip_enable_ext
- gpu_set_tex_mip_filter
- gpu_set_tex_mip_filter_ext
- Particles
- Particle Emitters
- part_emitter_burst
- part_emitter_clear
- part_emitter_create
- part_emitter_destroy
- part_emitter_destroy_all
- part_emitter_exists
- part_emitter_region
- part_emitter_stream
- Particle Systems
- part_particles_clear
- part_particles_count
- part_particles_create
- part_particles_create_colour
- part_system_automatic_draw
- part_system_automatic_update
- part_system_clear
- part_system_create
- part_system_create_layer
- part_system_depth
- part_system_destroy
- part_system_draw_order
- part_system_drawit
- part_system_exists
- part_system_get_layer
- part_system_layer
- part_system_position
- part_system_update
- Particle Types
- part_type_alpha1
- part_type_alpha2
- part_type_alpha3
- part_type_blend
- part_type_clear
- part_type_colour_hsv
- part_type_colour_mix
- part_type_colour_rgb
- part_type_colour1
- part_type_colour2
- part_type_colour3
- part_type_create
- part_type_death
- part_type_destroy
- part_type_direction
- part_type_exists
- part_type_gravity
- part_type_life
- part_type_orientation
- part_type_scale
- part_type_shape
- part_type_size
- part_type_speed
- part_type_sprite
- part_type_step
- Simple Effects
- ef_cloud
- ef_ellipse
- ef_explosion
- ef_firework
- ef_flare
- ef_rain
- ef_ring
- ef_smoke
- ef_smokeup
- ef_snow
- ef_spark
- ef_star
- effect_clear
- effect_create_above
- effect_create_below
- Primitives(基本几何体)
- draw_primitve_begin
- draw_primitive_begin_texture
- draw_primitive_end
- draw_vertex
- draw_vertex_colour
- draw_vertex_texture
- draw_vertex_texture_colour
- Primitive Building
- vertex_argb
- vertex_begin
- vertex_colour
- vertex_create_buffer
- vertex_create_buffer_ext
- vertex_create_buffer_from_buffer
- vertex_create_buffer_from_buffer_ext
- vertex_delete_buffer
- vertex_end
- vertex_float1
- vertex_float2
- vertex_float3
- vertex_float4
- vertex_freeze
- vertex_get_buffer_size
- vertex_get_number
- vertex_normal
- vertex_position
- vertex_position_3d
- vertex_submit
- vertex_texcoord
- vertex_ubyte4
- Vertex Formats
- vertex_format_add_colour
- vertex_format_add_custom
- vertex_format_add_normal
- vertex_format_add_position
- vertex_format_add_position_3d
- vertex_format_add_textcoord
- vertex_format_begin
- vertex_format_delete
- vertex_format_end
- Sprites_and_Tiles
- draw_enable_swf_aa
- draw_get_swf_aa_level
- draw_self
- draw_set_swf_aa_level
- draw_skeleton
- draw_skeleton_collision
- draw_skeleton_instance
- draw_skeleton_time
- draw_sprite
- draw_sprite_ext
- draw_sprite_general
- draw_sprite_part
- draw_sprite_part_ext
- draw_sprite_pos
- draw_sprite_stretched
- draw_sprite_stretched_ext
- draw_sprite_tiled
- draw_sprite_tiled_ext
- draw_tile
- draw_tilemap
- Surfaces
- application_get_position
- application_surface
- application_surface_draw_enable
- application_surface_enable
- application_surface_is_enabled
- draw_surface
- draw_surface_ext
- draw_surface_general
- draw_surface_part
- draw_surface_part_ext
- draw_surface_stretched
- draw_surface_stretched_ext
- draw_surface_tiled
- draw_surface_tiled_ext
- surface_copy
- surface_copy_part
- surface_create
- surface_create_ext
- surface_exists
- surface_free
- surface_get_height
- surface_get_texture
- surface_get_width
- surface_getpixel
- surface_getpixel_ext
- surface_reset_target
- surface_resize
- surface_save
- surface_save_part
- surface_set_target
- surface_set_target_ext
- The Application Surface
- Text
- draw_highscore
- draw_set_font
- draw_set_halign
- draw_set_valign
- draw_text
- draw_text_colour
- draw_text_ext
- draw_text_ext_colour
- draw_text_ext_transformed
- draw_text_ext_transformed_colour
- draw_text_transformed
- draw_text_transformed_colour
- Textures
- draw_texture_flush
- texture_get_height
- texture_get_texel_height
- texture_get_texel_width
- texture_get_uvs
- texture_get_width
- texture_global_scale
- texture_set_stage
- File Handing
- Fonts
- Game
- In App Purchases
- Instances
- 数学运算(Maths)
- Date and Time
- 数字方法(Number Functions)
- Vector Functions
- Matrices
- Miscellaneous
- Movement and Collisions
- Networking
- Objects
- Paths
- Physics
- 场景(Rooms)
- 常规的场景函数及变量(General Room Functions And Varibales)
- 常规图层函数(General Layer Functions)
- 瓷片函数(TIlemap Tile Functions)
- 背景图层(Backgrounds)
- 精灵图层(Sprites)
- Scirpts
- Shaders
- Sprites
- Steam API
- Strings
- Timelines
- Web
- XBox_Live
- 翻译名词对照表