How would I make a lightning bolt coming from the sky hitting the ground?

Im making an Boss Fight in an Earth Bending game and i need to make a Phase 2 where lightning hits 4 servants, reviving them, and so on. Please help me: CoSpaces Edu :: Earth Bending Prototype

Hi @OrangeGlowest, Which part are you struggling with? Making the lightning move, or moving to the position of the servants, or something else?

I suggest having a go at making the lightning part, then Update your share, and re-share here.

I dont know how i would do something like that.

@techleapnz I dont know how I would make a lightning bolt with random direction generation hitting the same point at the end

@OrangeGlowest Lightning is though, but you could use a similar technique you’ve used for the spawning; This time however you’d have to work with a position that you dont know yet. However through code we can find the position of the servants fairly easily using the “position of” block.

Now we can move the path to the correct location, the easiest way is to simply create one path (thats straight so that when we move it to the servant it will be on the right location). But instead of moving it directly, we create a copy of it. Copy’s of objects can be made using the “copy block” but you already knew that ofcourse, since you have used it for the earth bending;

However referencing the copied object directly can be done if you create a variable and assign it the “copy of” block with the object you want copied selected. Now using the variable you can move or do anything with the object through code!

Knowing that we can create a copy of the lightningPath, move it to the servant we want, then create a copy of the particle… which is actually not allowed in cospaces (you wont see it show up in the “copy of” block selection menu). However if you make the particle a child of another object, like putting it inside of a cube and then making the cube invisible, you can copy the particle by copying the block its in!

So to finish up, we make a variable for our particle copy, then assigning it a copy of our invisible cube containing the particle. Then moving this copy along the copied path and you get a lightning strike style effect. All we do after is delete our copies, because we no longer need them, and boom you got a cool ressurection animation. I very quickly threw this together so tweak the animation to your liking.

This copy technique is very handy, I figured I’d show it rather than try to explain because it can be a bit tricky, that being said I’m sure you will be able to use this technique plenty more for your game!

If you have any more questions please let me know, though from now on I will leave the coding up to you and try to help through text :smile:

Edit: I changed the making of the copies a bit because it was not deleting them correctly. Now I have them as parameters of a function instead of variables. This because variables can be changed everywhere, so that when we play 4 at the same time it will override the copies under the same variable name, by making it into a parameter of a function they become instances only accessable by that instance of the function. This is a bit more technical and advanced, but a fundamental part of coding so if your intrested in learning about it you can look up “programming scope definition” in google.

Best of luck!

Thanks for your idea but that is not what i was taking about, you know how lightning will go in a random direction like this:

download (1)

How would i do this as i would like to do it myself.

here is what i was talking about: (wont let me post link here is code :EPC-RHD

Hm, you could try using random numbers to introduce variation within the movement.

But for like a fully animated lightning strike you would have to learn VFX effects, alternatively you can draw a frame by frame animation and upload it as a gif, or (since gifs will keep looping and therefor you cannot time their start) turn it into png’s, import them individually into your scene as a group so you can reveal and hide them to make your own timed frame by frame animation; Thats how I ended up doing it for my own game:
BBTrigEffectVFX-1
BBTrigEffectVFX-2
BBTrigEffectVFX-3
BBTrigEffectVFX-4

Ah well you could group the 3d object, than create an animation by setting their opacity to 0% and slowly revealing the objects from the top down.

Luc, here is the final prototype, have a look, i can tell you want to: SSZ-JGP

1 Like

@OrangeGlowest very nice! You’ve done a great job on the boss’s ai having different attacks and all.