Data Realms Fan Forums
http://45.55.195.193/

MOPixels with Glows
http://45.55.195.193/viewtopic.php?f=1&t=17702
Page 1 of 1

Author:  Hamjuice [ Sat Jan 30, 2010 11:24 pm ]
Post subject:  MOPixels with Glows

How would one add a glow sprite to an MOPixel?
Second, how would one make the MOPixel emit glows, for example, if fired across a long distance, creating a trail of glows behind it?

Author:  CaveCricket48 [ Sat Jan 30, 2010 11:36 pm ]
Post subject:  Re: MOPixels with Glows

1.

Code:
AddEffect = MOPixel
   PresetName = Particle Electro Boomer Glow
   Mass = 0.001
   AirResistance = 0
   GlobalAccScalar = 0
   Sharpness = 0
   LifeTime = 100
   RestThreshold = 500
   HitsMOs = 0
   GetsHitByMOs = 0
   Color = Color
      R = 255
      G = 0
      B = 255
   Atom = Atom
      Material = Material
         CopyOf = Air
      TrailColor = Color
         R = 255
         G = 0
         B = 255
      TrailLength = 100

/////  glow code /////

   ScreenEffect = ContentFile
      FilePath = Boomerangs.rte/Electro Boomer/Sprites/BlueBig.bmp
   EffectStartTime = 0
   EffectStopTime = 3600000
   EffectStartStrength = 0.2
   EffectStopStrength = 0.2
   EffectAlwaysShows = 1

/////  glow code /////


2. Give the MOPixel a Lua script that spawns a MOPixel after every X pixels.

Code:
function Create(self)
       self.trailspacing = 10; -- pixel space in between particles
       self.lastposition = Vector(self.Pos.X,self.Pos.Y);
end

function Update(self)
       local pardist = (self.Pos-self.lastposition);
   if pardist.Magnitude >= self.trailspacing then
       local trailpar = CreateMOPixel("Trail Particle"); -- Particle PresetName here
       trailpar.Pos = self.lastposition + pardist:SetMagnitude(self.trailspacing);
       MovableMan:AddParticle(trailpar);
       self.lastposition = Vector(self.Pos.X,self.Pos.Y);
   end
end

Author:  Flammablezombie [ Sat Jan 30, 2010 11:45 pm ]
Post subject:  Re: MOPixels with Glows

CaveCricket48 wrote:
2. Give the MOPixel a Lua script that spawns a MOPixel after every X pixels.

Code:
function Create(self)
       self.trailspacing = 10; -- pixel space in between particles
       self.lastposition = Vector(self.Pos.X,self.Pos.Y);
end

function Update(self)
       local pardist = (self.Pos-self.lastposition);
   if pardist.Magnitude >= self.trailspacing then
       local trailpar = CreateMOPixel("Trail Particle"); -- Particle PresetName here
       trailpar.Pos = self.lastposition + pardist:SetMagnitude(self.trailspacing);
       MovableMan:AddParticle(trailpar);
       self.lastposition = Vector(self.Pos.X,self.Pos.Y);
   end
end


...or you could add an emitter and give the glows pinstrength?

Author:  CaveCricket48 [ Sat Jan 30, 2010 11:47 pm ]
Post subject:  Re: MOPixels with Glows

You can't attach a glow emitter to a MOPixel.

Changed the script a bit:

Code:
function Create(self)
       self.trailspacing = 10; -- pixel space in between particles
       self.lastposition = Vector(self.Pos.X,self.Pos.Y);
end

function Update(self)
       local pardist = (self.Pos-self.lastposition);
   if pardist.Magnitude >= self.trailspacing then
       local trailpar = CreateMOPixel("Trail Particle"); -- Particle PresetName here
       trailpar.Pos = self.lastposition + pardist:SetMagnitude(self.trailspacing);
       MovableMan:AddParticle(trailpar);
       self.lastposition = self.lastposition + pardist:SetMagnitude(self.trailspacing);
   end
end

Author:  Hamjuice [ Sun Jan 31, 2010 12:06 am ]
Post subject:  Re: MOPixels with Glows

Thanks, guys. I'm using it to create a unique digger.

Author:  Hamjuice [ Sun Jan 31, 2010 7:39 pm ]
Post subject:  Re: MOPixels with Glows

While your script does work, CaveCricket, it seems to spawn only eight or so pixels, and those move very slowly. How can I make it spawn more that move faster?

Author:  CaveCricket48 [ Sun Jan 31, 2010 7:55 pm ]
Post subject:  Re: MOPixels with Glows

It's working better now, but still isn't perfect for super-fast particles. The velocity is also a little funky.

Code:
function Create(self)
   self.lastposition = Vector(self.Pos.X,self.Pos.Y);
   self.mapwrapx = SceneMan.SceneWrapsX;

   self.trailspacing = 10; -- pixel space in between particles
   self.particlespeed = Vector(10,0); -- Velocity of trail particles
   self.rotatevel = true; -- Whether or not to rotate the trail particles' vel depending on the main particle's vel (true or false)

end

function Update(self)
   local pardist = SceneMan:ShortestDistance(self.lastposition,self.Pos,self.mapwrapx);
   local traillength = math.floor(pardist.Magnitude/10);
   for i = 1, traillength do
    if pardist.Magnitude >= self.trailspacing then
   self.trailpar = CreateMOPixel("Particle Test Trail B"); -- Particle PresetName here
   self.trailpar.Pos = self.lastposition + pardist:SetMagnitude(self.trailspacing);
     if self.rotatevel == true then
   self.trailpar.Vel = self.particlespeed:RadRotate(self.Vel.AbsRadAngle);
     elseif self.rotatevel == false then
   self.trailpar.Vel = self.particlespeed;
     end
   MovableMan:AddParticle(self.trailpar);
   self.lastposition = self.lastposition + pardist:SetMagnitude(self.trailspacing);
    end
   end
end


For really fast particles, try this.

Author:  Hamjuice [ Sun Jan 31, 2010 8:16 pm ]
Post subject:  Re: MOPixels with Glows

I just need it to work at about 100 velocity.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/