过时的函数

在将 GameMaker 与产品的旧版本进行比较时,您可以在此处找到已过时的所有功能的列表。 当您导入使用旧版本制作的 *.yyz 时,此处列出的函数将转换为兼容性脚本,您可以像以前一样继续处理该项目。 但是,我们建议您修改项目中创建的所有兼容性脚本,并确保未来的项目使用新的函数/工作方式,而不是依赖于这些脚本。

背景背景

在旧版 GameMaker 中,您有一个单独的背景资源,您可以在其中添加要用作背景的图像。 在 GameMaker 中,所有图像都被视为精灵,您放置它们的用途也将取决于它们在房间中分配到的图层。 这意味着不再有“背景”资源,也意味着以下函数已过时:

draw_backgrounddraw_background_extdraw_background_
stretched
draw_background_
stretched_ext
draw_background_
part
draw_background_
part_ext
draw_background_
general
draw_background_
tiled
draw_background_
tiled_ext
background_namebackground_existsbackground_get_
name
draw_backgrounddraw_background_extdraw_background_
stretched
draw_background_
stretched_ext
background_get_
width
background_get_
height
background_get_
transparent
background_get_
smooth
background_get_
preload
background_get_uvsbackground_get_
texture
background_set_alpha_
from_background
background_create_
from_surface
background_create_
color
background_create_
colour
background_create_
gradient
background_addbackground_replacebackground_add_
alpha
background_replace_
alpha
background_deletebackground_duplicatebackground_assignbackground_save
background_prefetchbackground_
prefetch_multi
background_flushbackground_flush_
multi
room_set_backgroundroom_set_
background_colour
 

旧版GameMaker也有许多访问全局背景数组的不同背景变量。这些在GameMaker中不再需要:

background_
index[0..7]
background_
visible[0..7]
background_
alpha[0..7]
background_
blend[0..7]
background_x[0..7]background_y[0..7]background_
colour
background_
showcolour
background_
foreground[0..7]
background_
hspeed[0..7]
background_
vspeed[0..7]
background_
htiled[0..7]
background_
vtiled[0..7]
background_
width[0..7]
background_
height[0..7]
background_
xscale[0..7]
background_
yscale[0..7]

您可以从房间编辑器一节中了解更多关于 背景层 的信息,并查看 背景层 了解更多关于使用代码控制背景层的函数的信息。

 

TilesTiles

就像前面解释的背景一样,来自过时 GameMaker 的 tile 资源不再存在,取而代之的是我们在 GameMaker 中有 TileSets。在过时的 GameMaker 中,图块使用背景资源,并通过房间编辑器或代码放置在不同的深度,然而所使用的方法并不灵活,也不是很有效。为了解决这些问题,在 GameMaker 中,现在从一个精灵资源创建图块集,并且可以有各种不同的属性 (如动画或自动图块)。然后它们被放置在房间编辑器或通过代码的图块图层上。由于这些变化,下列功能现已过时:

tile_get_xtile_get_ytile_get_lefttile_get_top
tile_get_widthtile_get_heighttile_get_depthtile_get_visible
tile_get_xscaletile_get_yscaletile_get_alphatile_get_background
tile_set_visibletile_set_backgroundtile_set_regiontile_set_position
tile_set_depthtile_set_scaletile_set_blendtile_set_alpha
tile_get_counttile_get_idtile_get_idstile_get_ids_at_depth
tile_addtile_existstile_deletetile_layer_hide
tile_layer_showtile_layer_deletetile_layer_shifttile_layer_find
tile_layer_delete_attile_layer_depthroom_tile_addroom_tile_add_ext
room_tile_clear

您可以从Tile Set 编辑器的手册部分了解更多关于Tile Sets的信息,也可以从Tile Layers部分了解如何在房间编辑器中使用它们。有关使用代码控制后台层的函数的更多信息,请参见Tilemap layers。同样值得注意的是,GameMaker语言有一些与在导入项目中使用遗留贴图相关的特定函数,你可以在这里找到关于这些的信息。

 

对象对象

由于在房间编辑器中引入了层, GameMaker 中处理对象的方式略有改变。仍然存在“深度”变量,但它现在只用于兼容性,您不能再获取或设置对象的深度,只能获取或设置实例。这使得以下函数过时:

object_get_depth
object_set_depth

可以从对象编辑器的手册部分和使用对象部分的代码控制对象的函数中了解有关对象资源的更多信息。

 

声音

过时的GameMaker有两个不同的声音API,一个使用已弃用的sound_函数(这只适用于HTML5目标平台),另一个使用audio_函数。音频API在GameMaker中得到了改进和扩展,使以下列出的遗留功能过时:

sound_namesound_existssound_get_namesound_get_kind
sound_get_preloadsound_existssound_restoresound_delete
sound_playsound_loopsound_stopsound_stop_all
sound_isplayingsound_volumesound_fadesound_global_volume
audio_music_gainaudio_music_is_playingaudio_new_systemaudio_old_system
audio_pause_musicaudio_play_musicaudio_resume_musicaudio_stop_music
audio_system

您可以从声音编辑器上的手册部分和使用音频上的代码控制音频的函数部分了解有关音频资源的更多信息。

 

D3DD3D

当在遗留的GameMaker中使用3D模型或原语时,你必须使用d3d_函数。这些游戏使用的是过时的绘制API,并且在许多情况下与Direct 3D API并不严格相关,甚至与使用3D本身并不相关。随着GameMaker中顶点缓冲区、矩阵和摄像机的出现,以下函数已经过时:

d3d_startd3d_endd3d_set_perspectived3d_set_hidden
d3d_set_depthd3d_set_lightingd3d_set_shadingd3d_set_fog
d3d_set_cullingd3d_set_zwriteenabled3d_set_projectiond3d_set_projection_ext
d3d_set_projection_
ortho
d3d_set_projection_
perspective
d3d_transform_set_
identity
d3d_transform_
set_translation
d3d_transform_set_
scaling
d3d_transform_
set_rotation_x
d3d_transform_set_
rotation_y
d3d_transform_
set_rotation_z
d3d_transform_set_
rotation_axis
d3d_transform_
add_translation
d3d_transform_add_
scaling
d3d_transform_
add_rotation_x
d3d_transform_add_
rotation_y
d3d_transform_
add_rotation_z
d3d_transform_add_
rotation_axis
d3d_transform_
stack_clear
d3d_transform_stack_
empty
d3d_transform_
stack_push
d3d_transform_stack_
pop
d3d_transform_
stack_top
d3d_transform_stack_
discard
d3d_transform_vertexd3d_light_define_
ambient
d3d_light_define_
direction
d3d_light_define_pointd3d_light_enabled3d_primitive_begind3d_primitive_
begin_texture
d3d_primitive_endd3d_vertexd3d_vertex_colord3d_vertex_colour
d3d_vertex_textured3d_vertex_texture_
color
d3d_vertex_texture_
colour
d3d_vertex_normal
d3d_vertex_normal_
color
d3d_vertex_normal_
colour
d3d_vertex_normal_
texture
d3d_vertex_normal_
texture_color
d3d_vertex_normal_
texture_colour
d3d_draw_blockd3d_draw_cylinderd3d_draw_cone
d3d_draw_ellipsoidd3d_draw_walld3d_draw_floord3d_model_create
d3d_model_destroyd3d_model_cleard3d_model_loadd3d_model_save
d3d_model_drawd3d_model_primitive_
begin
d3d_model_
primitive_end
d3d_model_vertex
d3d_model_vertex_
color
d3d_model_vertex_
colour
d3d_model_
vertex_texture
d3d_model_vertex_
texture_color
d3d_model_vertex_
texture_colour
d3d_model_vertex_
normal
d3d_model_
vertex_normal_color
d3d_model_vertex_
normal_colour
d3d_model_vertex_
normal_texture
d3d_model_vertex_
normal_texture_color
d3d_model_vertex_
normal_texture_colour
d3d_model_block
d3d_model_cylinderd3d_model_coned3d_model_ellipsoidd3d_model_wall
d3d_model_floor

你可以在这里找到更多关于顶点缓冲区的信息,在这里找到更多关于矩阵的信息,在这里找到更多关于相机 的信息,在这里找到更多关于GPU函数的信息。

 

视图变量和窗口函数视图变量和窗口函数

随着GameMaker中的摄像机函数的出现,这意味着许多视图变量不再需要,特别是那些指向进入房间的视图而不是view_port的视图变量(仍然在使用)。还有一些控制内容显示的功能,在gamemaker的旧版本中是可用的,但现在也不合适了。下面列出了这些变量和函数:

view_objectview_angleview_xviewview_yview
view_hviewview_wviewview_hborderview_vborder
view_hspeedview_vspeeddisplay_set_windows_
vertex_buffer_method
display_get_windows_
vertex_buffer_method
display_set_windows_
alternate_sync
display_get_windows_
alternate_sync
room_set_view

你可以从相机和显示的手册部分找到更多关于相机的信息。

 

第三方支持

GameMaker 将大量以前版本的内置功能移植到扩展中,这意味着以下第三方支持功能被认为是过时的:

ads_enableads_disableads_moveads_get_display_
width
ads_get_display_
height
ads_interstitial_
available
ads_interstitial_
display
ads_setup
ads_engagement_
available
ads_engagement_
launch
ads_engagement_
active
ads_event
ads_event_preloadads_set_reward_
callback
playhaven_add_
notification_badge
playhaven_hide_
notification_badge
playhaven_position_
notification_badge
playhaven_update_
notification_badge
pocketchange_display_
reward
pocketchange_display_
shop
analytics_eventanalytics_event_extfacebook_initfacebook_login
facebook_request_
publish_permissions
facebook_request_
read_permissions
facebook_check_
permission
facebook_status
facebook_accesstokenfacebook_user_idfacebook_graph_
request
facebook_dialog
facebook_send_invite  facebook_post_
message   
facebook_logout facebook_launch_
offerwall  
iap_event_queue iap_files_purchased iap_is_downloaded iap_product_files 
iap_product_status iap_store_status iap_dataiap_activate
iap_statusiap_enumerate_productsiap_restore_alliap_acquire
iap_consumeiap_product_detailsiap_purchase_details 
immersion_play_effectimmersion_stop
achievement_*win8_*uwp_appbar_*

你可以从 市场页面 获得我们的广告和其他api的官方扩展。

 

GML 可视化操作 GML 可视化操作

旧版 GameMaker 和新版 GameMaker 都具有用于创建游戏的可视脚本 GML 可视化 界面,但 GameMaker 中的处理方式与以前使用的方法大不相同。以前,所有 GML 可视化动作都有自己的相应功能,这些功能在 "幕后" 工作以获得期望的结果,但这并不是非常透明,并给函数调用增加了额外的开销,导致性能较差。在 GameMaker 中,此动作已更改,现在所有操作都将编译为纯代码 (如果需要,可以显示为纯代码),这意味着以下操作功能已过时:

action_path_oldaction_set_spriteaction_draw_fontaction_draw_font_old
action_fill_coloraction_fill_colouraction_line_coloraction_line_colour
action_highscoreaction_set_relativeaction_moveaction_set_motion
action_set_hspeedaction_set_vspeedaction_set_gravityaction_set_friction
action_move_pointaction_move_toaction_move_startaction_move_random
action_snapaction_wrapaction_reverse_xdiraction_reverse_ydir
action_move_contactaction_bounceaction_pathaction_path_end
action_path_positionaction_path_speedaction_linear_stepaction_potential_step
action_kill_objectaction_create_objectaction_create_object_motionaction_create_object_random
action_change_objectaction_kill_positionaction_sprite_setaction_sprite_transform
action_sprite_coloraction_sprite_colouraction_soundaction_end_sound
action_if_soundaction_another_roomaction_current_roomaction_previous_room
action_next_roomaction_if_previous_roomaction_if_next_roomaction_set_alarm
action_sleepaction_set_timelineaction_timeline_setaction_timeline_start
action_timeline_stopaction_timeline_pauseaction_set_timeline_positionaction_set_timeline_speed
action_messageaction_show_infoaction_show_videoaction_end_game
action_restart_gameaction_save_gameaction_load_gameaction_replace_sprite
action_replace_soundaction_replace_
background
action_if_emptyaction_if_collision
action_ifaction_if_numberaction_if_objectaction_if_question
action_if_diceaction_if_mouseaction_if_alignedaction_execute_script
action_inheritedaction_if_variableaction_draw_variableaction_set_score
action_if_scoreaction_draw_scoreaction_highscore_showaction_highscore_clear
action_set_lifeaction_if_lifeaction_draw_lifeaction_draw_life_images
action_set_healthaction_if_healthaction_draw_healthaction_set_caption
action_partsyst_createaction_partsyst_destroyaction_partsyst_clearaction_parttype_create_old
action_parttype_createaction_parttype_coloraction_parttype_colouraction_parttype_life
action_parttype_speedaction_parttype_gravityaction_parttype_secondaryaction_partemit_create
action_partemit_destroyaction_partemit_burstaction_partemit_streamaction_cd_play
action_cd_stopaction_cd_pauseaction_cd_resumeaction_cd_present
action_cd_playingaction_set_cursoraction_webpageaction_splash_web
action_draw_spriteaction_draw_backgroundaction_draw_textaction_draw_text_transformed
action_draw_rectangleaction_draw_gradient_horaction_draw_gradient_vertaction_draw_ellipse
action_draw_
ellipse_gradient
action_draw_lineaction_draw_arrowaction_color
action_colouraction_fontaction_fullscreenaction_snapshot
action_effect

您可以从 GML 可视化 的手册部分了解有关新 GML 可视化的详细信息。

 

矢量和矩阵矢量和矩阵

GameMaker 中用于存储向量和矩阵的数据类型是数组. 因此,删除了以下与使用向量和矩阵有关的函数: 

is_vec3is_vec4is_matrix

这些函数似乎检查特定类型,而底层类型始终是数组或数组范围 (长度分别为 3、4 和 16)。例如,函数 matrix_build 和 matrix_build_identity 返回的 矩阵 ,其中的 16 个元素以 数组 数据类型存储。要检查数据类型,您应该使用 is_array ,并将其与 array_length 给出的数组长度组合,以计算出数据类型。

注意 检查数组数据类型及其长度并不意味着实际内容表示有效的向量或矩阵。

或者,要存储向量和矩阵,您可以使用 GameMaker 提供的其他数据结构,例如缓冲区DS 网格作为结构,甚至使用表面来存储相同的信息,而不是使用专用的数据类型。

 

以下内置的全局变量也已过时,尽管它们在 GML 中仍被认为是保留变量,以便 IDE 能够识别它们,并在导入使用它们的遗留项目时标记它们以便更新/删除(上面视图和背景部分中列出的变量也是如此) :

gamemaker_registeredgamemaker_progamemaker_
version
secure_mode
show_healthshow_scoreshow_lives
caption_scorecaption_livescaption_health
argument_relativeroom_captionroom_speed
transition_stepstransition_kindgame_guid
error_lasterror_occurredbuffer_surface_copy