Jump to content

Game Maker Programming/Intro

From Wikibooks, open books for an open world

Programming: An introduction

[edit | edit source]

Before you even begin programming, it would be a good idea to understand a little bit about what you are getting into. This chapter will help you understand the purpose of programming, as well as some basic concepts of it.

Getting things done

[edit | edit source]

The point of any program is to accomplish some task, whether it be as simple as a calculation or as complex as a computer game, a program gets something done. Think of the computer as a person awaiting instructions; You must speak that person's language in order to tell them what you want done, and you must give that person your instructions. It is the same with the computer, you need to know the computer's language as well as give it instructions in that language.

That is what a program is, a series of instructions in the computer's language.


Note: A Programming language is not really the language a computer uses. The computers native language is actually Binary. Computers therefore need a Compiler to translate from code to Binary.

Instructions

[edit | edit source]

As mentioned earlier, a program is a series of instructions in the computer's language. And just as English has words and grammar, so does a programming language.

Let's say you wanted Bob to go to the store and get some eggs. You could say,

"Bob, go to the store."

Bob would not get you your eggs though. He would go to the store, just as you instructed him however. The same concept applies to programming; you need to tell the computer exactly what you want done, because the computer won't be able to guess what you mean. So instead, you tell Bob:

"Bob, go to the store - eggs."

This time, Bob might get the eggs; but only because he could guess you meant to get some eggs. But a computer would not understand you if you programmed like that. Instead you would tell Bob:

"Bob, go to the store and get 12 eggs; be back at 5:00." This would tell Bob exactly what to do.

Your instructions (programs) should always be precise, using the correct grammar of the programming language. Remember, a computer can only do what you tell it to.

Language

[edit | edit source]

In order to give your computer instructions however, you must know a language you can talk to it in. In this case the language is Game Maker Language (GML). You will learn more about GML in the upcoming chapters.