View unanswered posts | View active topics It is currently Sat Sep 28, 2024 10:40 pm



Reply to topic  [ 31 posts ]  Go to page Previous  1, 2, 3  Next
 Glowing Laser Beam Trail 
Author Message
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Glowing Laser Beam Trail
haven't touched it. send me a PM to remind me and I might do it tonight. It really is a 5 or so minute job.


Fri Dec 11, 2009 5:36 am
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Glowing Laser Beam Trail
fixed.
found the problem, it was storing oldpos as a ref to self.Pos, not taking the values from it. theres still the starting frame with no trail though, you'll need a workaround for that.


Attachments:
File comment: done
BOX.rte.zip [94.93 KiB]
Downloaded 145 times
Fri Dec 11, 2009 11:27 pm
Profile WWW
User avatar

Joined: Sat Jan 10, 2009 1:55 am
Posts: 75
Reply with quote
Post Re: Glowing Laser Beam Trail
...did you upload the wrong file? Your download is the same thing I started with.


Sun Dec 13, 2009 7:28 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Glowing Laser Beam Trail
Whoops, apparently I did, or at least didn't archive it over the old one properly. Grr.
Basically, make it so the self.oldpos = self.Pos lines read self.oldpos = Vector(self.Pos.X, self.Pos.Y), it allocates it dynamically if you don't, which causes the script to do ♥♥♥♥ all (all the particles are placed in the same position).


Wed Dec 16, 2009 6:37 am
Profile WWW
User avatar

Joined: Sat Jan 10, 2009 1:55 am
Posts: 75
Reply with quote
Post Re: Glowing Laser Beam Trail
Didn't fix it. Here's what I have now:

function Create(self)
self.oldpos = Vector(self.Pos.X, self.Pos.Y) --set the old position
end

function Update(self)
self.numberofdivisions = math.random(4,6) --some randomness never hurt.
for i = 1, self.numberofdivisions do
local particle = CreateMOPixel("SuperLaser Trail Glow", "BOX.rte")
particle.Pos = self.Pos - (SceneMan:ShortestDistance(self.Pos,self.oldpos,true) * (i/ (self.numberofdivisions + 1)))
--the above should position a mopixel (which i assume you're using) a fraction of the distance the particle has traveled.
particle.Vel = self.Vel * (math.random(8,12) / 10) --more random, this time velocity
MovableMan:AddParticle(particle)
end
self.oldpos = self.Pos --set the old position again, at the end of the function so it works for next time, but doesnt mess it up now
end


Wed Dec 16, 2009 5:17 pm
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Glowing Laser Beam Trail
change the last line of Update(self) as well, I assume you missed it by accident.


Wed Dec 16, 2009 8:51 pm
Profile WWW
User avatar

Joined: Sat Jan 10, 2009 1:55 am
Posts: 75
Reply with quote
Post Re: Glowing Laser Beam Trail
Yeah, sorry I missed that. After fixing it, it looks like this:
Image

So it still doesn't look that great... its still a dotted line and it looks like the spacing is kind of weird too.


Wed Dec 16, 2009 10:55 pm
Profile
User avatar

Joined: Wed Sep 09, 2009 3:16 am
Posts: 3032
Location: Somewhere in the universe
Reply with quote
Post Re: Glowing Laser Beam Trail
you could always do it the lame way.
Make a really long beam of yellowish white light and set it to muzzle flash xD

Or you could make the particle you shoot Emit glowing particles.


Thu Dec 17, 2009 12:09 am
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post Re: Glowing Laser Beam Trail
dragonxp wrote:
make the particle you shoot Emit glowing particles.

Same problem. The most complete line solution would be to do what they're already doing. Something is up with the code, it should work fine.


Thu Dec 17, 2009 12:13 am
Profile
User avatar

Joined: Wed Sep 09, 2009 3:16 am
Posts: 3032
Location: Somewhere in the universe
Reply with quote
Post Re: Glowing Laser Beam Trail
or use the matilda revolver code xD


Thu Dec 17, 2009 1:22 am
Profile
User avatar

Joined: Fri May 08, 2009 1:39 am
Posts: 482
Location: Playing a children's card game
Reply with quote
Post Re: Glowing Laser Beam Trail
yeah, but all the cool kats make their codes, instead of quietly ripping other code. geuss thats why i naver made a good laser trail :/

cock donkey...god why is that stuck in my head?


Thu Dec 17, 2009 1:47 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Glowing Laser Beam Trail
you could fix that by drawing a line with self.Vel rather than the other vector on the first frame, like using
Code:
function Create(self)
   self.oldpos = Vector(self.Pos.X, self.Pos.Y)
   self.numberofdivisions = math.random(10,16)
   for i = 1, self.numberofdivisions do
      local particle = CreateMOPixel("SuperLaser Trail Glow", "BOX.rte")
      particle.Pos = self.Pos - ((self.Vel * (TimerMan.DeltaTimeSecs * FrameMan.PPM)) * (i/ (self.numberofdivisions + 1)))
      MovableMan:AddParticle(particle)
   end
   for i = 1, self.numberofdivisions do
      local particle = CreateMOPixel("SuperLaser Trail Glow", "BOX.rte")
      particle.Pos = self.Pos + ((self.Vel * (TimerMan.DeltaTimeSecs * FrameMan.PPM)) * (i/ (self.numberofdivisions + 1)))
      MovableMan:AddParticle(particle)
   end
end

function Update(self)
   self.numberofdivisions = math.random(10,16)
   for i = 1, self.numberofdivisions do
      local particle = CreateMOPixel("SuperLaser Trail Glow", "BOX.rte")
      particle.Pos = self.Pos - (SceneMan:ShortestDistance(self.Pos,self.oldpos,true) * (i/ (self.numberofdivisions + 1)))
      MovableMan:AddParticle(particle)
   end
   self.oldpos = Vector(self.Pos.X, self.Pos.Y) --set the old position again
end
that also makes it make more particles, hopefully I didnt break anything..


Thu Dec 17, 2009 3:58 am
Profile WWW
User avatar

Joined: Sat Jan 10, 2009 1:55 am
Posts: 75
Reply with quote
Post Re: Glowing Laser Beam Trail
Better, but:

Image

Also, the glows need to be spread out more so the beam looks smoother.



Btw, thank you for all the help. : )


Thu Dec 17, 2009 4:26 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Glowing Laser Beam Trail
Sorry, assumed you were still using your emitter.
Code:
function Create(self)
   self.oldpos = Vector(self.Pos.X, self.Pos.Y)
   self.numberofdivisions = math.random(10,16)
   for i = 1, self.numberofdivisions do
      local particle = CreateMOPixel("SuperLaser Trail Glow", "BOX.rte")
      particle.Pos = self.Pos - ((self.Vel * (TimerMan.DeltaTimeSecs * FrameMan.PPM)) * (i/ (self.numberofdivisions)))
      MovableMan:AddParticle(particle)
   end
   for i = 1, self.numberofdivisions - 1 do
      local particle = CreateMOPixel("SuperLaser Trail Glow", "BOX.rte")
      particle.Pos = self.Pos + ((self.Vel * (TimerMan.DeltaTimeSecs * FrameMan.PPM)) * (i + 1/ (self.numberofdivisions - 1)))
      MovableMan:AddParticle(particle)
   end
end

function Update(self)
   self.numberofdivisions = math.random(10,16)
   for i = 1, self.numberofdivisions do
      local particle = CreateMOPixel("SuperLaser Trail Glow", "BOX.rte")
      particle.Pos = self.Pos - (SceneMan:ShortestDistance(self.Pos,self.oldpos,true) * (i / self.numberofdivisions))
      MovableMan:AddParticle(particle)
   end
   self.oldpos = Vector(self.Pos.X, self.Pos.Y) --set the old position again
end
See if that fixes it. If not, add it to the script and upload the .rte again.


Thu Dec 17, 2009 5:08 am
Profile WWW
User avatar

Joined: Sat Jan 10, 2009 1:55 am
Posts: 75
Reply with quote
Post Re: Glowing Laser Beam Trail
Now there is just one big space in the beam. Heres the rte...


Attachments:
BOX.rte.zip [96.04 KiB]
Downloaded 131 times
Thu Dec 17, 2009 5:13 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 31 posts ]  Go to page Previous  1, 2, 3  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.063s | 14 Queries | GZIP : Off ]