The Daily Click ::. Forums ::. Klik Coding Help ::. Why does it always rain on me \
 

Post Reply  Post Oekaki 
 

Posted By Message

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
5th January, 2007 at 20:53:56 -

Yes, tis true I'm having some problems with rain effects.. (Not because I lied when I was 17)

Basically when I'm moving left/right for a while and have gained velocity, the raindrops gather together at the edge of the screen (like in a string). So the rain is concentrated on the edge of the screen instead of the width of the window.

"raindrop" represents the active object for the rain (¬_¬) and "rainsource" is where the rain is created.

***Always
-raindrop speed = 20
-raindrop direction = 25
-rainsource Ypos = Y Top Frame + 1
-make rainsource invisible

***every 00"-16
-create raindrop at 0,0 from rainsource

***raindrop is out of the area
-destroy

__

I've tried changing this next bit to lots of different settings and random calculations involving the window's width etc.
__

***Speed of character is less than/equal to 150
-Set Xpos of rainsource to "Random(3000)"
__

3000 being the width of the entire area (yeah, not the window width, since I've tried that..) and 200 is the max velocity for the character. There's probably a simple way of doing this, but no method I've tried is yet to work.. So if you're out there Mr Knowledgeable Klik .. guy(s).. I'd much appreciate the help

Thanks, Tim

 
http://www.SilverNova.co.uk


axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
6th January, 2007 at 06:00:41 -

Well, first of all, don't use timer events. Second of all, it'd probably look a bit more natural if you had it spread the rain randomly, instead of creating raindrops at fixed rainsources. You might also not want to have it rain over the whole playfield, that'd be a waste of objects.

But to solve your problem, simply place the rainsources at the top left corner of your playfield, only as many as you need to cover the visible window width, ie 640 or whatever resolution you're using. Then just modify the rainsources' and raindrops' properties, and un-tick "follow playfield". That way, the raindrops and rainsources will follow the screen while scrolling. Then, to destroy the raindrops, you can either test their position, or use the "is object getting close to window edge" condition.

If you want the raindrops to fall a bit more randomly, you can do something like this:

* [condition]
- Create raindrop at (0;0) from rainsource
- Raindrop: Set X position to X("Raindrop") + (Random(5)-2)

Or something like that.

Edit: Radix also wrote an article on this. I don't know how he does it, but it must be good.

http://www.create-games.com/article.asp?id=1547

Image Edited by the Author.

 
n/a

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
6th January, 2007 at 07:45:27 -

I forgot to mention I'm using 1.5 :\ But I'll have a look for that, thanks for your help Axel

Yeah, I was about to search TDC for something on it ... before it went down again :| So I'm gunna have a look at Radix' article whilst I can too.. hehe.

Thanks again! I'll let you know how it goes..

 
http://www.SilverNova.co.uk


Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
6th January, 2007 at 08:06:27 -

I think the main thing I missed before was the "follow the frame" option :\ *hides in embarrassment*

I've implemented your:

" - Raindrop: Set X position to X("Raindrop") + (Random(5)-2) " too, which gives quite a nice effect

Only problem now, is that the rain follows with the movement of the character.. so if I'm walking right, the rain falls right. And having said that I've just figured out how I might do it! LOL.. I'll make the direction of the rain a variable perhaps? hehe, I'll try it anyways, thanks alot!

 
http://www.SilverNova.co.uk


CodeCannon

of DringleTopia

Registered
  13/04/2006
Points
  208
6th January, 2007 at 09:49:01 -

What about this:

- Always
... Create Raindrop at (-16, -16)
... Raindrop: Set X Position to X Left Frame + Random(X Right Frame - X Left Frame)
... Raindrop: Set Y Position to Y Top Frame

- X Position of Raindrop < X Left Frame
... Raindrop: Set X Position to X Right Frame

- X Position of Raindrop > X Right Frame
... Raindrop: Set X Position to X Left Frame

If your frame scrolls vertically too:

- Y Position of Raindrop < Y Top Frame
... Raindrop: Set Y Position to Y Bottom Frame

- Y Position of Raindrop > Y Bottom Frame
... Raindrop: Set Y Position to Y Top Frame

Destroy the raindrops if they leave the frame area or hit something, and check the "Follow the frame" option if you do it this way. You could also try wind and sudden gushes of rain when the wind picks up.

 
_
CodeCannon
http://www.dringletopia.da.ru/

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
6th January, 2007 at 10:18:45 -

Yes, that sounds about right. But you might also want to uncheck "inactive if too far from window" for that, just in case.

 
n/a

axel

Crazy?

Registered
  05/02/2005
Points
  4766

Game of the Week WinnerYou've Been Circy'd!
6th January, 2007 at 10:25:21 -

Hmm, the only problem with that technique is that if the camera moves very fast somewhere, then all raindrops will be aligned at one side of the window. But you could probably fix it somehow, using some math and the modulus function etc etc, but I'm too lazy to figure that out for you

 
n/a

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
6th January, 2007 at 11:39:45 -

Yeah it was because of my scrolling too that they were gathered on the edge of the screen it's all fixed now - thanks all!

 
http://www.SilverNova.co.uk


CodeCannon

of DringleTopia

Registered
  13/04/2006
Points
  208
6th January, 2007 at 17:16:40 -

Oh yeah - I see what you mean Axel.

Would this work:

-Always
... Raindrop: Set X Position to X("Raindrop") + (((X Left Frame + X Right Frame) / 2 - X("Raindrop")) / ((X Right Frame - X Left Frame) / 2) * (X Right Frame - X Left Frame))

In simpler terms:

X("Raindrop") + (([Central Window Position] - X("Raindrop")) / ([Window Width] / 2) * [Window Width])

 
_
CodeCannon
http://www.dringletopia.da.ru/

Ski

TDC is my stress ball

Registered
  13/03/2005
Points
  10130

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!KlikCast HelperVIP MemberWii OwnerStrawberryPicture Me This Round 28 Winner!PS3 OwnerI am an April Fool
Candy Cane
6th January, 2007 at 17:55:11 -

I smell South African

 
n/a

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
6th January, 2007 at 18:42:06 -

Then take a bath? :\ LOL

 
http://www.SilverNova.co.uk


Ski

TDC is my stress ball

Registered
  13/03/2005
Points
  10130

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!KlikCast HelperVIP MemberWii OwnerStrawberryPicture Me This Round 28 Winner!PS3 OwnerI am an April Fool
Candy Cane
6th January, 2007 at 18:43:30 -

-.-

 
n/a

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
6th January, 2007 at 20:07:51 -



 
http://www.SilverNova.co.uk


CodeCannon

of DringleTopia

Registered
  13/04/2006
Points
  208
7th January, 2007 at 06:04:36 -

Adam who told you?

 
_
CodeCannon
http://www.dringletopia.da.ru/

Ski

TDC is my stress ball

Registered
  13/03/2005
Points
  10130

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!KlikCast HelperVIP MemberWii OwnerStrawberryPicture Me This Round 28 Winner!PS3 OwnerI am an April Fool
Candy Cane
7th January, 2007 at 06:09:27 -

you did

 
n/a

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
7th January, 2007 at 06:38:27 -

er..

 
http://www.SilverNova.co.uk

   

Post Reply



 



Advertisement

Worth A Click