View unanswered posts | View active topics It is currently Sun Oct 06, 2024 7:52 pm



Reply to topic  [ 8 posts ] 
 MOPixels with Glows 
Author Message

Joined: Wed Jan 27, 2010 11:38 pm
Posts: 36
Reply with quote
Post 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?


Sat Jan 30, 2010 11:24 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post 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


Sat Jan 30, 2010 11:36 pm
Profile
User avatar

Joined: Wed Jan 14, 2009 7:12 pm
Posts: 1525
Location: In between your sister's legs, showing her how to use a... PS3 controller!
Reply with quote
Post 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?


Sat Jan 30, 2010 11:45 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post 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


Sat Jan 30, 2010 11:47 pm
Profile

Joined: Wed Jan 27, 2010 11:38 pm
Posts: 36
Reply with quote
Post Re: MOPixels with Glows
Thanks, guys. I'm using it to create a unique digger.


Sun Jan 31, 2010 12:06 am
Profile

Joined: Wed Jan 27, 2010 11:38 pm
Posts: 36
Reply with quote
Post 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?


Sun Jan 31, 2010 7:39 pm
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13143
Location: Here
Reply with quote
Post 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.


Sun Jan 31, 2010 7:55 pm
Profile

Joined: Wed Jan 27, 2010 11:38 pm
Posts: 36
Reply with quote
Post Re: MOPixels with Glows
I just need it to work at about 100 velocity.


Sun Jan 31, 2010 8:16 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

Who is online

Users browsing this forum: Google [Bot]


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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.079s | 16 Queries | GZIP : Off ]