Установить Steam
войти
|
язык
简体中文 (упрощенный китайский)
繁體中文 (традиционный китайский)
日本語 (японский)
한국어 (корейский)
ไทย (тайский)
Български (болгарский)
Čeština (чешский)
Dansk (датский)
Deutsch (немецкий)
English (английский)
Español - España (испанский)
Español - Latinoamérica (испанский Лат. Ам.)
Ελληνικά (греческий)
Français (французский)
Italiano (итальянский)
Bahasa Indonesia (индонезийский)
Magyar (венгерский)
Nederlands (нидерландский)
Norsk (норвежский)
Polski (польский)
Português (португальский)
Português-Brasil (бразильский португальский)
Română (румынский)
Suomi (финский)
Svenska (шведский)
Türkçe (турецкий)
Tiếng Việt (вьетнамский)
Українська (украинский)
Сообщить о проблеме с переводом
There is quite a bit of new stuff in GMS that won't be covered, but it should teach you GML well enough to manage on just using the help file's documentation.
But yeah, search Youtube. Should be easy to find something.
The code above that we place in this alarm will be used to reset the image index (current sub-image chosen) of the sprite to 0, and in this way we can create a "hover" and "pressed" state, then set this alarm to reset the button back to a "normal" state. This will be done by the following code, which is where we check the mouse position, check to see if the mouse has been pressed, and then create the firework object itself:
if instance_position(mouse_x, mouse_y, id)
{
if image_index < 2
{
image_index = 1;
if mouse_check_button_pressed(mb_left)
{
alarm[0] = room_speed / 2;
image_index = 2;
instance_create(random(room_width), 400, obj_BuiltIn_Firework);
}
}
}
else
{
if image_index < 2
{
image_index =0;
}
}
So, that code will check to see if the mouse position coincides with the button mask, and if it does it checks the current button image_index and sets it to "hover" state if it has not been pressed. It then detects any mouse presses and if there is one, it sets the image-index to 2 ("pressed" state"), sets alarm[0] to reset the state which permits it to be pressed again, and creates an instance of the object "obj_BuiltIn_Firework" at a random position along the x-axis.
I can not figure out where to put that code when i run the game it launches 1 firework off to the right without me doing anything. but i also have zero effect on anything in the game.
PS: This is on page 2 of the tutorial.
EDIT: The code did not paste like it looks in my game.
Just checked the tutorial and even though it doesn't explicitly say it, I'd assume you put it in obj_BuiltIn_Firework's Step event.