Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by ansimuz

It's there any good way to make a snow generator? I want to simulate is snowing for a snow based stage.

1 decade ago by BennyT

You could have a look at the biolab entity pack with debris and particle entities that could accomplish what you are trying to achieve

1 decade ago by ansimuz

@BennyT

I created one based on the biolab debris entity. I am sharing it in case anyone needs one. https://github.com/ansimuz/snow-emitter

1 decade ago by mLautz

Looks good. Nice and simple :)

One other thing you may be able to do to improve this is have some code that creates an entity pool for the snowflakes so that you make them upfront and then just reuse them.

You should be able to do some kind of calculation based on the count, duration, velocity and screen size to know the max number that will ever be on screen.

1 decade ago by ansimuz

mLautz

I followed your advice and now its on Github.

Thanks

1 decade ago by lazer

I created snow for my tree growing game. See EntityWeather here (there is rain as well that's bundled into the same entity): https://github.com/drakonka/Alien-Tree/blob/master/lib/game/entities/sky.js

Then to spawn I do this:

for (var i = 0; i < 300; i++) {
					var velX = ig.game.controller.randomFromTo(-50,50);
					ig.game.spawnEntity(EntityWeather, 0,0, {vel: {x: velX, y: 100}, kind: 'snow', danger: this.snow.chance});
				}

(300 being how many snowflakes you want to spawn). I thought this would slow the game down a lot because you're spawning 300 extra entities, but it seems to have minimal effect.

Visually it looks like white dots floating slowly in various directions. You can see it here. http://liza.io/alientree (though you'd need to play through until you get snow to trigger)
Page 1 of 1
« first « previous next › last »