This section of the manual is a reference guide for the
GameMaker Studio 2 Language (GML). You can find all the
available functions documented here along with the required
arguments and examples of code to show how they can be used. For
information on how to use GML please see the GML Overview section of the
manual.
Managing
ResourcesGeneral Gameplay
This section contains the functions and variables that are all
related to game specific functionality, like loading/saving or
restarting etc…
- General Game Functions
Movement and
CollisionsGameMaker Studio 2 has a great number of ways in which
you can move instances around within your game room, ranging from
setting speed and direction vectors to simply «placing» an instance
at a specific position, as well as using more sophisticated methods
like path-finding. There are also a good number of different
methods for detecting collisions between two instances, and which
you choose will depend largely on the type of game you are making
and the exact situation that you need to use the collision
functions in. The following sections cover all of this and list all
the functions related to movement, path-finding and collisions:Movement
Motion
Planning
Collisions
Drawing
Cameras And The Display
The following sections contain all the functions and built in
variables that are used for setting up view cameras, view
ports and the game window, as well as setting the GUI
display for your game projects.Cameras
The Screen
Display
Control Functions
Data Structures
Variables And Arrays
The following sections list the functions for working with
instance and global variables as well as for working with arrays
(note that the variable functions are designed to be used when
converting DnD™ code to GML code or for use in compatibility
scripts more than for general use in new projects):Variable
Functions
Array Functions
Strings
The following sections contain all the functions and built in
variables that are used for working with strings:Strings
Maths And Numbers
Physics
In App Purchases
Asynchronous Functions
Networking
This section has all the functions related to creating networked
games (ie: games that communicate with each other over the
internet):Networking
Web
This section has functions specific to creating HTML5 web
applications as well as a few more general web functions for
opening URLs etc…Web
Steam
GameMaker Studio 2 is fully integrated with the Steamworks API so that you can create your games with
that platform in in mind, and integrate the different services that
it offers from day one of development. See the sections below for
more information:The Steam API
Steam User
Generated Content
File Handling
Buffers
Buffers enable you to directly access areas of memory, adding,
removing and saving information as raw data. Below you can find a
detailed explanation of what buffers are and how to use them as
well as all the functions related to them:Using
Buffers
Buffers
Xbox Live
The functions in this section are specifically for use with the
UWP target, and then only when using UWP to target the Xbox
One. The functions give you basic access to XBox Live features:UWP and Xbox
Live
Miscellaneous Game
FunctionsThis section contains a number of functions that are for doing
very specific things when creating your game and that don’t fit
exactly into any of the other function groups on this page:Miscellaneous
Debugging
Debugging your code is an essential part of making games and
apart from the tools provide by GameMaker Studio 2 (like the
Debug
Module), there are also a few extra functions to help you:Debugging
Please note that there are certain functions that have been
added to the IDE which will show up only in the
compatibility scripts when you import a game made with a
previous version of GameMaker Studio. These functions
should not be used and are only designed for compatibility.
The following section of the manual lists these functions so that
if you see them you know what they are, but please avoid using them
in your projects:
- Compatibility
Functions
Ad
At Career Karma, our mission is to empower users to make confident decisions by providing a trustworthy and free directory of bootcamps and career resources. We believe in transparency and want to ensure that our users are aware of how we generate revenue to support our platform.
Career Karma recieves compensation from our bootcamp partners who are thoroughly vetted before being featured on our website. This commission is reinvested into growing the community to provide coaching at zero cost to their members.
It is important to note that our partnership agreements have no influence on our reviews, recommendations, or the rankings of the programs and services we feature. We remain committed to delivering objective and unbiased information to our users.
In our bootcamp directory, reviews are purely user-generated, based on the experiences and feedback shared by individuals who have attended the bootcamps. We believe that user-generated reviews offer valuable insights and diverse perspectives, helping our users make informed decisions about their educational and career journeys.
Find the right bootcamp for you
X
Select Your Interest
Your exprience
Time to start
First name
Last Name
Phone Number
GET MATCHED
By completing and submitting this form, you agree that Career Karma, LLC may deliver or cause to be delivered
information, advertisements, and telemarketing messages regarding their services by email, call, text, recording, and
message using a telephone system, dialer, automated technology or system, artificial or prerecorded voice or message
device to your email and/or telephone number(s) (and not any other person’s email or telephone number) that you
entered. Consent is not a condition of receiving information, receiving Career Karma services, or using the website,
and you may obtain information by emailing
info@careerkarma.com. Message & Data rates may
apply. Message frequency may vary. Text STOP to unsubscribe.
Terms of Service
and
Privacy Policy
govern the processing and handling of your data.
X
By completing and submitting this form, you agree that Career Karma, LLC may deliver or cause to be delivered
information, advertisements, and telemarketing messages regarding their services by email, call, text, recording, and
message using a telephone system, dialer, automated technology or system, artificial or prerecorded voice or message
device to your email and/or telephone number(s) (and not any other person’s email or telephone number) that you
entered. Consent is not a condition of receiving information, receiving Career Karma services, or using the website,
and you may obtain information by emailing
info@careerkarma.com. Message & Data rates may
apply. Message frequency may vary. Text STOP to unsubscribe.
Terms of Service
and
Privacy Policy
govern the processing and handling of your data.
Добро пожаловать в список из 10 трюков и советов по GameMaker Studio 2. Независимо от того, знакомы ли вы уже с этим движком или только начали его изучать, можно узнать что-то новое.
#1 Ссылка на конкретный экземпляр объекта
Функции создания экземпляров, такие как instance_create_layer и instance_create_depth — одни из самых основных функций, которые разработчики используют в Game Maker. Но не все знают, что они возвращают идентификатор созданного экземпляра, который можно сохранить в переменную для дальнейшего его использования.
var inst;
inst = instance_create_depth(x, y, -10000, obj_Bullet);
with (inst) {
speed = other.shoot_speed;
direction = other.image_angle;
}
#2 Макросы и перечисления
Macros и Enums не нуждаются в вызове для инициализации — достаточно скрипта, в котором хранятся ваши макросы и энумераторы, и они будут загружены в ваш проект.
#3 Средняя кнопка мыши
Для экономии времени вы можете щёлкать средней кнопкой мыши на ресурс или функцию в редакторе кода. GMS2 откроет соответствующий объект или, если это функция, то страницу со справкой.
#4 Тернарные операторы в GameMaker Studio 2
GMS2 поддерживает тернарные операторы, которые предоставляют элегантный подход к условным выражениям: <условие>? <условие истинно>: <условие ложно>
// обычный подход
if (standingOnIce) {
friction = ice_friction;
}
else {
friction = default_friction;
}
// тернарная операция
friction = (standingOnIce ? ice_friction : default_friction);
#5 Сохранить результат выражения в переменной
Вместо использования оператора if вы можете заносить результат выражения сразу в переменную.
// обычный подход
if (abs(speed) > 0) {
moving = true;
}
else {
moving = false;
}
// занесение результата в переменную
moving = (abs(speed) > 0);
#6 Дельта-синхронизация в GameMaker
Дельта-синхронизация — это количество микросекунд, прошедших с последнего кадра. К примеру, вы можете связать перемещение с delta_time для обеспечения постоянной скорости движения на всех устройствах, независимо от частоты кадров.
var seconds_since_last_frame = (delta_time / 1000000); var distance_to_move_this_frame = (distance_per_second * seconds_since_last_frame); x += distance_to_move_this_frame;
#7 Поворот объекта «лицом» к курсору мыши
Простой пример, как постепенно поворачивать объект к курсору
var targetDirection = point_direction(x, y, mouse_x, mouse_y);
var angleDifference = angle_difference(image_angle, targetDirection);
var angleIncrement = 10;
image_angle -= (min(abs(angleDifference), angleIncrement) * sign(angleDifference));
#8 Использование Clamp
Вместо использования операторов if для ограничения значения переменной, вы можете использовать Clamp, что гораздо удобней и умещается в одну строку.
// обычный подход
if (spd > maxspd) {
spd = maxspd;
}
else if (spd < 0) {
spd = 0;
}
// метод с Clamp
spd = clamp(spd, 0, maxspd);
#9 Мигание текста или спрайта
Простой способ для мигания спрайта или текста с заданным интервалом:
///@desc blink(c_white, c_black, 0.5);
///@arg on_val
///@arg off_val
///@arg [rate]
var on_val = argument[0];
var off_val = argument[1];
var rate = (argument_count > 2 ? (argument[2] * 1000) : 1000);
if (current_time % (rate * 2) >= rate) return on_val;
return off_val;
#10 Шаблоны кода
В меню Preferences -> Objects вы можете создать шаблон, который будет использоваться по умолчанию для всех новых сценариев и событий. Это может сэкономить вам очень много времени.
Ссылка на вторую часть статьи
Ссылка на оригинал
English original manual for GameMaker (formerly known as GameMaker Studio 2). This repository is only used for archiving, mirroring and comparison.
0
stars
0
forks
Branches
Tags
Activity
Star
Notifications
You must be signed in to change notification settings
