Oddworld Forums > Zulag Three > Fan Corner


 
Thread Tools
 
  #1  
06-11-2009, 07:29 AM
Venks's Avatar
Venks
Clakker Store Clerk
 
: Dec 2005
: VA
: 759
Blog Entries: 23
Rep Power: 19
Venks  (128)Venks  (128)
GML: The only limit is your imagination.

Well that and file size.

Anyways seeing as there are multiple GM projects going on I thought I'd start writing up info on anything anyone asks me about so I don't have to explain the same thing to multiple people.
---------

Start with the basics
:
I'm sorry to say this but I don't no how anything in gamemaker works, I just got it and that's why I'm having other people program my game, do you think I should learn gamemaker first? if so how long do you think it will take?
I'm currently working alongside two people in the production of a fixed shooter game. Both of which are completely new to Game Maker. From my observations your ability to master Game Maker comes completely from your own ability to learn. Using Game Maker is really just manipulating Algebra equations to produce visual effects. So the more math strong you are the easier this will be for you.

And yes. You should learn how to program yourself. Do not bother with Drag n Drop. It's best to go directly into coding. The only features you should use for objects are the Create and Step Events. And the only Action in either of those Events should be the Execute Code Action.

The best way to learn how to program is by trying to code random things yourself. The best project for learning is a simple platform game. Though if you don't know how to program that can be problematic.
Say you want your character to move left when you hold down the left arrow here is what you would do:

In the Step Event of your character in the Execute Code Action you would write:
:
if keyboard_check(vk_left) x-=2;
Okay first off let me explain the Step Event. The Step Event means all of its actions are executed each step of the game. A step is how fast your game computes everything. The default speed of a room is 30. So there are 30 steps in one second. So if you held down the left key for a whole second then the code we wrote would be executed 30 times.

Now let me explain if. if tells the program to compute something only if all its conditions are met. Our condition in the above code is keyboard_check(vk_left). If all we put was x-=2; then our character would move to the left forever. But by putting the condition that the left key must be held down we now have more control over our player.

Now I will explain x-=2;
x is a variable already defined by Game Maker. If you've ever taken Algebra you'll know that anything can be a variable. MoomooActionCow could be our variable, but we'd have to define it. x on the other hand is already defined and is a lot easier to use. x in Game Maker refers to the x axis. If you've ever done graphs in math then you know what the x and y axises are. x is the horizontal path of left and right while y is the vertical path of up and down. By default in Game Maker every object's x starts to the very left and its y starts at the very top. So adding to x moves to the right. While adding to y moves downwards.

x-axis
-2 -1 0 1 2

y-axis
-2
-1
0
1
2

The last part you see in our code is x-=2;
What we're doing here is taking our object's x and subtracting 2 from it. That way we can move it to the left. Though be careful to write it as -=2 instead of =-2
If you mistakenly wrote it as =-2 then you would be setting your object's x to -2 instead of subtracting it by two. That would make your object teleport to the left side of the screen and just stay there.
---

I hope this has helped you. If you have any questions feel free to ask.
Reply With Quote
  #2  
06-11-2009, 12:55 PM
joshkrz's Avatar
joshkrz
Outlaw Cutter
 
: May 2009
: UK | West Yorkshire | Leeds
: 1,062
Blog Entries: 6
Rep Power: 16
joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)

I don't use GM, but it seems useful +rep. I was thinking of doing an AS version of this but it seems I'm the only one using it.
Reply With Quote
  #3  
06-14-2009, 07:14 AM
BlackVenom's Avatar
BlackVenom
Boombat
 
: Nov 2007
: Australia, Queensland
: 231
Blog Entries: 2
Rep Power: 18
BlackVenom  (186)BlackVenom  (186)

I've seen a lot of people in the fan section ask about Game Maker. This should help them out unless they don't know squat about scripting language...

+rep
__________________

Reply With Quote
  #4  
06-14-2009, 07:52 AM
joshkrz's Avatar
joshkrz
Outlaw Cutter
 
: May 2009
: UK | West Yorkshire | Leeds
: 1,062
Blog Entries: 6
Rep Power: 16
joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)

What's a scripting language..?

Tut tut BV, you should know I'm joking.

Last edited by joshkrz; 06-14-2009 at 09:00 AM..
Reply With Quote
  #5  
06-14-2009, 08:42 AM
BlackVenom's Avatar
BlackVenom
Boombat
 
: Nov 2007
: Australia, Queensland
: 231
Blog Entries: 2
Rep Power: 18
BlackVenom  (186)BlackVenom  (186)

:
What's a scripting language..?
There's different ways a script can be written out but those types can only be used if the program allows it. (each type is known as a scripting language) All I know is a few. C+, Action Script, Java Script... I know more just that they are at the back of my head atm...
__________________

Reply With Quote
  #6  
06-14-2009, 09:01 AM
joshkrz's Avatar
joshkrz
Outlaw Cutter
 
: May 2009
: UK | West Yorkshire | Leeds
: 1,062
Blog Entries: 6
Rep Power: 16
joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)

PHP is by far the best language, forget that ASP crap.
Reply With Quote
  #7  
06-14-2009, 06:14 PM
Venks's Avatar
Venks
Clakker Store Clerk
 
: Dec 2005
: VA
: 759
Blog Entries: 23
Rep Power: 19
Venks  (128)Venks  (128)

I'm quite a fan of the concept of ActionScript 3.0, but in actuality its really a bother sometimes.
Reply With Quote
  #8  
06-14-2009, 06:20 PM
joshkrz's Avatar
joshkrz
Outlaw Cutter
 
: May 2009
: UK | West Yorkshire | Leeds
: 1,062
Blog Entries: 6
Rep Power: 16
joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)

:
I'm quite a fan of the concept of ActionScript 3.0, but in actuality its really a bother sometimes.
Its too bad I learnt AS2. It's hard to make the switch.
Reply With Quote
  #9  
06-14-2009, 10:51 PM
moxco's Avatar
moxco
Zappfly
 
: Dec 2006
: Earth
: 2,794
Blog Entries: 26
Rep Power: 20
moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)

I am already quite familiar with HTML. Which would be the easiest programming language to use for GM?
Reply With Quote
  #10  
06-14-2009, 11:29 PM
AlexFili's Avatar
AlexFili
Wolvark Shooter
 
: Feb 2009
: NorthWest of England
: 3,127
Blog Entries: 78
Rep Power: 18
AlexFili  (1280)AlexFili  (1280)AlexFili  (1280)AlexFili  (1280)AlexFili  (1280)AlexFili  (1280)AlexFili  (1280)AlexFili  (1280)AlexFili  (1280)

I still think Flash is totally awesome. I'm sure GM has some advantages to it though.
__________________

[B]
I stream games and art now!
http://twitch.tv/ZephyrFloofyDerg
floofyderg.live

Reply With Quote
  #11  
06-15-2009, 12:41 AM
BlackVenom's Avatar
BlackVenom
Boombat
 
: Nov 2007
: Australia, Queensland
: 231
Blog Entries: 2
Rep Power: 18
BlackVenom  (186)BlackVenom  (186)

:
I am already quite familiar with HTML. Which would be the easiest programming language to use for GM?
You can't use HTML for GameMaker. It can only take C++ and i think another but HTML is usually for online things only.
__________________

Reply With Quote
  #12  
06-15-2009, 12:58 AM
moxco's Avatar
moxco
Zappfly
 
: Dec 2006
: Earth
: 2,794
Blog Entries: 26
Rep Power: 20
moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)moxco  (2195)

I know that. Then why would I be asking?
Reply With Quote
  #13  
06-15-2009, 01:07 AM
BlackVenom's Avatar
BlackVenom
Boombat
 
: Nov 2007
: Australia, Queensland
: 231
Blog Entries: 2
Rep Power: 18
BlackVenom  (186)BlackVenom  (186)

Sorry, I thought you were asking. well, The only scripting language that I know working for GM is C++...
__________________

Reply With Quote
  #14  
06-15-2009, 04:49 AM
joshkrz's Avatar
joshkrz
Outlaw Cutter
 
: May 2009
: UK | West Yorkshire | Leeds
: 1,062
Blog Entries: 6
Rep Power: 16
joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)

If you know C++ then why use GM when you can use Microsoft Visual Basic? Isn't that better?
Reply With Quote
  #15  
06-15-2009, 05:25 AM
BlackVenom's Avatar
BlackVenom
Boombat
 
: Nov 2007
: Australia, Queensland
: 231
Blog Entries: 2
Rep Power: 18
BlackVenom  (186)BlackVenom  (186)

:
If you know C++ then why use GM when you can use Microsoft Visual Basic? Isn't that better?
Not really, Visual Basic isn't a program designed that well for a game because it doesn't even have a basic game engine built into it. Although it can be done, Don't expect much from it and don't expect it to be done quickly either...
__________________

Reply With Quote
  #16  
06-15-2009, 09:56 AM
Venks's Avatar
Venks
Clakker Store Clerk
 
: Dec 2005
: VA
: 759
Blog Entries: 23
Rep Power: 19
Venks  (128)Venks  (128)

Game Maker uses its own language GML which is very similar to C++. In the end no matter what the language all you're really doing is manipulating data to display certain things.
Reply With Quote
  #17  
06-15-2009, 03:06 PM
Gretin's Avatar
Gretin
Clakker Relic Miner
 
: Jan 2005
: Lost in Space
: 818
Blog Entries: 1
Rep Power: 20
Gretin  (167)Gretin  (167)

I just thought I'd add a couple of things;

Yes, as Venks said, Game Maker uses its own language, which is similar to C and C++, as well as Paschal, but C++ won't always work in Game Maker. Mostly it's close enough that you could theoretically use the same code, but I just thought it's worth mentioning that GML isn't quite the same.

Also, while I agree you should try to use GML as soon as possible, I don't see why you can't use Drag & Drop at least to get the hang of how things work. Especially since in the latest Game Maker versions all the D&D actions just translate to GML anyway. But I guess it depends, I personally have always used the code, but for some people it makes more sense after using D&D first.

If you do use code, there are a few other events from Create and Step you can use, though, for instance in a project I'm working on the Draw event is used for many objects. Of course, that's for more advanced projects though. The main thing to watch out for in using the Step event is that you aren't doing too much calculations in every step, or it will slow things down. Simple checks like what Venks showed with his example aren't a problem, but if you start putting complex calculations in the Step event it'll make a big difference to speed.

And while I'm at my ranting, I might as well mention code structure It is important to make sure when you're coding that your code stays tidy, and comments are your friends! Although you may think you don't need to worry about any of that because you know what your code does, if you ask someone else for help they'll find it a lot easier to help you if your code makes sense. And remember, if you're working on a big project you may have to go back to your old code months after you wrote it, and it might not make as much sense now as it did back then.

For example, compare these two snippets of random code:

:
 
if x<=0 {x += 1; y += 2;} else if x>=10 {x -= 1; y -= 2;} 
 
else{if xprevious {x += 1; y += 2;} else{x -= 1; y -= 2;}}

:
 
if (x <= 0){ //if x is on the left side start moving to the right and up
  x += 1;
  y += 2;
}
else if (x >= 10){ // else if x is on the right side start moving to the left and down
  x -= 1;
  y -= 2;
}
else{ //if x is in between 0 and 10 keep moving the same direction
  if(xprevious < x){ //if the last x position is to the left of the current one move right
    x += 1;
    y += 2;
  }
  else{ //else it must be to the right, so move left
    x -= 1;
    y -= 2;
  }
}
I know which one I'd rather be reading!

The main differences are just comments (anything on the right of a // is considered a comment and Game Maker highlights it green just to make that clear - you can also use /* as the start of a comment block and */ to end it) to explain what everything does, each expression or statement is on a new line, and blocks are indented so you can clearly see what is under each block.
__________________
:
I'LL GET MAH STABBIN KNIFE!

Reply With Quote
  #18  
06-15-2009, 03:20 PM
joshkrz's Avatar
joshkrz
Outlaw Cutter
 
: May 2009
: UK | West Yorkshire | Leeds
: 1,062
Blog Entries: 6
Rep Power: 16
joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)joshkrz  (572)

Yerh the comments are a bit like AS, I try my best to add them in. Good thing Flash has a Auto Format feature
Reply With Quote
  #19  
06-22-2009, 08:39 AM
bobtheguy's Avatar
bobtheguy
Bola Blast
 
: May 2009
: location unknown
: 438
Rep Power: 16
bobtheguy  (37)

Hi, Venks, do you know how to make a "online chat room" inside GM7, that was going to be one of the features inside of my fan game, also do you know how to make it so that you can save your progress, is this possible?
__________________
bobtheguy
-sprite and graphic designer
-professional garden nome
-slig assasin fan game in progress, GRAPHICS UPDATE, click the link below...

Reply With Quote


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 








 
 
- Oddworld Forums - -