Game Maker's Garage Forum

Game Creation => Other Languages & Tools => Topic started by: EqwanoX on February 22, 2009, 12:09:00 PM

Title: object, event, proceedural orientation
Post by: EqwanoX on February 22, 2009, 12:09:00 PM
whats sc? and whats the best?
Title: Re: object, event, proceedural orientation
Post by: WarHampster on February 22, 2009, 03:09:28 PM
Well SC and GM are card based... and the code within the cards is procedural. Personally, I hate object oriented programming and love functional, but I'm sure everyone else will disagree with me.
Title: Re: object, event, proceedural orientation
Post by: Silverwind on February 22, 2009, 03:11:58 PM
Nope, procedural all the way for me. Actually that's ironic, since GM itself is an object in another language...
Title: Re: object, event, proceedural orientation
Post by: GMG Tim on February 22, 2009, 03:32:15 PM
Object-oriented programming is incredibly useful when you are making more advanced games. Imagine keeping track of 100 enemies. Just create on object for each one of them that contains the following info:

Code: [Select]
Class Enemy {
   string name
   int health
   int type
   int level
   int x
   int y

   method drawSelf() {
      drawimage x,y
   }
}

This way you just loop through all enemies in a list, and just do:

Code: [Select]
for enemy in enemylist:
   enemy.x = enemy.x + 1
   enemy.drawSelf()

Ghost
Title: Re: object, event, proceedural orientation
Post by: WarHampster on February 22, 2009, 05:31:10 PM
The exact same thing could be accomplished with

LET enemy$ = "health,type,level,x,y"
and some string field replacement tricks.

Or, in a language better than SilverCreator, you could use an array, list, or something similar.

OOP is more structured than procedural or functional, but it's syntax is often cryptic and it's compilers error prone.
Title: Re: object, event, proceedural orientation
Post by: Gnome on February 22, 2009, 06:21:10 PM
i like methods better, saves A LOT of code, and weird Timer Events