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

Get help using Construct 2

Post » Sun Mar 27, 2016 3:53 pm

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
B
13
S
7
G
4
Posts: 132
Reputation: 3,559

Post » Sun Mar 27, 2016 4:37 pm

y=opacity?
Image ImageImage
B
168
S
50
G
163
Posts: 8,224
Reputation: 105,067

Post » Sun Mar 27, 2016 4:40 pm

B
9
S
1
Posts: 22
Reputation: 473

Post » Sun Mar 27, 2016 5:23 pm

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.
B
13
S
7
G
4
Posts: 132
Reputation: 3,559

Post » Sun Mar 27, 2016 6:36 pm

@Rudi55
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 :?:
Are you looking for a depth effect?

I`m a noob in Construct, learning coding by looking tutorials :D

Hope i understud you correct, my english ist not the yellow from the egg ;) (and auto correction makes a lot of crap stuff)
B
9
S
1
Posts: 22
Reputation: 473

Post » Sun Mar 27, 2016 7:40 pm

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
B
13
S
7
G
4
Posts: 132
Reputation: 3,559

Post » Sun Mar 27, 2016 8:07 pm

@Rudi55

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.
B
9
S
1
Posts: 22
Reputation: 473


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests