Game Maker is a programme to make games, and has its own language,GML as well as an option to use a drag and drop build mode, similar to the Scirra/Construct app. Here in this post you will see exercises in GML mode. In the workspace,the folder structure usually appear on the right side and among others we will be using more the Objects, Sprites and Room folders. To start, lets make a test, drawing some very basic figures, writing some lines of code and testing with f5 (run code):
TEST 01
// Go to Object> Create>Object>name:obj_test
//in obj_test panel click events
//in obj_test /events add three events: create, step and draw.these are the three basics
//Then go to Rooms folder and go to the Room 1
//Drag obj_test into the room
//back to obj_test panel and in draw sub-panel write:
draw_circle()
//add parameters:
draw_circle(200,200,128,false)
//Add color:
draw_set_color(c_aqua)
draw_circle(200,200,128,false)
//And add another circle:
draw_set_color(c_aqua)
draw_circle(200,200,128,false)
draw_set_color(c_fucsia)
draw_circle(600,400,256,false)
//Just to play if you put it like this , both circles will be fuchsia:
draw_circle(200,200,128,false)
draw_set_color(c_aqua)
draw_set_color(c_fucsia)
draw_circle(600,400,256,false)
//Change the transparency:
draw_set_color(c_aqua)
draw_set_alpha(0.5)
draw_circle(200,200,128,false)\
draw_set_color(c_fucsia)
draw_circle(600,400,256,false)
/Draw also other shapes:
draw_set_color(c_navy)
draw_rectangle(0,0,room_width,room_height,false)
draw_set_color(c_olive)
draw_triangle(0,0,0,room_height, room_width/2, room_height, false)
//Now we can go to the create panel to create a variable:
circ1_x=200
circ1_y=200
circ1_r=120
//Go back to draw paneling replace the parameters for the circle:
draw_set_color(c_aqua)
draw_circle(circ1_x,circ1_y,circ1_r,false)
draw_set_color(c_fucsia)
draw_circle(600,400,256,false)
//Now I can go to Step panel and add:
circ1_x +=5
//sidenote: the words taht have color green if there are built in variables,
//purple if are your custom variables and red if they are constants within the
//programme also you can comment a line using "// "like in vanilla js and also you
//navigate the workspace pressing the space bar.
//Now I can go to Step panel and add:
if keyboard_check(vk_space){
circ1_x +=5
}
//Add another visual and add an interaction using these commands:
//direction keys(vk means virtual keyboard)
vk_up,vk_down, vk_left, vk_right
//function of the mouse cursor
mouse_x, mouse_y
//checks whether you are holding down left mouse
mouse_check_button(mb_left)
//also
make_color_rgb(255,255,255)
//or
random_range()
//for example, in the draw panel, obviously:
draw_set_color(make_color_rgb(mouse_x, mouse_y,0))
draw_circle(600,400,256,false)
//or:
draw_set_color(make_color_rgb(mouse_x/4,mouse_y/4,29))
draw_circle(mouse_x,mouse_y,100,false)
//You can use draw_text as well
//you run the code with f5
//you can go to the instance panel to the left of the screen and uncheck
Other links:
https://gamemaker.io/en/tutorials/how-to-make-buttons
https://gamemaker.io/en/blog/gui-layer-secrets
https://gamemaker.io/en/tutorials/gms2-tutorial-breakthrough
https://gamemaker.io/en/tutorials/coffee-break-tutorials-parallax-scrolling-gml
https://gamemaker.io/en/tutorials/easy-multiplayer-tutorial
https://gamemaker.io/en/tutorials/little-town-gamemaker-tutorial
https://gamemaker.io/en/tutorials/coffee-break-tutorials-simple-inventory-gml
https://gamemaker.io/en/tutorials/make-your-own-arcade-classic
https://gamemaker.io/en/tutorials/create-a-platformer-game-with-gml
https://gamemaker.io/en/tutorials/my-first-arena-shooter-gml
Comments
Post a Comment