Newbie question about creating Lasers

Talk about making games.

Newbie question about creating Lasers

Postby Axeman » Thu Oct 12, 2006 7:57 am

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.
Axeman
 
Posts: 3
Joined: Sun Mar 19, 2006 12:36 am
Score: 0 Give a positive score

Postby DilloDude » Thu Oct 12, 2006 9:52 am

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).
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby Axeman » Thu Oct 12, 2006 12:14 pm

Just left or right depending which way your facing.
Axeman
 
Posts: 3
Joined: Sun Mar 19, 2006 12:36 am
Score: 0 Give a positive score

Postby DilloDude » Fri Oct 13, 2006 3:16 am

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.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby DilloDude » Fri Oct 13, 2006 7:29 am

Try this demo.
If you need help understanding something, just ask.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby Axeman » Fri Oct 13, 2006 8:40 pm

Just the job, thanks.
Axeman
 
Posts: 3
Joined: Sun Mar 19, 2006 12:36 am
Score: 0 Give a positive score

Postby SergeLo00001 » Sat Oct 21, 2006 2:22 am

dillo is awsome
SergeLo00001
 
Posts: 46
Joined: Sun Jul 02, 2006 4:58 am
Score: 0 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest