Page 1 of 1

Fireball falling from ceiling.

Posted: Thu Jul 23, 2015 3:13 am
by Emera Nova
So I'm looking to be able to have a fireball fall down from the ceiling. I've been teasing some of the code to change directions of different things.

Code: Select all

defineObject{
	name = "fireball_large_boss",
	baseObject = "base_spell",
	components = {
		{
			class = "Particle",
			particleSystem = "fireball_large_boss",
		},
		{
			class = "Light",
			color = vec(1, 0.5, 0.25),
			brightness = 15,
			range = 7,
			castShadow = true,
		},
		{
			class = "Projectile",
			spawnOffsetY = 1.35,
			velocity = 1,
			radius = 0.1,
			hitEffect = "fireball_blast_large",
		},
		{
			class = "Sound",
			sound = "fireball",
		},
		{
			class = "Sound",
			name = "launchSound",
			sound = "fireball_launch",
		},
	},
}

defineParticleSystem{
	name = "fireball_large_boss",
	emitters = {
		-- smoke
		{
			emissionRate = 30,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {0.0, 0.0, 0.0},
			boxMax = {0.0, 0.0, 0.0},
			sprayAngle = {0,360},
			velocity = {0.1,0.1},
			texture = "assets/textures/particles/smoke_01.tga",
			lifetime = {1,1},
			color0 = {0.25, 0.25, 0.25},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.9,
			size = {0.4, 0.6},
			gravity = {0,10,0},
			airResistance = 0.1,
			rotationSpeed = 1,
			blendMode = "Translucent",
		},

		-- flames
		{
			emissionRate = 100,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {-0.03, -0.03, 0.03},
			boxMax = { 0.03, 0.03,  -0.03},
			sprayAngle = {0,360},
			velocity = {0.5, 0.7},
			texture = "assets/textures/particles/torch_flame.tga",
			frameRate = 35,
			frameSize = 64,
			frameCount = 16,
			lifetime = {0.8, 0.8},
			colorAnimation = true,
			color0 = {2, 2, 2},
			color1 = {1.0, 1.0, 1.0},
			color2 = {1.0, 0.5, 0.25},
			color3 = {1.0, 0.3, 0.1},
			opacity = 1,
			fadeIn = 0.15,
			fadeOut = 0.3,
			size = {0.25, 0.35},
			gravity = {0,10,0},
			airResistance = 1,
			rotationSpeed = 1,
			blendMode = "Additive",
			objectSpace = true,
		},

		-- flame trail
		{
			emissionRate = 80,
			emissionTime = 0,
			maxParticles = 100,
			boxMin = {0.0, 0.0, 0.0},
			boxMax = {0.0, 0.0, 0.0},
			sprayAngle = {0,360},
			velocity = {0.1, 0.3},
			texture = "assets/textures/particles/torch_flame.tga",
			frameRate = 35,
			frameSize = 64,
			frameCount = 16,
			lifetime = {0.2, 0.3},
			colorAnimation = true,
			color0 = {2, 2, 2},
			color1 = {1.0, 1.0, 1.0},
			color2 = {1.0, 0.5, 0.25},
			color3 = {1.0, 0.3, 0.1},
			opacity = 1,
			fadeIn = 0.15,
			fadeOut = 0.3,
			size = {0.2, 0.5},
			gravity = {0,10,0},
			airResistance = 1.0,
			rotationSpeed = 1,
			blendMode = "Additive",
		},

		-- glow
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,-0.1},
			boxMax = {0,0,-0.1},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/glow.tga",
			lifetime = {1000000, 1000000},
			colorAnimation = false,
			color0 = {0.3, 0.13, 0.06},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.1,
			size = {1.5, 1.5},
			gravity = {0,10,0},
			airResistance = 1,
			rotationSpeed = 2,
			blendMode = "Additive",
			objectSpace = true,
		}
	}
}
That's the code that I'm working with at the moment. I can not figure out how to switch it from launching just forward.

Re: Fireball falling from ceiling.

Posted: Thu Jul 23, 2015 1:10 pm
by Emera Nova

Code: Select all

{
			class = "Projectile",
			spawnOffsetY = 1.35,
			velocity = {0,0,1},
			radius = 0.1,
			hitEffect = "fireball_blast_large",
		},
So I thought maybe changing the velocity there to a tabled coor would help change the direction.. That is not the answer it breaks so bad when u have it get launched out of a spawner anti even funny..

Running out of idea's on this anyone have input on changing the direction of it from y to z so it can be fired from above?

Re: Fireball falling from ceiling.

Posted: Thu Jul 23, 2015 1:15 pm
by Emera Nova
Ok so if you take

Code: Select all

{
			class = "Projectile",
			spawnOffsetY = 1.35,
			velocity = {0,0,1},
			radius = 0.1,
			hitEffect = "fireball_blast_large",
		},
and add in gravity = 1, it will shoot in a weird downward but forward launch. MY guess is if you get rid of velocity completely and just keep gravity in it's play it should just fall downwards.. In that case you'll just put in gravity = 10 and you'd have a fireball falling down at normal speeds.

Re: Fireball falling from ceiling.

Posted: Thu Jul 23, 2015 1:18 pm
by Emera Nova
Totalllly works that way..

So if anyone is wanting a projectile to fall downwards shut off velocity completely and put in gravity = postive number, if you want it shooting up make it negative.