Rain or snow following the player

This forum is currently in read-only mode.
  • 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)

    Thanks for your help

    // izioq //

    P.S: sorry for my English, I'm French.

  • Are you making the rain on the same layer as the player ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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 ?

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)