Good way to constrain many drop shadows at once?

What I'm trying to do is create and constrain multiple (no more than 10) drop shadows at the same time. I have actors that are spawned and fly around the screen, and I want them all to have their own shadow that follows their x position (and ideally would also track the y position so the shadows could change shape as the flying actors rise/fall.) Basically imagine Fruit Ninja where all the fruits have a shadow that moves along the ground. (my game isn't fruit ninja, just using an example!)

Is there a good way to accomplish this, perhaps using tables? I haven't really used tables at all, so I'm not familiar with the capabilities. Of course I know how to do the constrains, I'm just trying to figure out a good way to track all those positions at once, then once a fruit is destroyed how to let another fruit use that table cell/attribute to store its position. I'm sure this is possible, so please don't just say it isn't. I realize it may be complicated but I'm willing to try anything. Any help is appreciated!

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I made a demo that uses health bars but you could easily adapt it for drop shadows by changing the offset position value.

    http://forums.gamesalad.com/discussion/comment/384027/#Comment_384027

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

  • K1dTrunksK1dTrunks PRO Posts: 55
    Thanks @tatiang, this is a good start. In your demo you use "every 0 seconds" instead of constrain. I've been wondering for a while, is this better on performance?

    Also, any ideas on how I could have the shadows shrink/grow as the tossed actors move up and and down? I'm having trouble figuring out how to do it based on the inverse relationship between the shadow's size and the height of the actor.
  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2013
    @K1dTrunks

    Check out my 'card toss' demo (might be some use?):

    (attached file in following post)
  • SocksSocks London, UK.Member Posts: 12,822
    ...
  • K1dTrunksK1dTrunks PRO Posts: 55
    Thanks @Socks. That's really cool, but in my game it's a side view, not a top-down, and what I really could use help with is how to make the shadow shrink as the y of the tossed actor increases. I'm guessing it's pretty simple to do but I can't quite figure out how to do it.
  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2013
    @K1dTrunks
    . . . how to make the shadow shrink as the y of the tossed actor increases.
    The size of the shadow will increase (rather than shrink) as the Y position increases (as a object approaches a source of light it will increasingly occlude the rays being cast by that source).

    So, you want your shadow to enlarge (and grow fainter) as your object goes up - and become smaller (and darker) as it approaches the ground.

    To achieve this simply link the shadow's size and opacity to the Y co-ordinate of the actor casting the shadow (with a little suitable maths).
  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2013
    Here's a quick demo for you: (attached file)
  • K1dTrunksK1dTrunks PRO Posts: 55
    @Socks - Thanks! Not sure what I was thinking. By the way, how do you attach a file to a post/include someone else's post in your own? I've been using Gamesalad for a while, but I'm kinda new to the forums.

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2013
    @K1dTrunks
    how do you attach a file to a post . . .
    When you are first making a post there is a 'Attach a file' link just below the box where you type.
    . . . . [how do you] include someone else's post in your own?
    Simply hit the 'quote' button at the bottom of the post you want to quote.
  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772
    I think you need to be pro to have the 'attach file' button, not 100% sure though.
  • K1dTrunksK1dTrunks PRO Posts: 55
    Thanks guys, I'm not seeing the "attach file" button. I can't imagine why that would be a pro only feature, but it seems that way.
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Yep, it's a PRO only feature. Sorry.
Sign In or Register to comment.