Thank you very much catacomber, now I have the particle system in my own project. You don't really need "emitter.script", but other than that it's exactly as you said. I spent a lot time to find out why the particle demo can use just this single file and I found out you just need particles.script in your particles folder. Then in your .scene with SceneEdit click to your Region Entity that has the Name "Emitter". In the properties window click Scripts... and then "Attach existing script" (the folder icon) and select the particles.script. You don't need emitter.script
I played around with the particles a bit, very nice.
But I have made no progress with the particles following the mouse here
I'm trying around but it fails yet.
Hmm... I now have the smily entity but it doesnt emit my particle. And neither does it follow my mouse... here is what I have so far:
particles/particle.script from the demo. I added my particle based directly on the smoke particle. I will make bold whatever I think is important and might cause problems:
method CursorParticle()
{
this.DeleteParticleEmitter();
this.CreateParticleEmitter(true, MousePosition.X, MousePosition.Y); var Emit = this.ParticleEmitter;
Emit.AddSprite("particles\cloud.tga");
Emit.X = Scene.Width / 2;
Emit.Y = Scene.Height / 2;
Emit.Width = 0;
Emit.Height = 0;
Emit.LifeTime1 = 4000;
Emit.LifeTime2 = 5000;
Emit.Velocity1 = 50;
Emit.Velocity2 = 70;
Emit.Scale1 = 20;
Emit.Scale2 = 90;
Emit.Angle1 = 0;
Emit.Angle2 = 20;
Emit.MaxParticles = 300;
Emit.Alpha1 = 255;
Emit.Alpha2 = 0;
Emit.AlphaTimeBased = true;
Emit.GenerationInterval = 0;
Emit.GenerationAmount = 30;
Emit.AddPointForce("wind", Emit.X - 100, Emit.Y - 100, 90, 10);
Emit.Start(30000);
}
I got entities/mouse.window with script particles/particles.scriptParentnotify - False
Transparent - TrueMenu - False
InGame - True (?? I set this because I want my particle in front of inventory and so on)PauseMusic - False
Layout
X - 0
Y - 0
Width - 1024
Height - 768In it is an entity container called particles just as Stucki did.Scripts - particles/particles.script
X - 70
Y - 50
Entity - entities\emitter_mouse.entity
Disabled - False
Visible - True
In the entity container now the entity emitter_mouse.entity:ENTITY
{
NAME="emitter_mouse"
ACTIVE=TRUE
X=MousePosition.X
Y=MousePosition.Y SCALABLE=TRUE
INTERACTIVE=TRUE
COLORABLE=TRUE
SPRITE="entities\emitter_mouse\sprites\default.sprite"
TALK="entities\emitter_mouse\sprites\default.sprite"
SCRIPT="entities\track_mouse.script" FONT = "fonts\outline_red.font"
}
My entities\track_mouse.script// try to store position here
while(true)
{
var MousePosition;
MousePosition.X = Game.MouseX;
MousePosition.Y = Game.MouseY;
Sleep(1);
}
And in my scripts\game.script// cursor particle
var particlewindow = Game.LoadWindow("entities\mouse.window");
var test = particlewindow.GetEntity("emitter_mouse");
test.CursorParticle();
Those are the errors I get:02:47:03: Compiling script 'particles\particles.script'...
02:47:03: Error@line 220: Variable 'MousePosition' is referenced but not defined
02:47:03: Compiling script 'particles\particles.script'...
02:47:03: Error@line 220: Variable 'MousePosition' is referenced but not defined
02:47:03: Compiling script 'particles\particles.script'...
02:47:03: Error@line 220: Variable 'MousePosition' is referenced but not defined
02:47:03: Compiling script 'particles\particles.script'...
02:47:03: Error@line 220: Variable 'MousePosition' is referenced but not defined
02:47:03: Runtime error. Script 'scripts\game.script', line 6
02:47:03: Call to undefined method 'GetEntity'. Ignored.
02:47:03: Runtime error. Script 'scripts\game.script', line 7
02:47:03: Call to undefined method 'CursorParticle'. Ignored.
02:47:03: Error@line 220: Variable 'MousePosition' is referenced but not defined
02:47:03: Compiling script 'particles\particles.script'...
02:47:03: Error@line 220: Variable 'MousePosition' is referenced but not defined
02:47:03: Compiling script 'particles\particles.script'...
02:47:03: Error@line 220: Variable 'MousePosition' is referenced but not defined
02:47:03: Compiling script 'particles\particles.script'...
02:47:03: Error@line 220: Variable 'MousePosition' is referenced but not defined