Topic:   object, event, proceedural orientation   (Read 20108 times)


0 Members and 1 Guest are viewing this topic.

EqwanoX


  • Administrator

  • GMG Extraordinaire

  • *****


  • Posts: 1180
object, event, proceedural orientation
« on: February 22, 2009, 12:09:00 PM »
whats sc? and whats the best?

WarHampster


  • GMG Extraordinaire

  • ***


  • Posts: 1501

  • The People's Moderator
    • Arcade of the Absurd
Re: object, event, proceedural orientation
« Reply #1 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.

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: object, event, proceedural orientation
« Reply #2 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...
I survived the spammage of 2007

GMG Tim


  • Administrator

  • GMG-er

  • *****


  • Posts: 465
Re: object, event, proceedural orientation
« Reply #3 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
« Last Edit: February 22, 2009, 03:32:53 PM by admin »

WarHampster


  • GMG Extraordinaire

  • ***


  • Posts: 1501

  • The People's Moderator
    • Arcade of the Absurd
Re: object, event, proceedural orientation
« Reply #4 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.
« Last Edit: February 22, 2009, 05:33:29 PM by WarHampster »

Gnome


  • GMG Extraordinaire

  • ***


  • Posts: 1073
Re: object, event, proceedural orientation
« Reply #5 on: February 22, 2009, 06:21:10 PM »
i like methods better, saves A LOT of code, and weird Timer Events

This Cannot be, NOOOOOOOO!!!!

-Gnomes Cry when the McRib was discontinued again.