Electric charge in bge

Hi all,
as the name of the thread suggests i m willing to create the first skill of my game project however i kind of dont know where to start from,what i want to do is create a sort of sphere around both of his hands charged with electricity and then he throws a big ball full of charge towards the enemy and afterwards the electricity gets spread all over the enemy body,can anyone help me to build such a thing?
thx in advance,
Romy

Hi Romy,

I didn’t quite get whether you want your sphere of electricity to behave like
some sort of REAL charged particles, or just LOOK like lightning.

If you’re going for the first one, that sounds very difficult -
while it’s very possible to code that, it would eat up a LOT of performance.

However, if you’re shooting for the second:
Create an object which resembles your idea of a lightning “particle”,
and hook it up with a python script per always brick.

In your script, you might want to code some kind of random jittering effect,
so your particle object moves or rotates irregularly (just like lightning).

Whenever you want to make a lightning effect, just spawn a few of these “particles”.

Hi Savart,
thanks for replying ,the second option is the correct one,what i was thinking is to create a sphere and then in gimp create a sequence of lightning after that go to blender and animate the sequence textures applying to the sphere with the clipped alpha option and when he throws the balls it would assign the 2 handed balls to invisible and then the bigger one comes into play with a track actuator to the enemy s empty,thats wat was in my mind,is that possible,or do u have any idea of how to get that to work?

Here is an animated lightning texture I created a while back. You can fix it however you want.


Hi Romy,

that sounds possible, though I don’t know if you can do that without python,
and the ideal solution very heavily depends on what you have so far.

By attacking you could addObject your two balls,
and setLinearVelocity them to your target destination.
Each ball has a collision brick connected to another python code,
which spawns a bigger sphere, and kills the balls at collision.

Parenting might be a bit trickier, since there’s no way to get your collision object from your collision sensor.
An alternative might be to use rayCasts in code, since you can get the collision object -
but you’d need several of them pointing in different directions,
else your energy ball might not hit anything that runs sideways into it.

If you don’t have Python experience, I could hack something together.

SPSStudios thanks dude for the textures i ll give it try and test them although im already creating my own lightining but i really appreciate that!
Savart-Unfortunately i dont know python so im gonna have to use logic bricks which will be tricky but i think im going to achieve the desired action with some efforts hehe but if u have a script for me i really appreciate that :smiley:

By attacking you could addObject your two balls,
and setLinearVelocity them to your target destination.
Each ball has a collision brick connected to another python code,
which spawns a bigger sphere, and kills the balls at collision.

thats a great tip imona try dat in LB :smiley: ill be back later with an eventual result ^^ but plz keep posting coz ima keep my eyes on this thread every once in a while!
thx

Thinking out of the box, why not have a seed object that spawns planes that branch away toward a target?

not a bad idea,but im having problems with animated images using the sprite plugin from gimp,the thing is blender doesnt seem to handle too well animated textures,it takes too long to set up the settings and when its almost done it throws me an error which is pissing me off and im not even talking bout the rediculous image positioning,i cant find the right spot to animate it properly it doesnt get aligned at all which sucks so much,i think the developers have a long way ahead to solve this issue and improve the new “Stable” version…
any help is greatly appreciated,im stuck and i almost finished the images ,i just need to create a couple more to get the animation done…how to get the UV aligned to the image tiled in the X axis?
its all bugged out!
HEEELPP

Ok i think my computer doesnt handle more than 1 animated textures in the scene i simply cant work with that,so im wondering what would be the option left ffor me ? does particles work for game engine?
any help is greatly appreciated!

EDIT: Nevermind on that,i figured it out why it was eating the whole cpu and mem,the problem was that the image size was too big something like 3 mb so i had to low the resolution to 512 then it worked!
im still working on it but im posting a video of how the electric charge looks so far:

Plz C&C,suggestions are always welcome

Another small update : http://www.youtube.com/watch?v=TawkZc5YTp0

this video has 2 parts ,the first time i played i set the electric charge emitter to 2.00 and the second time i set it to shadeless,please let me know which one looks better!
thx,
Romy

Not seeing any difference to be honest :slight_smile:

ok thx man :D,does it look bad?