void DemoScreenParticleActors::MouseDownEvent(Vec2i screenCoordinates, MouseButtonInput button) { if (_isActive) { ParticleActor *oneOff = (ParticleActor*)Actor::Create("particle_demo"); oneOff->SetColor(0, 0, 1); oneOff->SetSprite("Resources/Images/triangle.png"); //We can set the position to where the mouse click happened. oneOff->SetPosition(MathUtil::ScreenToWorld(screenCoordinates.X, screenCoordinates.Y)); //The system will remove itself from the world and deallocate its memory // when the lifetime ends. (If it's 0.0, it's assumed to be infinite.) oneOff->SetSystemLifetime(1.0f); //Make sure to add it to the world! theWorld.Add(oneOff); } }