Cloning the code AND variables? For enemies & other repeated characters

FranzKellerFranzKeller Member Posts: 517
edited November -1 in Working with GS (Mac)
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?

Comments

  • quantumsheepquantumsheep Member Posts: 8,188
    Select the character in the side view where all your actors are located.

    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 :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • FranzKellerFranzKeller Member Posts: 517
    ...and then, to change the look of the new copy, drag the other image onto them from the images list. Okay, I see, thanks.

    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?)
  • quantumsheepquantumsheep Member Posts: 8,188
    Yes, if you import an image into the actor pane, you'll make a new actor.

    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 :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • FranzKellerFranzKeller Member Posts: 517
    That mostly worked -

    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
  • quantumsheepquantumsheep Member Posts: 8,188
    FranzKeller said:
    That mostly worked -

    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

    Actually, I think that 'twice the normal size' thing is a bug - I've seen it a lot (and I'm NOT using the resolution thingy) and keep meaning to email Gendai about it! Been too busy!

    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

  • FranzKellerFranzKeller Member Posts: 517
    oh, I see. Perhaps a product of the new "resolution independence" or something.

    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...
  • Rob2Rob2 Member Posts: 2,402
    if you hold option/alt and drag n drop that copies in the inspector and on the stage
Sign In or Register to comment.