Log in

I forgot my password

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search
Who is Online ?
In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest

None

[ View the whole list ]


Most users ever online was 6 on Tue May 12, 2009 7:23 pm
Top posters
OmegraKai
 
AracnoX
 
Quinlan Vos
 
sebalex11
 
Ice Burner
 
GamerMom
 
StrandedGamer
 
Pennythescripter123123
 
drizzt7
 
Bloody Sage
 

Poll
Statistics
We have 20 registered users
The newest registered user is ttnnqq08

Our users have posted a total of 300 messages in 85 subjects

The Basic GML Code

Post new topic   Reply to topic

View previous topic View next topic Go down

Suggestion/idea The Basic GML Code

Post by OmegraKai on Thu Jul 24, 2008 9:09 pm

Lesson 1 CH 1
the basic code is saying a message, lets begin
{
show_message('Hello World")
}

that creates a dialog message for GM to read, simple.
TIP: always put brackets above and below on some code.

Now lets try something a bit harder.

if keyboard_check(vk_right)
{
x+=3
}

Now you see that I didn't put brackets above "If" in GM if is asking a question to GM and only following what goes when the parameters are qualified, so if is asking GM if the the right arrow key is being pushed, then when the key is pressed X meaning the horizontal postion, move the player right, + means relative, and if you want to move the player left use the same code but change it a little.

if keyboard_check(vk_left)
{
x+=-3
}

You put a negative before any X type of situation, meaning to go the opposite direction of X.

That is the first chapter in the GML basic code tutorial.

OmegraKai
Founder
Founder

Male Number of posts: 141
Age: 24
Mem. Points:
95 / 10095 / 100

Mod. Points:
100 / 100100 / 100

Warning Bar:
100 / 100100 / 100

Talk About your Self!: I am A Gamer!!
Registration date: 2008-04-06

Character sheet
Rate your Gaming ability's!:
74/100  (74/100)

View user profile

Back to top Go down

Suggestion/idea Re: The Basic GML Code

Post by OmegraKai on Thu Jul 24, 2008 9:54 pm

CH: 2

creating objects in GML is very easy just type this.

{
instance_create(x,y,object)
}

thats the simplest of all code actually.

Now lets make a harder one, lets say we wanted to create a object every 20 seconds. follow these steps

CREATE
alarm[0] = 20

ALARM 0
{
instance_create(x,y,object)
}

now every 20 seconds a instance is created. Now lets try repeating instances

repeat(10)
{
instance_create(x,y,object)
}

this way you have more control of how many you want.

that concludes our Chapter for today.

OmegraKai
Founder
Founder

Male Number of posts: 141
Age: 24
Mem. Points:
95 / 10095 / 100

Mod. Points:
100 / 100100 / 100

Warning Bar:
100 / 100100 / 100

Talk About your Self!: I am A Gamer!!
Registration date: 2008-04-06

Character sheet
Rate your Gaming ability's!:
74/100  (74/100)

View user profile

Back to top Go down

Suggestion/idea Re: The Basic GML Code

Post by AracnoX on Fri Jul 25, 2008 4:23 am

Thank you for that, I didn't know any code until this...

AracnoX
Moderator
Moderator

Male Number of posts: 46
Age: 13
Location: Wherever I feel like being.
Mem. Points:
20 / 10020 / 100

Mod. Points:
0 / 1000 / 100

Warning Bar:
100 / 100100 / 100

Talk About your Self!: Why do you want to hear this go away!
Registration date: 2008-07-15

Character sheet
Rate your Gaming ability's!:
0/0  (0/0)

View user profile http://aracnox.wordpress.com

Back to top Go down

Suggestion/idea Re: The Basic GML Code

Post by OmegraKai on Fri Jul 25, 2008 10:59 am

Smile I'm glad I helped once I fully know code I make a whole thing about it.

OmegraKai
Founder
Founder

Male Number of posts: 141
Age: 24
Mem. Points:
95 / 10095 / 100

Mod. Points:
100 / 100100 / 100

Warning Bar:
100 / 100100 / 100

Talk About your Self!: I am A Gamer!!
Registration date: 2008-04-06

Character sheet
Rate your Gaming ability's!:
74/100  (74/100)

View user profile

Back to top Go down

Suggestion/idea Re: The Basic GML Code

Post by sebalex11 on Fri Jul 25, 2008 5:03 pm

yeah this is going to help me make my new upcoming game

sebalex11
Newbie
Newbie

Male Number of posts: 34
Age: 15
Location: someweverywherehere
Mem. Points:
0 / 1000 / 100

Mod. Points:
0 / 1000 / 100

Warning Bar:
0 / 1000 / 100

Talk About your Self!: i like to make games and play them
Registration date: 2008-07-17

Character sheet
Rate your Gaming ability's!:
10/100  (10/100)

View user profile

Back to top Go down

Suggestion/idea Re: The Basic GML Code

Post by OmegraKai on Sat Jul 26, 2008 2:32 am

CH 3
okay now were going to move to copying functions of off of D&D system. lets start with the TAB "Move"

D&D tab lesson 1
Move

The first thing you see is a red arrow direction cube, this is for moving directions, we have actually already covered this but here is a refreshment.
{
x+=3
speed = 3
}

x+= moving right, change it to x+= -3 and that we'll become moving left. change X to Y to make it up and down.
speed just means what type of speed you want to have, you don't have to do this but it controls it more.

second is a blue direction cube, this may be a little harder but here. ( I don't know if its harder, because I don't know how to do it... Smile )

next is a move towards type of function which in code is this.

{
move_towards_point(x,y,3)
}

3 means the speed that you want the object to move to the point x,y. if you want it to move to a object,
use this

{
move_towards_point(obj_player.x,obj_player.y,3)
}

Now the other two, with the red arrow pointing down and sideways, is simple.

{
hspeed
}
is horizontal speed
{
vspeed
}
is vertical speed.

as a example vspeed can be used for jumping to stop.

here.
if vspeed > 0 && !place_free(x,y+vspeed)
{
move_contact(270)
}
vspeed = 0

this means if vspeed is less than 0 and there is a SOLID at position of vertical vspeed, move towards the object at direction 270 (down) then when it touches it vspeed = 0.

that's a pretty hard code. but an example none the less. Smile

now onto gravity. this one is simple, in step events you to have gravity,
{
gravity = 0.5
gravity_direction = 270
}
meaning the gravity = 0.5 and the direction is down.

that concludes our lesson for now.

OmegraKai
Founder
Founder

Male Number of posts: 141
Age: 24
Mem. Points:
95 / 10095 / 100

Mod. Points:
100 / 100100 / 100

Warning Bar:
100 / 100100 / 100

Talk About your Self!: I am A Gamer!!
Registration date: 2008-04-06

Character sheet
Rate your Gaming ability's!:
74/100  (74/100)

View user profile

Back to top Go down

View previous topic View next topic Back to top


Permissions of this forum:
You cannot reply to topics in this forum