I gotta go with Axel on this one, as I'd rather do two lines, then a whole slew of code to get shadows.
Btw this works, and works well enough, as I tested it at work, and even when I gave EVERYTHING a shadow, the game ran fine. The only way this is going to slow things down, is if your computer is a outdated POS.
Flava, Phizzy: How do you even know that it really DOES slow the game down? Right now you're just assuming so because it's (to you) an awkward way of coding it. At least prove me wrong before jumping to conclusions. o_O
No, it's called common sense.
If you want to be unprofessional then fine be lazy and use a two line piece of code. I've just run both programs on my computer and your method uses up more memory. Try it yourself. Okay, it doesn't use up much more memory - but put the rest of your games objects in there and it could prove to be a difference on certain computers.
Your method works fine - if you want a ton of bouncing balls with no animation and no actions at all, then you can use your methods. I'm just saying that spreading values is more efficient, uses less memory and allows the creator/developer to do more things with the objects (such as animating, destroying .etc). And even if it is a few more lines of code - the idea to being a game creator is not to be lazy. If you're lazy, then your game will suck.
I'm just saying - you'll have to add backdrops, scrolling, characters, weapons and all kinds of other things moving at once. And while the player is playing a shadow (which will probably have semi-transparency?) will be created every single split of a second and then destroyed.
Sure, use Axel's method - it probably won't make too much a difference. But please don't be lazy with anything else.
It may be a lazy and unproffessional approach, but it's not the end of the world, and it's a lot easier than messing around with spread a value and fastloops, which can be pretty hard unless you know what you're doing.
I'd probably use the spread a value version myself actually, but it's Del Duio's own choice which method he wants to use in his game
So it sounds to me like a spread value basically makes active objects into a single dimensional array. If so, that's just what I want then. Thank you for all of your replies!
--
"Del Duio has received 0 trophies. Click here to see them all."
"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"
DXF Games, coming next: Hasslevania 2- This Space for Rent!
That will only work for a single object. It may kinda-work for several (MMF showing rare intelligence) but the game will get confused before long, and there's no way to manage destructions. So no. That's almost as horrible as Axel's method.
Spreading values allows you to somewhat assign a 'unique ID' to each shadow and object.
So a shadow with ID 1 will assign to the object with ID 1 .etc
This way, you can delete both the object and the correct shadow, or change animations of each or whatever.
Basically spreading values lets you do more things and is completely bug free (if you do it correctly)
See my last post. That does work thanks to some sort of magic, but it can get confused and there's no guaranteed way to manage destructions. I would use either spread values or my original suggestion, depending whether the enemies are already in the frame or are created at runtime.
Keep in mind that just because you can do something in less events doesn't mean that less instructions are required to actually achieve it: I'm not sure exactly what happens when you use that method, but I can imagine it being some complex stuff, each and every frame, to determine which objects aren't paired with a shadow and vise versa, then allocation, then the actual positioning. While on the other hand if alt values are used to find the object focus directly, it's conceivably (and I'd say likely to be) more efficient.
What Werbad said is correct... works fine! It's simple to manage destructions as well.. when a unit dies, destroy 1 shadow.. when a unit is summoned add 1 shadow...