Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Complex Process Functions Replicated in Procedures?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Zampano




PostPosted: Fri Nov 30, 2007 9:52 am   Post subject: Complex Process Functions Replicated in Procedures?

I've heard a lot of talk in this forum about how processes will mess your program up, and how everything that is usually done with a process (except music) can be done with a procedure.
you've said how to do simple process tasks in a procedure, like shooting while moving. But how about more complex tasks, such as having an enemy move in a predictable pattern (walk south a bit, turn around 180 degrees, walk the same distance north, turn 180 again, and repeat).
To my knowledge this cannot be done in a procedure without making the program horribly long and needlessly complicated while the same can be done in a process.
Is there a remedy available to such a problem?
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Fri Nov 30, 2007 11:39 am   Post subject: RE:Complex Process Functions Replicated in Procedures?

This case is aucatly not that complex at all. Take the fallowing pesodo code for example:

code:

Load enemy objects in to array enemies
Load one instance of the class MyChar in to mainChar
..........

Main Loop
      mainChar.move();

      for enemies.length do
                 enemies[i].move();
      end
...........
end

................

Classs Enemy
..........
    Method move
            code to move enemy in some pateren
    end
........
end

Class MyChar
........
    Method move
              code to move main char
    end
......
end


Note: you do not need clases at all and it could all be done with procudes instened, but clases just make it look better and easyer to use.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: