Game Maker Particle Attractor

Posted by admin

Particle actionsA set of action dealing with particles is available on the Extra tab.These actions are only available in the Standard Edition of GameMaker.Particle systems are meant to create special effects. Particles are smallelements (represented by a pixel or a little shape). Such particles movearound according to predefined rules and can change color while they move.Many such particles together can create e.g. Fireworks, flames, rain, snow,star fields, flying debris, etc.GameMaker contains an extensive particle system that can be accessed throughfunctions. A more limited particle system can be accessed through the actions described below.A particle system can deal with particles of different types.

After creatingthe particle system the first thing to do is specify the particle types. Usingthe actions below you can specify up to 16 types of particles. Each type has a shape,a size, a start color and an end color. The color slowly changes from the start colorto the end color. Particles have a limited life time. In the type you specify theminimal and maximal life time of the particles. Particles also have a speed and adirection.

Finally, gravity and friction can work on particles.After you specify the particle types you must create them at places inthe room. You can either burst a number of particles of a particular typefrom a place or you can create a constant stream of particles appearing.Particles appear at emitters. The particle system can have up to 8 emittersworking at the same time. So after you create the particle types you mustcreate the emitters and tell them to burst or stream particles.Here is the complete set of actions. Best experiment with them to get the required effect.Create Part SystemThis action creates the particle system. It must be called before any other actionscan be used. You only need to call it once.

Explosion Game Maker

You can specify the depth at which theparticles are drawn. If you use a large positive depth the particles appear behindthe instances. If you use a negative depth they appear in front of the instances.Destroy Part SystemThis action destroys the particle system, freeing all its memory. Don't forget tocall this (e.g. When you move to a different room) because particle systems use a lot of storage.Clear Part SystemThis action removes all the particles currently visible. It does not stop the emittersso new particles might be created again if you have streaming emitters (see below).Create ParticleWith this action you create a particle type.

Game Maker Particle System

You can choose one of the 16 typesavailable. For the particle type you can specify its shape or the sprite to beused for it. If you specify a sprite the sprite will be used.

If you set the spriteto no sprite, the shape will be used. There are a number of interesting built-inshapes. You also indicated its minimal andmaximal size (when the particle appears a random value between these bounds isused).

Finally you specify the increase in size in each step. For a decrease, usea negative value. Note that only a particle type is created, not an actual particle.For this you need emitters (see below).Particle ColorA particle can have a color (default the color is white). With this action you canset the color to be used for a particular type. You must indicate the particle typethe color is defined for.

Next you specify how a color is applied. Either a randomcolor is choosen between two given colors, or the color starts with the first colorand than gradually over the lifetime of the particle, it changes to the second color.Both colors must be given. Finally you can indicate the alpha transparency. You specifythe transparency at the moment the particle is created and when it dies. The transparencyslowly changes between these values.

It is normally nice to decrease the alpha value over thelifetime of a particle.Particle LifeA particle lives for a limited number of steps. After this is disappears. Framo cargo pump manual. With thisaction you set the life time for a particle type. You give two limiting values and the actuallife time is chosen randomly between them.Particle SpeedWith this action you can set the speed and direction of motion for a particle type.Again you give two limits and the actual value is chosen randomly between them. Forexample, to make the particle move in a random direction, give 0 and 360 for thelimits for the direction.

You can also specify a friction. This amount is subtractedfrom the speed in each step until it becomes 0. (You can make a particle speed upby using a negative friction.)Particle GravityWith this action you set the amount of gravity and direction of gravity for aparticular particle type. 270 is downwards.Particle SecondaryThis is a bit more complicated. Particles can create other particles during theirlife time and when they die. With this action you can specify this.

You can definethe type and number of particles that must be created at each step during the lifetime and you can specify the type and number of particles that must be created whenthe particle dies. Be very careful here.

You can easily create huge numbers ofparticles in this way, slowing down the system considerably. For the numbers youcan also use a negative value. A negative value x means that in each step aparticle is created with chance -1/x. So for example, if you want to generate asecondary particle about every 4 steps, use a value of -4. Secondary particlesare great for creating effects like tails of particles or exploding particles.Create EmitterThis action creates a particle emitter. Particles are generated by emitters.You can have up to eight emitters. Choose the emitter and specify the shape ofit and its size and position (in the form of a bounding box).Destroy EmitterThis action destroys the indicated emitter.

Note that existing particles thatcame from this emitter are not removed.Burst from EmitterEven if you defined a particle type and an emitter there are still no particles.You still have to tell the emitter to generate the particles. With this action youtell a particular emitter to generate a given number of particles of a given type.All these particles are generated at once. For the number you can also use a negativevalue. A negative value x means that a particle is created with chance -1/x.

So forexample, if you want to generate a particle with a chance of 25 percent, use a value of -4.Stream from EmitterWith this action you tell a particular emitter to stream a given number of particlesof a given type. In each step this number of particles is generated, leading to acontinuous stream of particles. The emitter will continue streaming particles untilyou destroy it or tell it to stream 0 particles. For the number you can also use anegative value.

A negative value x means that in each step a particle is createdwith chance -1/x. So for example, if you want to generate a particle about every4 steps, use a value of -4.

Particle

Game Maker Particle Attractor Video

FunctionDescriptionpartattractorcreateCreates a new attractor in the given particle system. Itreturns the index of the attractor.

This index must be used in allcalls below to set the properties of the attractor.partattractordestroyDestroys attractor ind in the particle system. Call this if youdon't need it anymore to save space.partattractordestroyallDestroys all attractors in the particle system that have beencreated.partattractorexistsReturns whether the indicated attractor exists in the particlesystem.partattractorclearClears the attractor ind to its default settings.partattractorpositionSets the position of attractor ind to (x,y).partattractorforceSets the force parameters of attractor ind.The following functions for particle changers have beenremoved. FunctionDescriptionpartchangercreateCreates a new changer in the given particle system. It returnsthe index of the changer. This index must be used in all callsbelow to set the properties of the changer.partchangerdestroyDestroys changer ind in the particle system. Call this if youdon't need it anymore to save space.partchangerdestroyallDestroys all changers in the particle system that have beencreated.partchangerexistsReturns whether the indicated changer exists in the particlesystem.partchangerclearClears the changer ind to its default settings.partchangerregionSets the region for the changer.partchangertypesSets which particle type the changer must change into whatother type.partchangerkindSets the kind for the changer.The following functions for particle deflectors have beenremoved. FunctionDescriptionpartdeflectorcreateCreates a new deflector in the given particle system.

Itreturns the index of the deflector. This index must be used in allcalls below to set the properties of the deflector.partdeflectordestroyDestroys deflector ind in the particle system. Call this if youdon't need it anymore to save space.partdeflectordestroyallDestroys all deflectors in the particle system that have beencreated.partdeflectorexistsReturns whether the indicated deflector exists in the particlesystem.partdeflectorclearClears the deflector ind to its default settings.partdeflectorregionSets the region for the deflector.partdeflectorkindSets the kind for the deflector.partdeflectorfrictionSets the friction for the deflector.The following functions for particle destroyers have beenremoved.

Game maker particle trail

FunctionDescriptionpartdestroyercreateCreates a new destroyer in the given particle system. Itreturns the index of the destroyer. This index must be used in allcalls below to set the properties of the destroyer.partdestroyerdestroyDestroys destroyer ind in the particle system.