Topic: Game Programming /
[Resolved] Detecing distance to player?
I wouldn’t exactly say that AS3 doesn’t let you code like that anymore. It only lets you do it if you have a reference to some DisplayObject that’s in the hierarchy, but they do have a root property that can be used in much the same way. AS3 is pretty ridiculous in a lot of ways in that are really going to hurt the platform, but that’s another discussion for another day.
I’ve been professionally coding for a long time too, with about 8 years of Flash experience. I don’t use _root a whole lot myself, but it certainly has its uses. If you’re providing certain kinds of API to users, it makes a great default MovieClip reference because it’ll work for maybe 99% of most use cases with less work for the user. It’s also where you get URL variables, find out how big your SWF is and if it’s fully loaded, etc.
My real point is that people should do whatever they can get done quickest, provided that it works under the constraints they need it to. Games especially, because they’re usually relatively “throwaway” projects that are quite self-contained. Maybe Kongregate has some problems loading stuff, but only because they did it wrong. For the most part you just can’t load arbitrary movie clips and expect them to do the right thing (until Flash 9) because the Flash player simply wasn’t designed very well at the time. Unless of course you’re also advocating that everyone should use the same frame rate and that not using the same frame rate is bad because it won’t work in “complex situations”.