Tutorial
Page 7 of 12
Coding Simple Particles (I)
좋습니다. 내장 파티클 정복했고, DnD 파티클도 정복 되었고.. 그럼 파티클 효과 직접 코딩은 어떤가?
"GameMaker : 스튜디오"는 놀랍고 아름다운 효과를 생성하는데 사용할 수 있는 고급 파티클 함수를 갖고 있습니다. 하지만 앞서 언급 한 기술보다 조금 더 많은 작업을 필요로 합니다.
Right, so that's the built in particles covered and the D'n'D particles covered... but what baout coding particle effects? GameMaker:Studio has a number of advanced particle functions that can be used
to create amazing and beautiful effects, but they require a bit more work than the previously mentioned techniques.
기능 학습을 시작하기 위해, 내장 파티클로 처음 만든 로켓 불꽃놀이를 다시 만듭니다. 새 오브젝트를 "obj_Simple_Firework" 만듭니다.
To start learning the functions, lets re-make the first rocket firework that we made with the built-in particle effects. So, add a new object into the object resources and call it "obj_Simple_Firework".
우리는 지금 파티클 시스템을 초기화하고, 캐서린 휠 오브젝트에서 만들었던 두 개의 파티클을 만듭니다.
하지만, 이번에는 코드로 작업합니다. 시스템 추가는 Create Event를 만들고 코드 박스를 추가합니다. 그 뒤에 다음 코드를 넣습니다:
We are now going to initialise a particle system, and create two particle types just as we did for the catherine wheel object, but this time in code. Let's start with the system itself which means that we need a Create Event with a code box in it and the following line of code:
이 코드는 파티클 시스템을 생성하고 변수 "Sname"에의 인덱스 값을 할당합니다.
자, 시스템과 함께 할 모든 추가 호출을 할때는 이 변수를 사용해야합니다.
우리는 파티클를 정의하고, 일을 간단히 유지해야 다음, 한줄 한줄에 대해서 함수를 설명하겠습니다.
This code creates a particle system and assigns it's index value to the variable "Sname".
Now, all further calls to do with that system must use this variable.
Next we need to define our particles, and to keep things easy, we'll do it line by line with a brief explanation for each function.
파티클 유형을 생성하고 모든 추가 기능을위한 변수에의 인덱스를 지정합니다.
Create the particle type and assign it's index to a variable for all further functions.
사용 가능한 상수 중 하나 (전체 목록은 설명서를 참조하십시오)에서 새로운 파티클 유형에 대한 파티클 모양을 선택합니다. 우리 로켓 불꽃 놀이를 들어 우리는 하늘을, 오히려 연기보다가 촉발 할 수 있습니다.
Choose a particle shape for our new particle type from one of the available constants (see the manual for a full list). For our rocket firework we'll make it spark, rather than smoke, through the sky.
파티클 크기를 설정합니다.
이 파티클는 1 1:1 규모로 기반으로하는 기본 값입니다.
귀하의 파티클가 (모든 크기가 변경되기 전에) X 축을 따라 Y 축을 따라 절반으로 2로 크기를 조정해야 할 경우, 당신은 X / Y에 대한 2로 0.5 스케일을 설정해야합니다. 이 경우에 우리는 1시 1분에서가 없게됩니다.
Set the particle scale.
This is the base value that the particle is based on, where 1 is a s 1:1 scale.
So, if you want your particle (before any size is changed) to be scaled by 2 along the x axis and by half along the y axis, you would set the scale to 2, 0.5 for the x/y. in this case we will just leave it at 1:1.
스케일링 후, 그리고 X / Y 축 모두에 적용되는 파티클의 크기.
Drag'n'Drop 작업과 마찬가지로, 당신은 파티클 크기에 대한 최소 및 최대 범위를 지정하고 각 파티클는 해당 범위 내에서 임의의 크기로 설정됩니다.
또한 D' n'D 작업처럼, 당신이 크기 (양의 값) 성장 축소 (음수 값) 또는 일정하게 유지하기 위해 증가를 적용 할 수 있습니다 (0), 그런 후에 우리는에 고유 마지막으로 가치가 파티클 기능 ... "몸을 움직이다".
The size of the particle, applied after scaling, and on both the x/y axis.
Like the Drag'n'Drop actions, you specify a minimum and maximum range for the particle size and each particle will be set to a random size within that range.
Also like the D'n'D action, you can apply an increment to make the size grow (positive value), shrink (negative value) or remain constant (0), then after that we have one final value that is unique to the particle functions... "wiggle".
"흔들어 대는"는 대상 함수를 각 단계에 금액을 추가하는 매우 호기심 재산이지만, 변화는 너무 단계를 지속, 파티클 (또는 속도 또는 방향) 크기 "점프"로 게재됩니다.
흔들어야에 20과 임의의 번호는 0에서 N으로 생성됩니다 i>을 각 단계이가 최종 파티클 속성에 추가됩니다 - 당신은 0의 값을 지정할 수 있습니다.
이것은 우리의 연기 파티클에 정말 우리가 지금 0으로 출발 할 필요가 없습니다.
"Wiggle" is a very curious property that adds an amount to the target function each step, but the change only lasts a step too, so the particle will appear to "jump" in size (or speed or direction).
You can specify a value from 0 - 20 for wiggle, and a random number will be generated from 0 to n each step and this will be added onto the final particle property.
This is not necessary for our smoke particle so we'll leave it as 0 for now.
이 파티클 (직진 색상, 2 색 기울기, 3 색 기울기)와 컬러 세 가지 기능은 실제로 있지만,이를 위해 우리는 흰색의 파티클의 수명 동안 다른 한 색상의 그라디언트를 생성 할 color2 기능을 사용합니다 회색합니다.
There are actually three functions for color with particles (straight color, two color gradient, and three color gradient), but for this we will use the color2 function to create a gradient from one color to the other over the lifetime of the particle from white to gray.
색상 기능을 가진 같은, 당신이 원하는 어떤 영향을에 따라 세 알파 기능도 있습니다 (직진 알파, 최종 알파에 시작 알파에서 알파 변화, 이상 세 알파 페이드 (fade)
파티클 수명).
다시 말하지만, 우리는 마지막에 0 (투명)로 파티클 생활의 시작 1 (불투명)의 알파와 함께 두 개의 알파 페이드를 사용합니다.
The same as with the color functions, there are also three alpha functions depending on what effect you wish (straight alpha, alpha change from a start alpha to an end alpha, and a three alpha fade over the
particle lifetime).
Again, we will use the two alpha fade, with an alpha of 1 (opaque) at the start of the particle life to 0 (transparent) at the end.
운동에 대한 D' n'D 작업을 속도와 방향의 혼합이지만, 기능은 두 개의 다른 함수로 이것들을 구분합니다.
이 사람은 파티클의 속도를 설정하고 최소에서 최대 범위와 증가를 변경하여 빠르게 또는 느리게 얻을 만들 수 있습니다.
20 - 또한 각 파티클의 기본 속도에 추가로 앞서 언급 한 0에서 할 수 있습니다 될 것 "흔들어 대는"가.
이 파티클는 몸을 움직이다가 않지만, 우리는 시간이 지남에 따라 천천히 만들려고합니다.
The D'n'D action for motion is a mix of speed and direction, but the functions separate these into two different functions.
This one sets the speed of the particle and is a range from a minimum to a maximum and can be made to get faster or slower by changing the increment.
it also has a "wiggle" which will be added to the base speed of each particle and as mentioned previously can be from 0 - 20.
This particle will have no wiggle, but we are going to make it slow down over time.
Direction is the other component of the D'n'D particle motion action that has it's own function, and in it you set a minimum and maximum direction as well as an increment and a wiggle.
The increment will add (or subtract) an amount to the current particle direction, giving nice swirling and curling effects. For our effect we want a random direction from 0?to 359?with no inrement or wiggle.
The rocket tail sparks should be affected by gravity, so we use this function to add a small amount pulling them down to earth.
The orientacion of the particle is the same as the "image angle" of a sprite, and gives the particle a rotational angle. For our effect a random value between 0?and 360?is fine.
이 기능은 혼합 제어합니다.
지금까지, 우리는 두 가지 모두 내장 된 파티클 시스템 않으며, D' n'D 파티클 동작이 허용으로 우리의 파티클와 이미지 블렌딩을 위해 좀 없었어요. 그런데이 혼합입니까?
음,이 기능으로 설정되어있는 경우 참 tt>을 파티클는 다른의에 추가 첨가제 i>를 혼합 모드를 사용하여 파티클의 빛 부분이 발광을 가지고 것을 의미 어우러진 아르 화면에 사람들이 겹칠 수 있다는 파티클.
그것은 그들 중 많은 사람들이있다 "발광"효과 whwn 파티클 수 매우 유용하지만 스파크 길에서 위해 우리는 false로 설정 떠나 TT>.
This function controls blending.
Up until now, we have not had any for of image blending with our particles as neither the built-in particle system, nor the D'n'D particle actions permit this. But what is blending?
Well, when this function is set to true the particles are blended using an additive blend mode, meaning that the light parts of the particle have their luminosity added to that of any other particles that they may overlap when on the screen.
It gives particles a "glow" effect whwn there are many of them and is very useful, but for out spark trail, we will leave it set to false.
이 마지막 기능은 파티클의 수명을 제어하고 (이전과)는, 주어진 범위에서 임의의 값이 경우에 모든 파티클가 화면에 8 ~ 30 단계에서 지속됩니다 하나입니다.
This final function is the one that controls the lifetime of the particle and (as before) it is a random value from the given range, in this case all particles will last from between 8 and 30 steps on screen.
훌륭합니다! 우리는 우리의 길 정의한 있으므로, 게임을 저장 한 다음이 불꽃 놀이를 완료하고의 버튼을하고 있습니다.
Excellent! We have our trail defined, so save the game and then continue to finish this firework and make it's button.
Click on the Next button to go to the next page of the tutorial.