Actor shadow copies main actor movements

ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
edited March 2012 in Working with GS (Mac)
Hi guys

I have a main actor and a shadow actor and I need the shadow actor to copy what the main actor does.

The shadow actor sits underneath the actor.

I need it so whatever movement the main one does the shadow copies...this includes moving up and down and also rotating.

The actors are two tank shapes actors and the game is a top down view.

It takes a Zombie to know a Zombie!!!

Comments

  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Hey Zombiebrains,

    Could you constrain the actor to your main player? Or would it be easier to just add a shadow in Ohotoshop? Then you know it'll work. ;)
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Hi Braydon

    Yeah I could add a shadow in Photoshop but really wanted a separate actor as I wanted if possible a series of them, say up to 4 do it looks like a snake effect.

    It takes a Zombie to know a Zombie!!!

  • poopdecksweeperpoopdecksweeper Member Posts: 180
    you should make two attributes. actorX & actorY. Then constrain the shadow's position X & Y to those, but using a negative value only on the Y axis. so itll look like this:

    REAL Attributes:
    ActorX = 0
    ActorY = 0

    actor: constrain self.position.X = actorX
    constrain self.position.Y = actorY

    Shadow: constrain self.position.X = actorX
    constrain self.position.Y = -actorY-(height of actor)

    Make sure to set your shadow's alpha to around .3 that should make a nice shadow.

    good luck
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Hey poopdecksweeper

    Thanks a million for that workout....will try that later. :)

    Will report back if it works!!!

    It takes a Zombie to know a Zombie!!!

  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296
    Hi guys

    I found an easier way....

    I now spawn my shadow actor underneath my main actor every1 second then destroy it. It is also locked to my main actors x, y and rotate attributes so. Now it copies every move my main actor does.

    Thanks again for the ideas.

    It takes a Zombie to know a Zombie!!!

  • CloudsClouds Member Posts: 1,599
    edited March 2012
    you should make two attributes. actorX & actorY. Then constrain the shadow's position X & Y to those, but using a negative value only on the Y axis. so itll look like this:

    REAL Attributes:
    ActorX = 0
    ActorY = 0

    actor: constrain self.position.X = actorX
    constrain self.position.Y = actorY

    Shadow: constrain self.position.X = actorX
    constrain self.position.Y = -actorY-(height of actor)

    You have the first set of constraints backwards ! As it stands everything is constrained to zero.

    It should be:

    actor:
    constrain actor X to self.position X
    constrain actor Y to self.position Y
  • CloudsClouds Member Posts: 1,599
    Hi guys

    I found an easier way....

    I now spawn my shadow actor underneath my main actor every1 second then destroy it. It is also locked to my main actors x, y and rotate attributes so. Now it copies every move my main actor does.

    Thanks again for the ideas.

    You might want to 'recylce' the shadow actor rather than go down the spawn and destroy route if it's happening every 1 second.
  • mynameisacemynameisace Hull, UKMember Posts: 2,484
    edited March 2012

    You might want to 'recylce' the shadow actor rather than go down the spawn and destroy route if it's happening every 1 second.
    Here's goes Mr. Environmentally Friendly again :P

    In all seriousness, with global warming aside, Mr Environmentally Friendly is correct, recycling will by far be the best option for smooth performance.

    Ace
  • CloudsClouds Member Posts: 1,599
    Here's goes Mr. Environmentally Friendly again :P
    Don't get me wrong, I love a bit of 'spawing' (you should have seen me last weekend).
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Hey Zombiebrains,

    Ohotoshop? )
    Ohotoshop? Hmmm...

  • CloudsClouds Member Posts: 1,599
    Ohotoshop? Hmmm...

    I thought it was only me who knew about Ohotoshop™

    image
  • ZombiebrainsZombiebrains www.zombiebrains.co.ukMember, PRO Posts: 296

    Hi guys

    I use spawn and destroy quite a bit...how does this 'Recycle actor' thing work?

    Not heard of that...any examples would be great and any trick to speed up performance is a bonus :)

    It takes a Zombie to know a Zombie!!!

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @Zombiebrains Please don't revive old threads (this one is two years old).

    Plus, this information is not valid any more. It's fine to spawn and destroy. If you did want to recycle actors, you just move them back to their original starting point after you are done with them.

    /closed.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

This discussion has been closed.