My Particle Effect looks....too Square

BlitzMax Forums/BlitzMax Programming/My Particle Effect looks....too Square

Rico(Posted 2010) [#1]
I made a particle effect for a blood splash when my character falls on spikes. but the overall shape of it comes out all square looking. i cant work out why because it should be randomised. if i increase the number of seperate blood spots to 1000 u can really see it comes outwards in a square pattern. how can i make it more splash like?

heres my code :




its taken from the main program so wont run by itself. the reason why the coords are so complicated by the drawimage command is because i can scale the graphics and zoom in and out, and they also scroll, but thats not important for my problem.

Please help :)


Jesse(Posted 2010) [#2]
you are allowing x and y to be between -3 and positive 3 and that will produce a square, to change it in to a circle add a sin and cos to the calculation and randomize the angle then multiply by a random number for how wide you want the splas it should give you more of a round shape.
something like this:
degree = rand(360)
wide = rand(3)
dx = cos(degree)
dy = sin(degree)
posx = dx*wide
posy = dy*wide

this will cover an circular area with 3 units in radius.

a better way would be for you to create an image big enough to to cover the area expected. paste once to several times with random rotation and scale.


Rico(Posted 2010) [#3]
thanks Jesse, i realised that but i thought the randomised x vectors and y vectors would make the blood more uneven, but i was obviously wrong! thank you for the help i will give your method a try :)


Russell(Posted 2010) [#4]
Yeah, it's weird how ordered and non-random random numbers can be ;)

Russell


Czar Flavius(Posted 2010) [#5]
Nono if you want the blood to look more uneven, you will need the random numbers to be less random! Because the average of a large collection of random numbers in the same range tends to be very predictable.

You want the blood to spurt upwards and then slowly downwards in a fountain? Hm perhaps try this. When the guy dies, send upwards and slightly to the left or right by a random amount, invisible particle effect makers! This is effected by gravity and eventually will stop in midair and then fall downwards to the floor. Each one is constantly producing the blood particles. I don't know how this will look, but it would certainly be more interesting than a square or circle..


CoderLaureate(Posted 2010) [#6]
I think you need to make blsp.im a float number as well, and cast it as RndFloat() * 4.0