Rain or snow following the player

» Mon May 23, 2016 8:29 am

Hi!

I've been searching an answer to this Classic Construct question all weekend and couldnt found it...
Sorry, I can't post an attached cap right now but If necessary I will do so.

I've managed to create a simple but nice rain/snow effect but I can't find a way to make it "follow" the player above him when he walks in a scrolled level. I've found a way but it's not "perfect" and I don't get why (now I realise that a cap would definitely be better to understand my problem ^^)

I wrote something like this using the "X,Y visible screen" :

Every 10 milliseconds, system create "rain particule" at layer 1 :
X = random(x of the left visible screen, x of the right visible screen)
Y = top of the visible screen

But it's not perfect and depending where the player is on the layout, the rain is not everywhere above him and I don't understand why.

I know the "trick" for HUD with a separate layer with scroll set to 0 but this is not what I want to achieve because it will be weird for rain (it will look like if a cloud is following the head of the player and not that he is walking through the rain).

In short words : I simply want the rain to be constantly created above the player while he walks/scroll through the level (to avoid creating rain everywhere in the layout off screen and altering the performance with unnecessay particles)

// izioq //
P.S: sorry for my English, I'm French.
B
4
S
1
Posts: 24
Reputation: 380

» Mon May 23, 2016 2:41 pm

Are you making the rain on the same layer as the player ?
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

» Mon May 23, 2016 8:17 pm

Yes. There is an effect when the drop of rain hits the player... but maybe its not necessary to have it on the same layer?

@jayjay Maybe you'd have an idea ?
B
4
S
1
Posts: 24
Reputation: 380

» Tue May 24, 2016 10:20 pm

Glad to tell you that I've found a way to fix it

Instead of creating the rain/snow at the top of the screen, I make it appears at offset from the character.

it goes like this :

every 30 milliseconds, system create rain at X offset (to player) = random(801)-400 and Y offset (to player)= random(601)-300

B
4
S
1
Posts: 24
Reputation: 380