How to create a shadow that changes in size at key down

0 favourites
  • 7 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • Hello,

    I'm making a game where the player controls an aircraft with arrow keys.

    Now I'd like to know how to get the shadow of the aircraft to become smaller as I press the arrow key up, and bigger again when the aircraft is moved down.

    The aircraft is bound to the layout so the shadow should stop increasing and decreasing in size when it reaches the layout border.

    I've already set the the shadow to always move with the aircraft.

    So anyone know how to do this?

    Thanks!! - R

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • y=opacity?

  • Hey Jomnitech,

    exactly like that! Thanks.

    Only also have the height changed too when moving?

    So that it'll scale in width and height at the same time?

    And if possible, how do I make the shadow still 'follow' the plane when the plane moves around? So that I get that 'distance' effect.

    How do you know all this coding? What to use and where to put it? I'm still learning but formulas confuse me a bit. How'd you learn it?

    Thanks.

  • There is a new capx who Change the Height too and goes a Little bit backward: https://www.dropbox.com/s/ui120uwc13fj6 ... .capx?dl=0

    Its a littel bit difficultto check if the Airplane its move up or it moves back or Forward. Dont know how <img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question">

    Are you looking for a depth effect?

    I`m a noob in Construct, learning coding by looking tutorials <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    Hope i understud you correct, my english ist not the yellow from the egg <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink"> (and auto correction makes a lot of crap stuff)

  • Hi Jomnitech,

    thanks man! That works well. I'm currently trying to figure out the formulas. My shadow image is 75x72 pixels and I'm not sure what the numbers in the formula mean or *do*. So my shadow is a bit skewed. Where did you get the numbers? 200, 40, and 500? And the 3 and 5?

    I'd like the shadow to move to the top more when moving the plane, but haven't figured out how to do it yet. I fiddled with the numbers but got unsatisfying results.

    Regards

  • The Shadow have a Instance Variable called YDistance

    • Shadow - Set X to Plane.X , says that the X coordinates always ist the same ase the plane. so when you move the Plane Forward or backword the shadow will follow.

    -Shadow set YDistance (this is the Instance Variable) to abs(planeY-ShadowY)/3 . Means alwasy calculate the difference of the altitute between Plane and Shadow. /3, do only set the result smaler to Looks more smoother.

    • Shadow set width to 200 ( ist the same width like Plane) - shadow.YDistance (Subtract the distance to make it smaler when the Plane flys upworts.)
    • Shadow set height ( do the same ase the width simply with the height)
    • Shadow Set Y to 500 -( shadow.YDistance) , i set to get a Little depth effect. you can toggle off ore delete it.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)