Luminous flux in cocos2d

I want to make a stream of light that moves from a start point to an end point in my game. so how to make a stream of light in cocos2d? and also want to reflect this stream of light when it touches any surface. so what is logic to make a stream of light and make a reflection? any idea?

help me..

+5
source share
1 answer

You can do something simple like draw a ccdrawLine. I made lasers that simply draw a red line in this way. Another way is to use a particle system / emitter. I use Particle Designer on 71squared, but there are others. Your options are endless in how you can make your beam look. You just need to experiment with the settings to get the desired effect.

As for reflection, I use box2d and ray. Try to start a beam of rays where the ray begins, and then create a new ray on the first object that it applies.

Here is a good ray tutorial: http://www.raywenderlich.com/4653/intermediate-box2d-physics-forces-ray-casts-and-sensors

+2
source

All Articles