Anime Galaxy
Would you like to react to this message? Create an account in a few clicks or log in to continue.


Free Anime Community!
 
HomePortalLatest imagesSearchRegisterLog in
Directory

Share
 

 [PRG] Programming Basics

View previous topic View next topic Go down 
AuthorMessage
MugenAttack
Admin
Admin
MugenAttack

Posts : 44
Otaku Meter : 98
Likes : 0
Join date : 2012-07-28

[PRG] Programming Basics Empty
PostSubject: [PRG] Programming Basics   [PRG] Programming Basics EmptyMon Sep 03, 2012 7:30 pm

these things are in every programming language and should help you understand how they work
the examples are in GML(Game Maker Language)



1. Variables
variables are used to store simple data like a number or a word
and can be user defined in some cases.
the stored data can be changed to

Example:

Code:
var xyz = 123
   
   var word = "string"


2. if statements
a. if then statements
basically if every thing is before the "then" is true then the code will execute after it
or in between {} for some languages (that was basically a if then statement)

Example:

Code:
var Money = 100   

   if Money < 100 then {i am broke}


3. loops
there are 2 kinds of loops, for loops and do loops

for loops are good if you want something to repeat for a certain number of times every time you execute it

Example:
Code:
for( i = 0; i < 5; i += 1 )
{
    show_message( "Hello!" )
}
//this will show the message hello 5 times

do loops are good if you are uncertain of how many times you are going to loop through the code

example:

Code:
var index = 0
do
{
index = index + 1 \\math in programming is pretty much self explanatory

}until (index = 5)

//this will loop 5 times until it will stop



more to come......



each programming language has many other things but i will not cover those cause they are language specific this is the basics that all languages
use.
Back to top Go down
KuroKitsu
Member
Member
KuroKitsu

Posts : 43
Otaku Meter : 59
Likes : 0
Join date : 2012-11-29
Age : 32
Location : Kitsu Heaven-God of the Kitsu Nyaa~

[PRG] Programming Basics Empty
PostSubject: Re: [PRG] Programming Basics   [PRG] Programming Basics EmptyFri Nov 30, 2012 12:32 am

Looks good. I never touched GML, but I do hope that you would go into OOP and possibly pointers. The example you provided for the do-until statement seems a bit off, how about something like this:

int x = 0

int y = 5 // x or y can be anything

do{

x++;

}while (x < y)

It would probably better illustrate that you use it when you don't know when the loop ends.
Too use to using Java lately.....pardon me ^^;
Back to top Go down
http://kisuke-matamune.deviantart.com/
MugenAttack
Admin
Admin
MugenAttack

Posts : 44
Otaku Meter : 98
Likes : 0
Join date : 2012-07-28

[PRG] Programming Basics Empty
PostSubject: Re: [PRG] Programming Basics   [PRG] Programming Basics EmptyThu Dec 06, 2012 6:08 pm

i am just going to go into the basics most languages have. pointers i see mostly in C languages and i never really used them except for the C codeing class i am taking which i have trouble using them. i know how pointers work but i usually get the syntax wrong.

also gml is what game maker uses to code games in when you prefer coding over the drag and drop tools
Back to top Go down
KuroKitsu
Member
Member
KuroKitsu

Posts : 43
Otaku Meter : 59
Likes : 0
Join date : 2012-11-29
Age : 32
Location : Kitsu Heaven-God of the Kitsu Nyaa~

[PRG] Programming Basics Empty
PostSubject: Re: [PRG] Programming Basics   [PRG] Programming Basics EmptyThu Dec 06, 2012 6:41 pm

So this is more like C then? But yeah pointers are tedious, not too difficult just a pain to debug
Back to top Go down
http://kisuke-matamune.deviantart.com/
Sponsored content




[PRG] Programming Basics Empty
PostSubject: Re: [PRG] Programming Basics   [PRG] Programming Basics Empty

Back to top Go down
 

[PRG] Programming Basics

View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Anime Galaxy :: Tech Center :: Tech Head-