For my next project I want to have all the armor pieces show up on my hero. Now the first way that I know would work would be to draw exactly ONE HUNDRED THOUSAND frames of animation for each movement for all the different possible types of armor in the game.
However, I'm fresh out of time for drawing ONE HUNDRED THOUSAND frames of animation, so I want to try something that I've never gotten to work right in the past.
I was thinking of having separate active objects for the pieces- Helmet, Shield, Body Armor- and having them "always" stick to the guy at a certain point and overlap him to give him the illusion of being a fully decked out warrior. The big problem I've had in the past is that there's ALWAYS a little bit of lag when he moves around, especially at faster speeds, and said armor pieces seem to drag a bit behind him. Not by much, but really noticable.
I played Wandering Fighter and I guess it uses an overlapping armor system much like what I want, but I'm guessing that for that game it was no problem because the hero moves like molasses so there's no apparent lag.
Question: Has anybody ever done anything like this and been successful? It'd really make my game look a lot better if I could get this to work without that awful lag that even happens during "always" events.
Thanks!
--
"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!
Thanks Nim I do know about that but it sometimes still lagged a bit.
How about always setting the armor pieces to 0,0 of the hero? If I just make the pieces where they would be in the same 32 x 32 box with Rovert like above?
If I could get this to work I think it'd be great.
Edited by the Author.
--
"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!
If you set the armor to 0,0 of the hero, it will still lag a little. Maybe your missing the point of what Joe said?
So in that example, make a 3rd object (mask). This object does the movement and you set both the hero and the helmet to 0,0 of the 3rd object, so that both the hero and helmet lag at the same time.
Thats how i do stuff usually. But i have an Always event at the very bottom of the events list to set positions to 0,0 of the mask.
Then if they still wont match up perfectly you can always make all the objects move at exactly the same time as the mask in the main movement code.
ie
upon holding left,
move character x - 1, move group.armour's x - 1, move group.detectors' x - 1.
Or, you could use a invisible object to represent the player (I usually use the invisible box as a hit detector), then set the body, armor, sword, etc. to that invisible object. Then all the objects will move the same, as they will be "lagged" relative to the invisible object.
A cheap method is to have all your object parts have the same default movement, in addition to the always relocate event. They'll almost always stick together without lag if you do that. A similar principle can be applied to custom engines.
They way I do it in my games is not to relocate the objects to follow the leader; instead I give them relocation actions in the same event. It's important however that these actions come AFTER the main object. Example:
xinertia of MainObject > 0
--MainObject: set X position to X(MainObject) + (xinertia(MainObject)/4)
--ObjectPart1: set X position to X(MainObject)
--ObjectPart2: set X position to X(MainObject)
The following would be equivalent, but action order is irrelevant (though event order is not):
xinertia of MainObject > 0
--MainObject: set X position to X(MainObject) + (xinertia(MainObject)/4)
--ObjectPart1: set X position to X(ObjectPart1) + (xinertia(MainObject)/4)
--ObjectPart2: set X position to X(ObjectPart2) + (xinertia(MainObject)/4)
That's probably an excessive example, but how you need to do it depends on your engine.