Membuat Room Transisi Sendiri
+2
Riza_Farhandi
Kevin Blaze Coolerz
6 posters
Halaman 1 dari 1
Membuat Room Transisi Sendiri
-Title: Creating your own room transition with GM7 Pro
-Description: Describes how to define your own room transition script. The example file contains a number of sample scripts for basic and advanced effects.
-GM Version: GM7
-Registered: Yes
-File Type: .zip (containing three .gmk)
-File Size: 313K
-File Link: [You must be registered and logged in to see this link.]
-Link ke forum: [You must be registered and logged in to see this link.]
Introduction
Game Maker 7 provides a way to define your own room transition effect. However, the explanation of the mechanism is very condensed (stuffed into the description of one function) and hard to get. This tutorial describes how to define a script and register it to be used on room transitions.
The first example contains scripts to emulate all of in-built room transitions (plus a few in the Room Transitions extension.) Not so impressive, but you can take basic expressions out of the code to implement your own effects. The second one contains a number of advanced sample scripts those also can be used as a base of your own one. The third example demonstrates other possibility of custom room transitions, such as keeping HUD and player on the screen during the transition. Useful on implementing so-called Zelda-style and Metroid-style room transitions.
Defining a script
At first, you have to define a transition script which is meant to be repeatedly called from Game Maker during the transition. The script is called with five arguments:
argument0 is the surface with the image of the previous room.
argument1 is the surface with the image of the next room.
argument2 and argument3 are the width and height of the surface, respectively. (It is also the size of the drawing region.)
argument4 is fraction of the transition. This takes a value between 0 and 1.
No need to afraid of "surface"; as to creating room transitions, you can simply think it as a sort of large sprite. The only difference is that you use functions like draw_surface instead of draw_sprite to draw it on the screen.
The last parameter, fraction, is the most important one. Your responsibility is to mix and draw those two images of rooms onto the screen according to the fraction. At the beginning (when fraction is 0) the first image should occupy the entire screen. As the transition goes on, the script is called over and over with gradually increasing fraction, to mix/interpolate/blend two images accordingly.
Using the room transition
Next, you have to register the transition to the system, using the function transition_define.
Note that the second argument is the name of your script, which is a string. You usually have to put quotation marks around the name, as in the example above.
The first argument is the index which is to be assigned to the transition. You can use an arbitrary number unless it overlaps with an existing one. It is a good idea to define a constant for each kind of transition if you plan to make it an extension package.
Although it is harmless to register the same transition with the same index multiple times, you'd better ensure it to be registered only once throughout the game. (For example, execute the code in the game start event of a controller object.)
Once the transition is registered, you can use it by setting the index to transition_kind in prior to changing the room.
Additionally, you can change the speed of the transition with setting transition_steps. It controls how many times the script is called during transition. The larger the number is, the slower the transition gets and takes longer to complete. (With the default value of 80, it takes about 1.2 seconds.)
-Description: Describes how to define your own room transition script. The example file contains a number of sample scripts for basic and advanced effects.
-GM Version: GM7
-Registered: Yes
-File Type: .zip (containing three .gmk)
-File Size: 313K
-File Link: [You must be registered and logged in to see this link.]
-Link ke forum: [You must be registered and logged in to see this link.]
Introduction
Game Maker 7 provides a way to define your own room transition effect. However, the explanation of the mechanism is very condensed (stuffed into the description of one function) and hard to get. This tutorial describes how to define a script and register it to be used on room transitions.
The first example contains scripts to emulate all of in-built room transitions (plus a few in the Room Transitions extension.) Not so impressive, but you can take basic expressions out of the code to implement your own effects. The second one contains a number of advanced sample scripts those also can be used as a base of your own one. The third example demonstrates other possibility of custom room transitions, such as keeping HUD and player on the screen during the transition. Useful on implementing so-called Zelda-style and Metroid-style room transitions.
Defining a script
At first, you have to define a transition script which is meant to be repeatedly called from Game Maker during the transition. The script is called with five arguments:
argument0 is the surface with the image of the previous room.
argument1 is the surface with the image of the next room.
argument2 and argument3 are the width and height of the surface, respectively. (It is also the size of the drawing region.)
argument4 is fraction of the transition. This takes a value between 0 and 1.
No need to afraid of "surface"; as to creating room transitions, you can simply think it as a sort of large sprite. The only difference is that you use functions like draw_surface instead of draw_sprite to draw it on the screen.
The last parameter, fraction, is the most important one. Your responsibility is to mix and draw those two images of rooms onto the screen according to the fraction. At the beginning (when fraction is 0) the first image should occupy the entire screen. As the transition goes on, the script is called over and over with gradually increasing fraction, to mix/interpolate/blend two images accordingly.
Using the room transition
Next, you have to register the transition to the system, using the function transition_define.
- Code:
transition_define(100, "scr_squeeze_right");
Note that the second argument is the name of your script, which is a string. You usually have to put quotation marks around the name, as in the example above.
The first argument is the index which is to be assigned to the transition. You can use an arbitrary number unless it overlaps with an existing one. It is a good idea to define a constant for each kind of transition if you plan to make it an extension package.
Although it is harmless to register the same transition with the same index multiple times, you'd better ensure it to be registered only once throughout the game. (For example, execute the code in the game start event of a controller object.)
Once the transition is registered, you can use it by setting the index to transition_kind in prior to changing the room.
- Code:
transition_kind = 100; // Squeeze from right
room_goto_next();
Additionally, you can change the speed of the transition with setting transition_steps. It controls how many times the script is called during transition. The larger the number is, the slower the transition gets and takes longer to complete. (With the default value of 80, it takes about 1.2 seconds.)
Re: Membuat Room Transisi Sendiri
@riza:
seep
@zebrakelabu:
gk bisa kyk ny om
cz pke function transition_kind (kalo gk salah sih, ak cma lihat sbentar script ny )
seep
@zebrakelabu:
gk bisa kyk ny om
cz pke function transition_kind (kalo gk salah sih, ak cma lihat sbentar script ny )
Re: Membuat Room Transisi Sendiri
@zebrakelabu
fungsi transisi di GM studio obsolete, berarti kalo mau bikin musti pake extension (klo g salah), atau langsung pake script from scratch yang lebih rumit dan justru bisa aja bikin lag
fungsi transisi di GM studio obsolete, berarti kalo mau bikin musti pake extension (klo g salah), atau langsung pake script from scratch yang lebih rumit dan justru bisa aja bikin lag
Asuna- Global Moderator
-
Jumlah posting : 1711
Points : 1901
Join date : 10.01.13
Re: Membuat Room Transisi Sendiri
Nice share..
lebih sering pake transition_kind = 21
fade effect..
lebih sering pake transition_kind = 21
fade effect..
Agan- GM Beginner
-
Jumlah posting : 115
Points : 120
Join date : 06.05.13
Age : 31
Lokasi : Jakarta Barat
Re: Membuat Room Transisi Sendiri
script ny pedes gan
gw nggak ngerti cara bikin transisi ny
gw nggak ngerti cara bikin transisi ny
UNK_- Newbie
-
Jumlah posting : 17
Points : 15
Join date : 04.05.13
Lokasi : Unidentified
Similar topics
» Apa yang membuat kamu ingin membuat game sendiri?
» bagaimana cara membuat installan game sendiri? (windows)
» buat studio sendiri
» [Curhat] Frustasi Buat Sprite Sendiri !
» Berbicara dengan dirinya sendiri versi 12 tahun
» bagaimana cara membuat installan game sendiri? (windows)
» buat studio sendiri
» [Curhat] Frustasi Buat Sprite Sendiri !
» Berbicara dengan dirinya sendiri versi 12 tahun
Halaman 1 dari 1
Permissions in this forum:
Anda tidak dapat menjawab topik