Log in
Search
GameML File Sharing
USERNAME: gamemladmin@gmail.com PASSWORD: gamemlsite Upload Here: https://gameml.forumotion.com/GameML-File-Sharing-h3.htmPlease add only games.Simple Codes by 3d
4 posters
:: Game Making :: Game Maker Help :: Game Dev. Q&A :: GML help (Coding)
Page 1 of 1
Simple Codes by 3d
Here are codes that people need alot, that i made and codes I've found. If you have a code you want to submit, post it in a comment and i will add it, pm me, or email me.
Look at mouse
image_angle=point_direction(x,y,mouse_x,mouse_y)
Create an object where your object is standing.
instance_create(0,0,obj_object)
opens up/closes 3d mode
d3d_start()
d3d_end()
how to do the relative selection in code.
speed+=1
vspeed+=1
hspeed+=1
destroy
instance_destroy()
how to code with a keypress that is a letter
if key_press(ord_"W"))
How to do passwords
password = get_string("Please enter a password"", "" );
switch(password)
{
case "password 1" :
room_goto(rm_level_1);
break;
case "password 2":
room_goto(rm_level 2);
break;
default :
show_message("Password Invalid");
break;
}
(from gamemaker.wikicomplete.info)
go to next room
room_go_to_next()
Look at mouse
image_angle=point_direction(x,y,mouse_x,mouse_y)
Create an object where your object is standing.
instance_create(0,0,obj_object)
opens up/closes 3d mode
d3d_start()
d3d_end()
how to do the relative selection in code.
speed+=1
vspeed+=1
hspeed+=1
destroy
instance_destroy()
how to code with a keypress that is a letter
if key_press(ord_"W"))
How to do passwords
password = get_string("Please enter a password"", "" );
switch(password)
{
case "password 1" :
room_goto(rm_level_1);
break;
case "password 2":
room_goto(rm_level 2);
break;
default :
show_message("Password Invalid");
break;
}
(from gamemaker.wikicomplete.info)
go to next room
room_go_to_next()
Re: Simple Codes by 3d
Easy value swapping (true becomes false, false becomes true):
Drawing a default sprite (pro)
- Code:
boolean = !boolean
- Code:
gravity = place_free(x, y+1);
- Code:
grid_x = argument0;
grid_y = argument1;
obj = argument2;
image_index = 1 * place_meeting(x, y + grid_y, obj) +
2 * place_meeting(x, y - grid_y, obj) +
4 * place_meeting(x + grid_x, y, obj) +
8 * place_meeting(x - grid_x, y, obj);
Drawing a default sprite (pro)
- Code:
draw_sprite_ext(sprite_index,image_index,x,y,image_xscale,image_yscale,image_angle,image_blend,image_alpha);
- Code:
draw_sprite(sprite_index, image_index, x, y);
- Code:
draw_set_valign(fa_center);
draw_set_halign(fa_center);
Time- GameML Noob
- Posts : 22
Points : 54601
GameML Reputation : 3
Join date : 2009-06-01
Age : 31
Re: Simple Codes by 3d
3d, your code's have several errors in them. Hardly helpful to beginners, e.g.
it is room_goto_next() NOT room_go_to_next();
And it is NOT if key_press(ord_"W")), it is
if keyboard_check(ord('W')), there is not function called key_press.
And as for this
If you want to create an object where you stand, do this.
I hope this clears this up for you, we don't want to mis-inform/confuse beginners!
it is room_goto_next() NOT room_go_to_next();
And it is NOT if key_press(ord_"W")), it is
if keyboard_check(ord('W')), there is not function called key_press.
And as for this
This will only create an object in the top left hand corner of the room, try it.
Create an object where your object is standing.
instance_create(0,0,obj_object)
If you want to create an object where you stand, do this.
- Code:
instance_create(x,y,obj_object);
I hope this clears this up for you, we don't want to mis-inform/confuse beginners!
Desert Dog- GameML Noob
- Posts : 5
Points : 54452
GameML Reputation : 1
Join date : 2009-06-12
Similar topics
» The Conduit Codes
» Some useful engines, codes, and modelers to get you started with 3d
» A simple code
» How do you make simple blood in a game?
» Simple Platform Game Code
» Some useful engines, codes, and modelers to get you started with 3d
» A simple code
» How do you make simple blood in a game?
» Simple Platform Game Code
:: Game Making :: Game Maker Help :: Game Dev. Q&A :: GML help (Coding)
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|