Page 1 of 1

Pyro's Awesome Lasers (for Kall)

PostPosted: Sun Jun 07, 2009 12:50 am
by pyrometal
Hello everyone!

Sorry I've been off the forum for so long, I had no internet connection for the last 2 weeks... But nevermind that!

You should check out this demo! I built this for Kalladdolf whom asked me for help to make this. This code is an example of how to create lasers which are limited in lenght by walls and can be triped by object passing by. This uses a single canvas to draw all lasers and the screen's position does not matter; The lasers will always be drawn properly as long as they are set-up correctly.

Unfortunately, since this uses a canvas actor and since the code has to do a lot of collision checking, using this in an excessive manner or simply making the canvas too big may cause some lagging in your game. Therefore you must use this with caution!

laser_demo.zip
Ima firin' ma LAZAAR!
(6.92 KiB) Downloaded 165 times


--pyro

Re: Pyro's Awesome Lasers (for Kall)

PostPosted: Sun Jun 07, 2009 4:55 am
by jimmynewguy
That's a nice way of using the canvas there I personally have no use for it, but it's pretty spiffy!

Re: Pyro's Awesome Lasers (for Kall)

PostPosted: Sun Jun 07, 2009 9:02 am
by Kalladdolf
Thank you pyro, you are, like, (one of) the awesomest person(s) in this community!
I think I'll post a smiley on this special occasion: :D

Re: Pyro's Awesome Lasers (for Kall)

PostPosted: Sun Jun 07, 2009 10:46 am
by pyrometal
lol, thanks! Glad I could help you out.

Re: Pyro's Awesome Lasers (for Kall)

PostPosted: Sun Jun 07, 2009 7:16 pm
by Hblade
Cool, nice job.

Re: Pyro's Awesome Lasers (for Kall)

PostPosted: Tue Jun 09, 2009 2:21 pm
by zygoth
Let me see if I understand this...the code checks all points in the line of the laser until it comes into a collision at which point it stops and then the canvas draws a line there. right? Pretty neat, but I imagine it eats up a lot of cpu. cool stuff!

Zygo

Re: Pyro's Awesome Lasers (for Kall)

PostPosted: Tue Jun 09, 2009 2:51 pm
by Bee-Ant
is this only for kall?

Re: Pyro's Awesome Lasers (for Kall)

PostPosted: Tue Jun 09, 2009 5:05 pm
by Kalladdolf
No, it's for everyone, I'm just the one who made the request.

Re: Pyro's Awesome Lasers (for Kall)

PostPosted: Tue Jun 09, 2009 8:55 pm
by pyrometal
@Bee-ant - Anyone can use this! If I had wanted only Kall to use it I would have sent it to him in an email.

@Zygoth - You got it right, that's exactly what's happening here, but I'd have to say that the canvas eats the cpu more than the collision checking.