UnityNinja Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

UnityNinja CommunityLog in

UnityNinja - Video Game Development Community, including Resources, Forums, Marketplace & More.


descriptionParticle Modifier Script by BryceCain25 EmptyParticle Modifier Script by BryceCain25

more_horiz
Hi!
today I have made a new particle modifier script...
this is basically just to show how to use the particle with variables..
if you press Up Arrow (using Keycode.UpArrow) you can increase the particle Size..
and vice versa
the thing is with this script, the Multiplier I may have messed up...to what I may be thinking is:
since 1*5 = 5, and -1*5 = -5, this case you would have the particle increase on a negative scale...which in match terms this seems really weird to have a negative scale for increasing integers..it works I guess...
It may seem extremely hard to get used to, so indeed I will rewrite a full script that people can use if they insist I do..


here is the script: (JavaScript, UnityScript)

Code:

var theparticle : Particle;
var multiplier : int;
var decrease : int;
var minimumenergy : int;
var minimumsize : int;
var maximumsize : int;
var maximumenergy : int;
function Start () {
theparticle.startEnergy = minimumenergy; //this will start the the particle system with
//the minimum energy possible...
theparticle.size = minimumsize; //this will start the particle system with the minimum size..
Check();
Checktwo();
}

function Update () {
if(Input.GetKeyDown(KeyCode.DownArrow)) {
theparticle.size = theparticle.size*multiplier;
}
if(Input.GetKeyDown(KeyCode.UpArrow)) {
theparticle.size = theparticle.size/multiplier;
}

}

function Check () {
if(theparticle.size == maximumsize) {
theparticle.size = minimumsize;
}
}


function Checktwo () {
if(theparticle.energy == maximumenergy) {
theparticle.energy = minimumenergy;
}
}


Thank you!

descriptionParticle Modifier Script by BryceCain25 EmptyRe: Particle Modifier Script by BryceCain25

more_horiz
Very interesting! Thanks for the share Bryce.

descriptionParticle Modifier Script by BryceCain25 EmptyRe: Particle Modifier Script by BryceCain25

more_horiz
Great share BryceCain25.

--New Developer

descriptionParticle Modifier Script by BryceCain25 EmptyRe: Particle Modifier Script by BryceCain25

more_horiz
MisterNinjaBoy wrote:
Very interesting! Thanks for the share Bryce.
Thank you! Very Happy

descriptionParticle Modifier Script by BryceCain25 EmptyRe: Particle Modifier Script by BryceCain25

more_horiz
NewDeveloper wrote:
Great share BryceCain25.

--New Developer
Thanks! Very Happy

descriptionParticle Modifier Script by BryceCain25 EmptyRe: Particle Modifier Script by BryceCain25

more_horiz
Great Bryce Very Happy

descriptionParticle Modifier Script by BryceCain25 EmptyRe: Particle Modifier Script by BryceCain25

more_horiz
developer23 wrote:
Great Bryce Very Happy
Thank you!

descriptionParticle Modifier Script by BryceCain25 EmptyRe: Particle Modifier Script by BryceCain25

more_horiz
privacy_tip Permissions in this forum:
You cannot reply to topics in this forum
power_settings_newLogin to reply