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


0 Members and 1 Guest are viewing this topic.

EqwanoX


  • GMG Extraordinaire

  • ***


  • Posts: 1179
    • View Profile
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
    • View Profile
    • 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
    • View Profile
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
    • View Profile
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
    • View Profile
    • 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
    • View Profile
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.