A ball with a dynamic 2.5D shadow HELP!

Discussion in 'Programming' started by VeSo, Feb 11, 2019.

  1. VeSo

    VeSo Member

    Oct 9, 2016
    Hey guys it's been a while- I'm making a cricket game a lot like this:[​IMG]
    It's a perspective-based 2.5D game and requires the ball to be hit in the air and along the ground.

    I'm really struggling to get this off the ground (literally) because I need the ball to offset the shadow according to a "bounce" variable that I've declared globally.

    This is what I'm trying to achieve:

    -Two objects obj_ball and obj_shadow
    -obj_shadow is the ACTUAL ball that will be interacted with by the players and the physics.
    -obj_ball is merely the object that hangs off the obj_shadow to make the player think the ball is a certain height
    -obj_target is the x,y, spot on the pitch where the ball is headed for upon release.

    > The bowler runs in, releases the obj_shadow
    > the bounce variable is set to 250 (the height of the ball at release)
    > the obj_ball object then must hang off of the obj_shadow in a STEADY offset on its way to the target object.

    This means, the balls image must fall to the shadow in a perfect gradient from the height (250) to the target.

    This can be calculated like:

    Distance to object target (which is about 1266px) divided by the bounce height (250) = 5.04.

    We have a number for the gradient, but we need to apply that number over the distance equally to give the impression that the ball is indeed on its way down!

    Any help appreciated!
  2. sp202

    sp202 Member

    Sep 26, 2016
    I'm confused, first as to why you're using two separate objects when you can draw the shadow within the ball object, and secondly as to why you're applying physics to the shadow (which will be at ground level at all times) and not to the ball.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice