I have created a new website called GameVenture.
At GameVenture I will be teaching others how to create games/utilites using the GML Programming Language.
You may be asking "Why GML?". GML is an extremely powerful programming language. I have a BS in Game and Simulation Programming/Computer Science with a minor in Mathematics using C++ and honestly, I feel like it was a waste of time. GML is not taught at colleges and may not be for quite some time. It is one of the best/easiest programming languages to learn and I find it just as powerful, if not more, than C++, C, Java, Python, ect...
When I finished college I found out about GML and immedieately quit C++. I have made great money using and creating games/applications with it and plan on using it the rest of my life.
So if you wan't to learn a great language and not have to go to college and spend thousands of dollars I suggest you get over to my site right now! Visit it and join at http://www.gameventure.net
Note - You should follow a number of the YoYo Games lessons before following these ones, and have GameMaker 8.1 Standard
Hello World -
We'll start with a traditional program to demonstrate how to write some simple code. We're going to create a script that shows the message "Hello World" on the screen.
Creating a simple script:
1. Start a new game.
2. Choose Create Script from the Resource menu. The script editor will appear.
3. In the Name box in the toolbar, give the script the name scr_hello.
4. In the editor, type the following piece of code:
//Display message 'Hello World'
5. Press the 10/01 button on the toolbar. This will test the program and display an error message if you made a mistake.
6. Close the editor by clicking the green checkmark in the toolbar.
Note that GameMaker shows parts of the code in different colors. This color-coding helps you know when your code is written correctly. For example, we know that show_message is the correct name for one of GameMaker's built-in functions because it has turned blue. If we had made a spelling mistake, then it wouldn't turn blue and we would know something was wrong. It is also particularly important to give your scripts meaningful names; that way, you can remember what the script dows when you use it in an action or some other code.
Before we can see what this code does, we need to execute it. To do so, we must create a new object with a key press event that executes the script.
Executing the script:
1. Create a new object and add a Key press, event to it.
2. Include the Execute Script action (control tab) and select the scr_hello script from the menu. The arguments can all be left at 0 since we do not use arguments in this script (more about these later).
3. Create a room and place one instance of the object in it.
Now run the game and press the spacebar. If you did everything correctly, a message box should pop up containing the text “Hello World”. If you made a mistake in your script, then GameMaker will report an error when the game loads or when the script is executed. If you do get an error, you should check the script carefully for typing errors. Even using an uppercase letter rather than lowercase can cause an error in GML—so take great care. Now let’s consider what this script does. The first and last lines contain curly brackets. Different kinds of brackets signify different things in GML, and curly brackets mark the beginning and end of a block of code (a bit like the Start Block and End Block actions). However, in GML every program must start with an opening curly bracket and must end with a closing bracket. Curly brackets enclose a block of code. Such blocks of code will also be used later at other places. The program consists of just one command. Such commands are called statements. A program consists of one or more statements. A statement ends with a semicolon. In this way, GameMaker understands where one statement ends and the next one begins. Don’t forget the semicolons!
The statement in our program is a call to the function show_message(). Functions can be recognized because they have a name and then (optionally) some arguments between the parentheses. We have already used such functions before as arguments in actions. For example, we’ve used the random() function in a number of places. Much like actions, functions perform certain tasks. The show_message() function has one argument, which is the text to be displayed; 'Hello World' is that argument. Take note of the single quotes around it as they indicate that this is a string (text). Also note that to make functions easier to recognize and to indicate that you typed their name correctly, they are displayed in a dark blue color. So when the script is executed, the one statement in it is executed, which shows the alert box containing the text that is provided as an argument. Of course, we could have achieved the same thing using the Show Message action. But as we will see later, by using scripts we can do many new things.