VBGamer |
|
RE: a thing about classes Jay Wheeler (0 replies, 0 views) (2000-Jul-22) I would have to disagree, the difference between UDTs and classes is rather enormous! My current engine is my first working with classes and I must say they are MUCH better than writing subs and functions to do everything. Especially when you use the power of collections with classes you can do really neat things. You can have a huge collection of all visible sprites, and objects, and everything, and then do something like this:
for each object in myCollection
object.render()
object.update(elapsedTime)
next
The collection can grow and shrink dynamically without having to Redim Preserve an array (although this is also true of UDTS). But the difference is you can then write render and update methods for all sorts of things, like the other poster mentioned -- it could be a tank, or a porn star, or a tennis racket -- it doesn't make any difference. If you used UDTs you'd have to have a huge select case statement, and your code would be a lot less portable.
|