An easy way to add shadows to multiple actors?
Hey guys,
Just wondering if theres an easy way to add shadows to my actors.
Ive got about 10 actors per scene and it would take ages to make global variables and manually attach shadow actors to each actor. Is there an easy way to do this?
Thanks!
Just wondering if theres an easy way to add shadows to my actors.
Ive got about 10 actors per scene and it would take ages to make global variables and manually attach shadow actors to each actor. Is there an easy way to do this?
Thanks!
Comments
Create 2 Game attributes. Make them Real
Call them playerX and playerY
In the actor you want to have a shadow
Constrain your players x and y to the new game attributes playerX and playerY
Then in your shadow actor, constrain his X and Y to the the first actors x and y.
Now drop the shadow actor anywhere on the screen.
Expect this to kill your performance if you do it for all your actors.
Example
Main Actor:
constrain: game.playerX to self.position.X
constrain: game.playerY to self.position.Y
Shadow Actor:
Constrain: self.Position.X to Game.playerX
Constrain: self.Position.Y to Game.playerY
Also, you can add + or - to offset the shadow so it isn't directly "under" the actor.
Example would be
game.player.X+30
game.player.Y-15
Im hoping that maybe theres something where i can just spawn the shadow from the main actor and have it mimick that actor?
Have you considered actually embedding the shadow as translucent pixels in your actor's image, and even swapping between two sets of animations depending on whether a shadow is meant to be cast or not? This might yield better results with fewer constrains.
You could unlock each of the shadow instances in the Scene and simply Constrain them to the appropriate actor.
That will eliminate the need for global attributes - however, depending how your actors move, you will still up to 3 Constrains for each shadow: x, y, and rotation.
Multiplied by ten actors, that's 30 constrains. Most of the devices would just keel over!
Thats devastating. My graphics look so much better with shadows and really give the levels depth. Without them its not going to look how I'd hoped.
Fingers crossed the GS team will come up with a way to do this that wont destroy performance.
Thanks for the advice anyways.