آموزش کد اکشن های گیم میکر

این مطلب از سایت قدیمی منتقل شده و ممکن است اشکالات زیادی دشته باشد. لطفا در صورت مشاهده ی هر گونه ایراد، گزارش دهید

در این آموزش از سایت ای تاتس قصد دارم کد اکشن های گیم میکر رو که به زبان gml هست به شما آموزش بدم. با ما در این آموزش همراه باشید.

gm8-logo-finalist-hideous-mouth

 

  • Move

Move

 Move Fixed

Action Function:

1

action_move(direction,speed);

در اینجا direction با جهت در دیگر توابع متفاوت است. اینجا می بایست یک رشته 9 کاراکتری از 0 و 1 قرار داد که هر کدام از کاراکترها اگر 1 باشد، جهتی را برای انتخاب فعال می کند. ترتیب جهت ها به نوبت از چپ به راست در رشته به این صورت است:

بالا راست – بالا – بالا چپ – راست – وسط – چپ – پایین راست – پایین – پایین چپ

 برای مثال، اگر بخواهیم به طور تصادفی جهت چپ یا راست را انتخاب کند، باید در رشته ی direction مقدار زیر را وارد کنیم:

1

“000101000”

GML Code:

1

motion_set(direction,speed);

 Move Free

Action Function:

GML Code:

1

motion_set(direction,speed);

 Move Towards

Action Function:

1

action_move_point(x,y,speed);

GML Code:

1

move_towards_point(x,y,speed);

 Speed Horizontal

Action Function:

1

action_set_hspeed(value);

GML Code:

1

hspeed=speed;

 Speed Vertical

Action Function:

1

action_set_vspeed(value);

GML Code:

1

vspeed=speed;

 Set Gravity

Action Function:

1

action_set_gravity(direction,gravity);

GML Code:

1

2

gravity_direction=direction;

gravity=amount;

 Reverse Horizontal

Action Function:

1

action_reverse_xdir();

GML Function:

1

hspeed=-hspeed; //actual code.

 Reverse Vertical

Action Function:

1

action_reverse_ydir();

GML Function:

1

vspeed=-vspeed; //actual code.

 Set Friction

Action Function:

1

action_set_friction(value);

GML Function:

1

friction=amount;

Jump

 Jump to Position

Action Function:

1

action_move_to(x,y);

GML Code:

1

2

x=value;

y=value;

 Jump to Start

Action Function:

1

action_move_start();

GML Code:

1

2

x=xstart; //actual code.

y=ystart; //actual code.

 Jump to Random

Action Function:

1

action_move_random(hsnap,ysnap);

GML Code:

1

move_random(1,1);

//actual code. The 1 and 1 in the code are the hsnap and vsnap positions.

 Align to Grid

Action Function:

1

action_snap(hsnap,vsnap);

GML Code:

1

move_snap(hsnap,vsnap);

 Wrap Screen

Action Function:

1

action_wrap(type);

 //0=horizontal, 1=vertical, 2=both

GML Code:

1

move_wrap(hort,vert,margin);

// This code should be placed in the outside room event.

 Set hort (horizontally) and vert (vertically) to either 1 for true or 0 for false. Set margin to how far outside the room the instance must be before the action happens.

 Move to Contact

Action Function:

1

action_move_contact(direction,max,solid);

// for solid, 0=only solid, 1=all instances;

GML Code:

1

move_contact_solid(dir,maxdist)

//for solid objects, dir=direction, maxdist=maximum distance.

1

move_contact_all(dir,maxdist)

//for non solid objects, dir=direction, maxdist=maximum distance.

 Bounce

Action Function:

1

action_bounce(precise,against);

GML Code:

1

move_bounce_solid(advanced);

 //for solid objects, advanced=advance bounce(0 or 1).

1

move_bounce_all(advanced);

//for all objects, advanced=advance bounce(0 or 1).

Paths

 Set Path

Action Function:

1

2

3

action_path(path0,speed,at end, relative);

//for at end 0=stop, 1=continue from start, 2=continue from here, 3=reverse

//for relative 0=relative, 1=absolute

GML Code:

1

path_start(path,speed,endaction,absolute);

 End Path

Action Function:

1

action_path_end();

GML Code:

1

path_end();

 Path Position

Action Function:

1

action_path_position(position);

GML Code:

1

path_position=value; //Must lie between 0 and 1.

 Path Speed

Action Function:

1

action_path_speed(value);

GML Code:

1

path_speed=value; //pixels per step.

Steps

 Step Towards

Action Function:

1

action_linear_step(x,y,speed,solid); // for solid, 0=solid, 1=all instances

GML Code:

1

mp_linear_step(x,y,stepsize,checkall); // stepsize is in pixels. Checkall can be either 1 for stopping when hitting any object, or 0 for only solid objects.

 Step Avoiding

Action Function:

1

action_potential_step(x,y,stepsize,checkall);

GML Code:

1

mp_potential_step(x,y,stepsize,checkall);

  • Mine 1

Objects

 Create Instance

Action Function:

1

action_create_object(object,x,y);

GML Code:

1

instance_create(x,y,object0); //use x and y variables for relative.

 Create Moving

Action Function:

1

action_create_object_motion(object,x,y,speed,direction);

GML Code:

1

with (instance_create(x,y,object1)) motion_set(direction,speed);

 Create Random

Action Function:

1

2

action_create_object_random(object0,object1,object2,object3,x,y);

//needs all four object slots to work properly

GML Code:

1

2

instance_create(x,y,choose(object0,object1,object2,object3));

//object0, etc are the object names. Drag and Drop allows only four slots, but the ‘choose’ code allows up to sixteen.

 Change Instance

Action Function:

1

action_change_object(object,perform events); // for perform events 0=no, 1=yes

GML Code:

1

instance_change(obj,perf); //perf(1 or 0)is whether or not to perform create and destroy events.

 Destroy Instance

Action Function:

1

action_kill_object();

GML Code:

1

instance_destroy();

 Destroy at Position

Action Function:

1

action_kill_position(x,y);

GML Code:

1

position_destroy(x,y);

Sprite

 Change Sprite

Action Function:

1

action_sprite_set(sprite,subimage,speed);

GML Code:

1

sprite_index=sprite0;

 Transform Sprite

Action Function:

1

2

action_sprite_transform(xscale,yscale,angle,mirror);

// for mirror, 0=no mirror, 1=mirror horizontal, 2=flip vertical, 3=mirror and flip

GML Code:

1

2

3

4

5

image_xscale=value; //horizontal scaling of sprite.

image_yscale=value; //vertical scaling if the sprite.

image_angle=value; //angle the sprite.

image_xscale=-1; //flip the sprite horizontally, actual code.

image_yscale=-1; //flip the sprite vertically, actual code.

 Color Sprite

Action Function:

1

action_sprite_color(color,alpha);

GML Code:

1

2

image_blend=color;

image_alpha=value; //from 0 to 1, 1 being opaque.

Sounds

 Play Sound

Action Function:

1

action_sound(sound,loop); // for loop, 1=true, 0=false

GML Code:

1

sound_play(sound); //plays sound once.

1

sound_loop(sound); //loops sound.

 Stop Sound

Action Function:

1

action_end_sound(sound);

GML Code:

1

2

sound_stop(index);

//Stops the indicates sound. If there are multiple sounds with this index playing simultaneously, all will be stopped.

 Check Sound

Action Function:

1

action_if_sound(sound);

GML Code:

1

2

3

4

if(sound_isplaying(sound))

{

 // actions here.

}

Rooms

توجه نمایید که در کدهای تغییر اتاق می توانید از افکت های transition استفاده نمایید. برای این کار در توابع اکشن ها می توانید مستقیما کد transition را وارد کنید، اما در توابع GML می بایست قبل از فراخوانی تابع دستور زیر را اجرا نمایید:

1

transition_kind = value;

که value می تواند مقدار های زیر را دریافت نماید:

0 = no effect
1 = Create from left
2 = Create from right
3 = Create from top
4 = Create from bottom
5 = Create from center
6 = Shift from left
7 = Shift from right
8 = Shift from top
9 = Shift from bottom
10 = Interlaced from left
11 = Interlaced from right
12 = Interlaced from top
13 = Interlaced from bottom
14 = Push from left
15 = Push from right
16 = Push from top
17 = Push from bottom
18 = Rotate to the left
19 = Rotate to the right
20 = Blend the rooms
21 = Fade out and in

توجه نمایید که پس از اجرای کد تغییر اتاق، مقدار transition_kind برابر صفر می شود.

 Previous Room

Action Function:

1

action_previous_room(kind); // kind is transition kind

GML Code:

1

room_goto_previous();

 Next Room

Action Function:

1

action_next_room(kind); // for kind is transition kind

GML Code:

1

room_goto_next();

 Restart Room

Action Function:

1

action_current_room(kind); // for kind is transition kind

GML Code:

1

room_restart();

 Different Room

Action Function:

1

action_another_room(room,transition kind); // for kind is transition kind

GML Code:

1

room_goto(room);

 Check Previous

Action Function:

1

2

3

4

if(action_if_previous_room())

{

 //stuff here

}

GML Code:

1

2

3

4

5

if(room_previous(room)<>-1)

{

 // actions here

}

//’room’ is constant variable for current room. Actual code.

 Check Next

Action Function:

1

2

3

4

if(action_if_next_room())

{

//stuff here

}

GML Code:

1

2

3

4

5

if(room_next(room)<>-1)

{

// actions here

}

//’room’ is constant variable for current room. Actual code.

  • Mine 2

Timing

 Set Alarm

Action Function:

1

action_set_alarm(time,alarm);

GML Code:

1

alarm[0]=value; //set 0 from 0 to 11 for alarm.

 Sleep

Action Function:

1

action_sleep(milliseconds,redraw); //for redraw, 1=true, 0=false

GML Code:

1

sleep(numb); //’numb’ is in milliseconds.

 Set Time Line

Action Function:

1

action_set_timeline(timeline,position);

GML Code:

1

timeline_index=timeline;

 Time Line Position

Action Function:

1

action_set_timeline_position(position);

GML Code:

1

timeline_position=value;

 Time Line Speed

Action Function:

1

action_set_timeline_speed(speed);

GML Code:

1

timeline_speed = value;

 Start Time Line

Action Function:

1

action_timeline_start();

GML Code:

1

timeline_running = true;

 Pause Time Line

Action Function:

1

action_timeline_pause();

GML Code:

 Stop Time Line

Action Function:

1

action_timeline_stop();

GML Code:

1

timeline_running = false;

Info

 Display Message

Action Function:

1

action_message(string);

GML Code:

1

show_message(‘Hello’);

 Show Info

Action Function:

1

action_show_info();

GML Code:

1

show_info();

 Splash Text

Action Function:

1

action_splash_text(filename);

GML Code:

1

splash_show_text(fname,delay)

 Splash Image

Action Function:

1

action_splash_image(filename);

GML Code:

1

splash_show_image(fname,delay)

 Splash Webpage

Action Function:

1

action_splash_web(address, openin);

GML Code:

1

splash_show_web(url,delay)

 Splash Video

Action Function:

1

action_splash_video(filename, loop);

GML Code:

1

splash_show_video(fname,loop)

 Splash Settings

Action Function:

GML Code:

Game

 Restart Game

Action Function:

1

action_restart_game();

GML Code:

1

game_restart();

 End Game

Action Function:

1

action_end_game();

GML Code:

1

game_end();

 Save Game

Action Function:

1

action_save_game(filename);

GML Code:

1

2

game_save(fname);

//fname is the name of the save file. Place it in quotes.

 Load Game

Action Function:

1

action_load_game(filename);

GML Code:

1

game_load(fname);

Resources

 Replace Sprite

Action Function:

1

action_replace_sprite(spite,filename,subimages);

GML Code:

1

2

sprite_replace(ind,fname,imgnumb,precise,transparent,smooth,preload,xorig,yorig);

// precise, transparent,smooth,preload are all 1 or 0 for yes or no.

 Replace Sound

Action Function:

1

action_replace_sound(sound,filename);

GML Code:

1

2

3

4

5

6

7

sound_replace(index,fname,kind,loadonuse);

//loadonuse is 1 or 0 for yes or no.

//Kind is one of the following…

//0-normal

//1-background

//2-3d

//3-mmplayer

 Replace Background

Action Function:

1

action_replace_background(background,filename);

GML Code:

1

2

background_replace(ind,fname,transparent,smooth,preload);

// transparent,smooth and preload are all 1 or 0 for yes or no.

  • Control

Questions

 Check Empty

Action Function:

1

2

3

4

5

if(action_if_empty(x,y,type))

{

 //Stuff here

}

// for type, 0=only solid, 1=all instances

GML Code:

1

2

3

4

5

//for solid

if(place_free(x,y))

{

 //actions here.

}

1

2

3

4

5

//for all

if(place_empty(x,y))

{

 //actions here.

}

 Check Collision

Action Function:

1

2

3

4

5

if(action_if_collision(x,y,type))

{

 //Stuff here

}

// for type, 0=only solid, 1=all instances

GML Code:

1

if (!place_empty(x,y)) // for All

1

if (place_meeting(x,y,all)) // for All

1

2

3

if (!place_free(x,y)) // for Solid only

// As well, there are several advanced codes that allow you greater control over

checking collisions. Please see the manual for explanations of each…

1

2

3

4

if (collision_point(x,y,obj,prec,notme))

{

 //actions here.

}

1

2

3

4

if (collision_rectangle(x1,y1,x2,y2,obj,prec,notme))

{

 //actions here.

}

1

2

3

4

if (collision_circle(xc,yc,radius,obj,prec,notme))

{

 //actions here.

}

1

2

3

4

if (collision_ellipse(x1,y1,x2,y2,obj,prec,notme))

{

 //actions here.

}

1

2

3

4

if (collision_line(x1,y1,x2,y2,obj,prec,notme))

{

 //actions here.

}

 Check Object

Action Function:

1

2

3

4

if(action_if_object(object,x,y))

{

 //Stuff here

}

GML Code:

1

2

3

4

if (place_meeting(x,y,object0))

{

 //actions here.

}

 Test Instance Count

Action Function:

GML Code:

1

2

3

4

if (instance_number(obj)==value)

{

 //actions here.

}

 Test Chance

Action Function:

1

2

3

4

if (action_if_dice(sides))

{

 //Stuff here

}

GML Code:

1

2

3

4

if (floor(random(value))==0)

{

 //actions here.

}

 Check Question

Action Function:

1

2

3

4

if (action_if_question(string)) //returns 1 for yes and 0 for no

{

 //actions here.

}

GML Code:

1

2

3

4

if (show_question(“Do you want to do this?”))

{

 // actions here.

}

 Test Expression

Action Function:

GML Code:

1

2

3

4

5

if (the expression)

{

 // actions here.

}

//examples for expression would be x=5, y>10, global.item=’Apple’.

 Check Mouse

Action Function:

1

2

3

4

5

if(action_if_mouse(argument))

{

 //Stuff here

}

// 0=none, 1=left, 2=right, 3=middle

GML Code:

1

2

3

4

5

if (mouse_check_button(numb))

{

 //actions here.

}

// numb can be mb_none,mb_left, mb_middle,mb_right.

 Check Grid

Action Function:

1

2

3

4

if(action_if_aligned(x,y))

{

 //Stuff here

}

GML Code:

1

2

3

4

if (place_snapped(value,value))

{

 //actions here.

}

Other

 Start Block

1

{

 End Block

1

}

 Else

1

else

 Exit

1

exit;

 Repeat

1

2

3

4

5

repeat (value)

{

 //Stuff Here

}

//example: repeat (10) instance_create(x,y,object0);

 Call Parent Event

Action Function:

1

action_inherited();

GML Code:

1

event_inherited();

Code

 Execute Code

تمامی کدها در این اکشن قرار می گیرند.

 Execute Script

Action Function:

1

2

action_execute_script(script,argument0,argument1,argument2,argument3,argument4);

//needs all 5 argument slots to work properly

GML Code:

1

2

script_execute(ind,arguments);

// or call a script in code by the script name and the arguments in () beside it…

 Comment

برای گذاشتن توضیحات در کد متنی را بعد از // قرار دهید.

Variable

 Set Variable

به مثال های زیر توجه کنید:

1

2

3

4

5

health=50;

lives=3;

name=’Gordon’;

global.name=’Gordon’;

object1.HP = 100;

 Test Variable

Action Function:

1

2

3

4

5

if(action_if_variable(variable,number,operation))

{

 //Stuff here

}

// for operation 0=equal to, 1=smaller than, 3=larger than

GML Code:

به مثال زیر توجه کنید:

1

2

3

4

if(lives==0)

{

 //actions here

}

 Draw Variable

Action Function:

1

action_draw_variable(variable,x,y);

GML Code:

1

draw_text(x,y,variable);

  • Score

Score

امتیاز

 Set Score

تنظیم امتیاز

Action Function:

1

action_set_score(value);

GML Code:

1

score = value;

 Test Score

چک کردن امتیاز

Action Function:

1

2

3

4

5

if(action_if_score(score,operation))

{

 //Stuff here

}

// for operation, 0=equal to, 1=smaller than, 3=larger than

GML Code:

1

2

3

4

if (score==value)

{

 //actions here.

}

 Draw Score

رسم امتیاز

Action Function:

1

action_draw_score(x,y,caption); //caption is a string before the score

GML Code:

1

draw_text(x,y,’Score: ‘ + string(score));

 Show Highscore

نمایش امتیازات برتر

Action Function:

GML Code:

1

2

3

4

5

6

highscore_set_background(back); //set with background image.

highscore_set_border(show); //1 or 0 for yes or no.

highscore_set_colors(back,new,other); //set colors for background,new entry, other entries.

highscore_set_font(name,size,style); //set style to 0=normal, 1=bold, 2=italic, 3=bold italic.

highscore_show(numb); //This actually shows the table, with numb being the new score to add if it is high enough.

//Note: there are many other controls for the high score table. These are just the ones used in the drag and drop.

 Clear Highscore

حذف لیست امتیازات برتر

Action Function:

1

action_highscore_clear();

GML Code:

1

highscore_clear();

Lives

جان

 Set Lives

تنظیم جان

Action Function:

1

action_set_life(value);

GML Code:

1

lives = value;

 Test Lives

چک کردن جان

Action Function:

1

2

3

4

5

if(action_if_life(lives,argument)

{

 //Stuff here

}

// 0=equal to, 1=smaller than, 3=larger than

GML Code:

1

2

3

4

if (lives == value)

{

 //actions here.

}

 Draw Lives

رسم جان

Action Function:

1

action_draw_life(x,y,caption); //caption is a string

GML Code:

1

draw_text(x,y,’Lives: ‘ + string(lives));

 Draw Life Images

رسم یک اسپرایت(تصویر) برای جان

Action Function:

1

action_draw_life_images(x,y,sprite);

GML Code:

1

2

3

4

5

6

7

8

// no equivalent but you can use the following code in the draw event. sprite0 is the sprite image. Set ‘a’ in the 5th line to however far apart you wish the images to be on the screen in pixels…

var a;

a=0;

repeat(lives)

{

 draw_sprite(sprite0,0,view_xview+a,view_yview);

 a+=16;

}

Health

سلامتی

 Set Health

تانظیم سلامتی

Action Function:

1

action_set_health(value);

GML Code:

1

health=value;

 Test Health

چک کردن سلامتی

Action Function:

1

2

3

4

5

if(action_if_health(health,argument))

{

 //Stuff here

}

 // 0=equal to, 1=smaller than, 3=larger than

GML Code:

1

if (health==value) { //actions here. }

 Draw Health

رسم سلامتی

Action Function:

1

action_draw_health(x,y,x1,y,1,back color, bar color);

GML Code:

1

draw_healthbar(x1,y1,x2,y2,amount,backcol,mincol,maxcol,direction,showback,s howborder);

 Score Caption

Action Function:

1

2

action_set_caption(show score,score caption,show lives,lives caption,show health,health caption);

//show for each is 1 for true or 0 for false. Captions are in strings

GML Code:

1

2

3

4

5

6

7

8

9

show_score = value;

//set to 1 for yes, 0 for no.

caption_score = string;

show_lives = value;

//set to 1 for yes, to 0 for no.

caption_lives = string;

show_health = value;

//set to 1 for yes, to 0 for no.

caption_health = string;

  • Draw

Drawing

رسم

 Draw Sprite

  رسم اسپرایت (تصویر)

Action Function:

1

action_draw_sprite(sprite,x,y,subimage);

GML Code:

1

draw_sprite(sprite,subimage,x,y);

 Draw Background

         رسم بک گراند (تصویر زمینه)

Action Function:

1

action_draw_background(background,x,y,tiled); // 0=no,1= yes

GML Code:

1

draw_background(back,x,y) //single image.

1

draw_background_tiled(back,x,y); //tiled image.

 Draw Text

نمایش نوشته

Action Function:

1

action_draw_text(text,x,y);

GML Code:

1

draw_text(x,y,string);

 Draw Scaled Text

                                    نمایش نوشته با طول و ارتفاع مشخص

Action Function:

1

action_draw_text_transformed(text,x,y,xscale,yscale,angle);

GML Code:

1

draw_text_transformed(x,y,string,xscale,yscale,angle);

 Draw Rectangle

                                       رسم چهار گوش

Action Function:

1

action_draw_rectangle(x,y,x1,y1,filled); // 0=filled, 1=outline

GML Code:

1

draw_rectangle(x1,y1,x2,y2,outline); //Outline is 1 or 0 for yes or no.

 Horizontal Gradient

                              رسم چهار گوش با ترکیب افقی دو رنگ

Action Function:

1

action_draw_gradient_hor(x,y,x,1,y,1,color1,color2);

GML Code:

1

2

draw_rectangle_color(x1,y1,x2,y2,col1,col2,col3,col4,outline);

//Set col1 and col4 to the left color. Set col2 and col3 to the second color.

 Vertical Gradient

                                 رسم چهار گوش با ترکیب عمودی دو رنگ

Action Function:

1

action_draw_gradient_vert(x,y,x1,y1,color1,color2);

GML Code:

1

2

draw_rectangle_color(x1,y1,x2,y2,col1,col2,col3,col4,outline);

//Set col1 and col2 to the top color. Set col3 and col4 to the bottom color.

 Draw Ellipse

                                     رسم دایره

Action Function:

1

action_draw_ellipse(x,y,x1,y,1,filled); // 0=filled, 1=outline

GML Code:

draw_ellipse(x1,y1,x2,y2,outline); //outline is 1 or 0 for yes or no.

 Gradient Ellipse

رسم دایره با دو رنگ

Action Function:

1

action_draw_ellipse_gradient(x,y,x1,y,1,color1,color2);

GML Code:

1

2

draw_ellipse_color(x1,y1,x2,y2,col1,col2,outline);

//col1 is the color in the middle. col2 is the color at the boundary.

 Draw Line

رسم خط

Action Function:

1

action_draw_line(x,y,x1,y1);

GML Code:

1

draw_line(x1,y1,x2,y2);

 Draw Arrow

رسم فلش

Action Function:

1

action_draw_arrow(x,y,x1,y1,tip size);

GML Code:

1

draw_arrow(x1,y1,x2,y2,size); //size is in pixels.

Settings

تنظیمات

 Set Color

تغییر رنگ

Action Function:

1

action_color(color);

GML Code:

1

draw_set_color(color);

برای رنگ از ثابت های زیر استفاده کنید:

c_aqua
c_black
c_blue
c_dkgray
c_fuchsia
c_gray
c_green
c_lime
c_ltgray
c_maroon
c_navy
c_olive
c_orange
c_purple
c_red
c_silver
c_teal
c_white
c_yellow

 Set Font

تغییر فونت

Action Function:

1

action_font(font name,align); // 0=left aligned, 1=centered, 2=right aligned

GML Code:

1

2

3

draw_set_font(font);

draw_set_halign(halign); //Can be set to fa_left, fa_center, fa_right.

draw_set_valign(valign); //Can be set to fa_top, fa_middle, fa_bottom.

 Set Full Screen

فول اسکرین کردن صفحه

Action Function:

1

action_fullscreen(type); // 0=yes, 1=no

GML Code:

1

window_set_fullscreen(full); //Set to 0 for window, to 1 for full screen.

Other

 Take Snapshot

عکس گرفتن از بازی

Action Function:

1

action_snapshot(filename);

GML Code:

1

screen_save(filename);

 Create Effect

ایجاد افکت

Action Function:

1

2

action_effect(type,x,y,size,color,where)

// for where 0=below objects, 1=above objects

GML Code:

1

2

effect_create_below(kind,x,y,size,color)

1

2

effect_create_above(kind,x,y,size,color)

//Similar to the previous function but this time the effect is created on top of the instances, that is, at a depth of -100000.

برای kind (افکتها)از ثابت های زیر استفاده نمایید:

ef_explosion
ef_ring
ef_ellipse
ef_firework
ef_smoke
ef_smokeup
ef_star
ef_spark
ef_flare
ef_cloud
ef_rain
ef_snow

  • Extra

Particles

 Create Part System

Action Function:

1

action_partsyst_create(depth);

GML Code:

1

index=part_system_create(); //Assign to an index (variable). Must be used in other functions.

 Destroy Part System

Action Function:

1

action_partsyst_destroy();

GML Code:

1

part_system_destroy(index);

 Clear Part System

Action Function:

1

action_partsyst_clear();

GML Code:

1

part_system_clear(index);

 Create Particle

Action Function:

1

action_parttype_create(type id,shape,sprite,min size,max size,size inrease);

GML Code:

1

2

3

4

5

index=part_type_create(); //Assign to an index.

part_type_shape(index,shape); //see manual for shape types.

part_type_size(index,size_min,size_max,size_incr,size_rand);

part_type_color(index,color_start,color_middle,color_end);

//there are other functions for particles; these just cover the Drag and Drop.

 Particle Color

Action Function:

1

action_parttype_color(type id,shape,color1,color2,start alpha,end alpha);

GML Code:

1

2

3

4

5

6

7

8

9

10

11

12

part_type_color1(ind,color1);

//Indicates a single color to be used for the particle.

part_type_color2(ind,color1,color2);

//Specifies two colors between which the color is interpolated.

part_type_color3(ind,color1,color2,color3);

//Similar but this time the color is interpolated between three colors that represent the color at the start, half-way, and at the end.

part_type_color_mix(ind,color1,color2);

//With this function you indicate that the particle should get a color that is a random mixture of the two indicated colors. This color will remain fixed over the lifetime of the particle.

part_type_color_rgb(ind,rmin,rmax,gmin,gmax,bmin,bmax);

//Can be used to indicate that each particle must have a fixed color but chosen from a range. You specify a range in the red, green, and blue component of the color (each between 0 and 255).

part_type_color_hsv(ind,hmin,hmax,smin,smax,vmin,vmax);

//Can be used to indicate that each particle must have a fixed color but chosen from a range. You specify a range in the hue saturation and value component of the color (each between 0 and 255).

 Particle Life

Action Function:

1

action_parttype_life(type id,min,max);

GML Code:

1

part_type_life(index,life_min,life_max);

 Particle Speed

Action Function:

1

action_parttype_speed(type id,min speed,max speed,min dir,max dir,friction);

GML Code:

1

2

part_type_speed(index,speed_min,speed_max,speed_incr,speed_rand);

part_type_direction(index,dir_min,dir_max,dir_incr,dir_rand);

 Particle Gravity

Action Function:

1

action_parttype_gravity(typeid,amount,direction);

GML Code:

1

part_type_gravity(index,grav_amount,grav_dir);

 Particle Secondary

Action Function:

1

action_parttype_secondary(type id,step type,step count,death type,death count);

GML Code:

1

part_type_death(index,death_number,death_type);

 Create Emitter

Action Function:

1

action_partemit_create(sm,shape,xmin,xmax,ymin,ymax);

GML Code:

1

2

3

4

index=part_emitter_create(ps);

// ps is the index of the particle system. You must assign this to an index.

part_emitter_region(ps,index,xmin,xmax,ymin,ymax,shape,distribution);

//ps is the index of the particle system. Index is the index of the emitter.

 Destroy Emitter

Action Function:

1

action_partemit_destroy(emitter);

GML Code:

1

part_emitter_destroy_all(ps) //ps is the index of the emitter.

 Burst from Emitter

Action Function:

1

action_partemit_burst(emitter,type,number);

GML Code:

1

2

part_emitter_burst(ps,index,parttype,number) ;

// ps is the index of the particle system. Index is the index of the emitter. Parttype is the index of the particle.

 Stream from Emitter

Action Function:

1

action_partemit_stream(emitter,type,number);

GML Code:

1

part_emitter_stream(ps,index,parttype,number);

CD

قبل از استفاده از دستورات کار با CD باید تابع زیر را فراخوانی نمایید:

1

cd_init();

 Play CD

Action Function:

1

action_cd_play(start track, final track);

GML Code:

1

cd_play(first,last);

 Stop CD

Action Function:

1

action_cd_stop();

GML Code:

1

cd_stop();

 Pause CD

Action Function:

1

action_cd_pause();

GML Code:

1

cd_pause();

 Resume CD

Action Function:

1

action_cd_resume();

GML Code:

1

cd_resume();

 Check CD

Action Function:

1

2

3

4

if(action_cd_present())

{

 //Actions Here…

}

GML Code:

1

2

3

4

if (cd_present())

{

 //actions here.

}

 Check CD Playing

Action Function:

1

2

3

4

if(action_cd_playing())

{

//Actions Here…

}

GML Code:

1

2

3

4

if (cd_playing())

{

 //actions here.

}

Other

 Set Cursor

Action Function:

1

action_set_cursor(sprite,show cursor); //show cursor 1=true, 0=false

GML Code:

1

window_set_cursor(curs);

به جای متغیر curs یکی از ثابت های زیر را قرار دهید:

cr_default
cr_none
cr_arrow
cr_cross
cr_beam
cr_size_nesw
cr_size_ns
cr_size_nwse
cr_size_we
cr_uparrow
cr_hourglass
cr_drag
cr_nodrop
cr_hsplit
cr_vsplit
cr_multidrag
cr_sqlwait
cr_no
cr_appstart
cr_help
cr_handpoint
cr_size_all

برای استفاده از یک سپرایت به جای اشاره گر ماوس از کد زیر استفاده کنید:

1

cursor_sprite=sprite0;

آموزش کد اکشن های گیم میکر

کامنت ها

لطفا اگر سوالی نامرتبط با این مطلب دارید، از تب «پرسیدن سوال» استفاده کنید

پاسخ دهید

نشانی ایمیل شما منتشر نخواهد شد.

لطفا اگر سوالی خارج از موضوع این مطلب دارید آن را در فروم مطرح کنید.

<