how can I do an actor (PNG image) follows other actor (PNG image)?

novonovo Member Posts: 11
edited December 2011 in Working with GS (Mac)
Hi guys,

I have two PNG image of a ball: one is only the ball and another is the ball with the shade.

I need to use the ball alone for collisions, but visually I need to also see the shadow. I have therefore thought the best option is to overlay the two images, and then one (the ball with shade) follows the other (ball one). How I can do it in GS?

Thank you.

Comments

  • novonovo Member Posts: 11
    I wrote "shade" but I mean "shadow" (sorry).
  • novonovo Member Posts: 11
    Thanks zNiiC for the link (I had alredy read before), but it doesn't work. I'm using acelerometer to move the ball. The problem is when the ball moves to fast the shadow stays behind for a moment and you can see the trick (there are two different images). How can I solved it?

    It seems rather simple: I just want a ball with a shadow, when colliding with other actors don't use this shadow, use only the ball.
  • zNiiCzNiiC Member Posts: 74
    edited December 2011
    when colliding with other actors don't use this shadow, use only the ball.
    Im confused. Can you make a video or something.
  • MotherHooseMotherHoose Member Posts: 2,456
    edited December 2011
    think you could open the ballShadow.png in your image making program... and erase/cut/delete the ball... saving only the shadow
    then only the shadow would be visible in the accelerator motion...+++ you save bytes!

    MH
  • novonovo Member Posts: 11
    I have prepared an image that shows the problem pretty well:

    http://imageshack.us/photo/my-images/18/ballshadow.jpg

    1. On the left column you can see the ball with and without shadow (two PNG actors).

    2. On the right column you can see what happens when two players collide:

    - Ball without shadow hits perfectly with another actor and it is clear that there is contact between them.

    - When the ball with shadow collides with another actor there is no contact, the shadow creates a kind of barrier between the two balls that avoids contact.

    I want the ball with shadow moving in my game (acelerometer), but when collides with other actors contact occurs and the shadow is not a problem.

    I hope you understand my question now.

    Thx.
  • mu-kowAPPSmu-kowAPPS Member Posts: 233
    Why can't you just constrain the shadow to the ball with a small offset. (ball.x-2) (ball.y-2)
  • MotherHooseMotherHoose Member Posts: 2,456
    well technically they are in contact with each other...the edges of the .png(s) are touching
    ....the ballShadow.png has a lot of transparent cells...and they factor in events such as collision, touch, etc.

    remove the collide rule/behavior from the ballShadow.png

    MH
  • novonovo Member Posts: 11
    mu-kowAAPS I can't do a simply constrain because the speed (as explained above). Perhaps with this image you will understand what I mean:

    http://imageshack.us/photo/my-images/714/ballshadow2.jpg

    The ball moves with the accelerometer. When the speed is slow, the device can update the position of the two images in real time. But when the speed is high (because the user rotates the IPHONE quickly) the game can not update the position of both images in real time (the ball goes forward and the shadow follows a short distance).

    MotherHoose I've removed the collide behavior from the ballshadow.png, but nothing chages.

    Any more suggestion?
Sign In or Register to comment.