Page 1 of 1

Newbie question about creating Lasers

PostPosted: Thu Oct 12, 2006 7:57 am
by Axeman
Well thats the quesion really. What would be the best way to draw a laser? Say I have a little man running round the screen in a platform style game. I want him to shoot lasers instead of bullets. Any ideas how to go about it?
The laser needs to start as one pixel then increase in size to a certain length and then disappear one pixel at a time from its original starting point. But the catch is I want to be able to do multiple lasers at any one time.

Shall I do some sort of pixel drawing commands or a sprite and resize it on the fly (if i can).

Any help appreciated.

PostPosted: Thu Oct 12, 2006 9:52 am
by DilloDude
Are you planning to have specific directions (up, left, down, right) or just any direction? If you are using specific directions, you can just have one animation for each direction. If not, you need a lot more animations. Either use one for each angle (you'd need about 36) or use one with each angle for each frame (useful if you have a short animation, about 3 - 5 frames).

PostPosted: Thu Oct 12, 2006 12:14 pm
by Axeman
Just left or right depending which way your facing.

PostPosted: Fri Oct 13, 2006 3:16 am
by DilloDude
All you need, then, is a laser animation for left (starting short, growing longer, and then shrinking back again) and one for right. Alternatively, you could have one that grows and shrinks at both sides, and you could use velocity, to moove it. This would allow it to hit something, and then stop moving out, but continue to shrink.

PostPosted: Fri Oct 13, 2006 7:29 am
by DilloDude
Try this demo.
If you need help understanding something, just ask.

PostPosted: Fri Oct 13, 2006 8:40 pm
by Axeman
Just the job, thanks.

PostPosted: Sat Oct 21, 2006 2:22 am
by SergeLo00001
dillo is awsome