Cloning the code AND variables? For enemies & other repeated characters
FranzKeller
Member Posts: 517
So I'm making a "defense" title, but this applies to many things -
I have one type of character with the actions that he should have -
he moves, and he has "hit points", stored in 2 variables, max and current HP.
So I selected these actions to copy it to the next "type" of enemy, a stronger one,
with intent to just increase the stats inside of course
BUT the variables didn't copy, so the code ends up fairly empty.
So, knowing I want to have several types of enemies, with different artwork
and some difference in stats and behavior,
but largely coded the same,
what is the most efficient way to achieve that?
I have one type of character with the actions that he should have -
he moves, and he has "hit points", stored in 2 variables, max and current HP.
So I selected these actions to copy it to the next "type" of enemy, a stronger one,
with intent to just increase the stats inside of course
BUT the variables didn't copy, so the code ends up fairly empty.
So, knowing I want to have several types of enemies, with different artwork
and some difference in stats and behavior,
but largely coded the same,
what is the most efficient way to achieve that?
Comments
Use command and 'C' to copy.
Use command and 'V' to paste.
You now have a copy of the first actor, with all rules and variables intact inside!
Hope that helps!
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
I guess this is fairly obvious! Just as long as one remembers that "actors" and "images" are actually SEPARATE entities
(though one might think of them as the same when first arriving, because a new shape seems to set up a new actor on import?)
Better to import them into the 'images' section below if you're going to be using similar actors with similar rules. Then you can just drag the image onto your copied actor, as you stated.
Cheers,
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
And yet, then they come up as twice the normal size of the image?
(Yes, I'm using resolution independence on this one)
So then I can go back and enter the numbers in the size field,
but it still doesn't look quite? right
[I wish there was % sprite scaling in GS as well as direct number specification.]
Also - is there a good way to drag actors without accidentally stretching or rotating them?
All those handles
So yes, you just rescale it in actor's size parameters.
I've not found a good way to move actors in the way you mean though
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
That IS a really handy feature though, so we dont have to recode it for 2 sizes.
Perhaps they could just make the rescale / rotate happen while holding down the shift key or something? And otherwise, just move it.
And as is the convention - option = leave the one that's there and copy a new one
as in Illustrator, PSD, etc, etc.
Handy for making backgrounds and crowd scenes...