2 sprite for shadow

Get help using Construct 2

Post » Sun May 20, 2012 7:21 pm

hi all,
i have a simple 2 problem :
first of all i have 2 sprites these sprites one of them is the player (physic,platform) i want the 2nd sprite to pin behind the player and it keeps getting longer back when the player move faster like in cars and shoadows or like that (i don't know how they call it in english)
see picture of what i want to do:


2nd problem how can i make it when player stop it keeps getting small until it comes to sprite size

last things i can do it later . to make this thing work when i jump or fall also make this shadow with opacity 50 or like this


see the capx :
http://dl.dropbox.com/u/67034121/forum/shadow.capx
B
45
S
15
G
6
Posts: 795
Reputation: 11,935

Post » Sun May 20, 2012 7:30 pm

First problem:
Well, from what I know of physics, shadows do not get longer when an object is going faster...
Anyway, are you saying the player uses physics and platform behaviors? That's a sure way to depression... Choose one or the other.

Anyway, if you want to ignore the laws of optics ;)
To get the speed, use distance(0,0,vectorX,vectorY) - it will be slightly different for physics or platform. Then multiply this and some factor by the shadow.width or height, and add a value. This added value will be the size that it goes to at speed zero.

So your formula will be: set shadow.width to:
distance(0,0,vectorX,vectorY) * factor + base_size





B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sun May 20, 2012 8:30 pm

@sqiddster
i tried it but it stucked , i don't know in platform when i click right it get bigger without the speed, and in physic it works fine but still this isn't the point i want like this picture :


if you wanna see what i have done see capx :
http://dl.dropbox.com/u/67034121/forum/shadow%20fail.capx
B
45
S
15
G
6
Posts: 795
Reputation: 11,935

Post » Sun May 20, 2012 8:31 pm

I believe in english that's called a trail

trail2.capx (you can play with randomness values if you want.
Last edited by Yann on Sun Sep 14, 2014 8:29 pm, edited 1 time in total.
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sun May 20, 2012 8:34 pm

EDIT: Ooh, you want a trail...
Yann's example is probably what you are after.

Firstly, what you are intending is in no way how a shadow should look. Why do you want to do this? What is the shadow even falling on?

Also, you need to choose either physics or platform, you must not use both. If you are making a platform game, you should use platform.

If you tell us these things, it will be a lot easier for us to help you.sqiddster2012-05-20 20:36:13
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sun May 20, 2012 9:10 pm

I can think of a real application of this--I'm trying to do something similar with dust particles in a platformer. The faster the player goes the further I want the dust particles to trail out behind. I'm no physicist, but this seems intuitively correct since the player has covered more distance in the time it takes for the dust to fall to the ground.
B
29
S
11
G
12
Posts: 281
Reputation: 11,868

Post » Sun May 20, 2012 9:20 pm

@sqiddster , thanks for your big help ^^ and sorry again (i have said in the topic i don't know what they called XD )

@Yann , thanks for your help this is exactly what i was looking for .


B
45
S
15
G
6
Posts: 795
Reputation: 11,935

Post » Sun May 20, 2012 11:36 pm

@kittiewan
smoke doesn't move faster, smoke is just feet (if you have a running character) or wheels (if it's a vehicle) that creates local air movements and that makes dust fly up... So the faster you go, the more dust smoke you would produce, but the dust doesn't move that much, it just goes up and then fall on the ground.
There's not that much dust going horizontally unless there's a strong friction (like a car stuck in the sand or something like that)
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346


Return to How do I....?

Who is online

Users browsing this forum: jeffige, TheHat, Yahoo [Bot] and 1 guest