13-05-2008 01DT!m3r said...
Tips and tricks
I started this thread for those who are still learning to program . The idea of this thread is for anyone who has a solution to a problem that they believe could be very helpful to others . Therefore they could post it up here so if another person has the same problem they could just pop in here and look for the solution . Like wise this thread could be used to posts tips and tricks on programming to help those noobs out there . Thanks
13-05-2008 dislekcia said...
and bettar-rar game developer than Wea-sel
Re: Tips and tricks
Good idea :)
Nostrick, you know what to do!
14-05-2008 Higushi said...
Re: Tips and tricks
Variables form the basis of just about everything you do in programming. They are extremely useful and without them it would be VERY difficult to write games, if not impossible.
This is a variable
This is a tutorial on variables - Its for C++, but the same concepts apply to all languages.
A variable is simply something that you store values (data) in, and those values could be text or numbers, or some other things which you don't have to worry about yet (as a beginner), see Data Types. Game Maker comes with a lot of variables already set for you to use and manipulate to get the results you wish (such as room_speed).
In Game Maker, say now an object is traveling across the screen. It has an inherent variable called "speed" which tells it how many pixels to move across per step (or something similar to that). So if you want to change the speed at which the object is moving, you need to directly manipulate that variable. If you want to speed it up, but want it to have a maximum speed (lets say 20) that it cannot go above, you would place something like this in the event of the button used to speed it up:
speed += 1 (or you could say: speed = speed + 1)
if speed > 20
speed = 20;
we say if speed is bigger 20, then set the variable to 20. This ensures that the variable "speed" never goes above 20.
You can also define your own variables. You could make a variable called "speed_limit" and set it to 20 and use that in the place of all the number 20s in the above example. This makes it easier for you to adjust your game's settings in the future, where you would normally have to go and change all of those numbers into a new speed limit, now you only have to change the variable speed_limit.
Last edited by Higushi; 14-05-2008 at 03:58 PM.