Not too long ago, I made a code for a simple explosion and put it in a game I've been working on.
It triggers like normal so far exept that in the original code I had to use KeyDown and hold the key down for the blast to expand.
When I trigger it in the game, it acts like I was using a KeyHit command and just shows the first part of the explosion as if it were the first frame.
I would like it to explode completely with a single hit of the key.
Here's the code for the Explosion:
I've tried several loops but they did not work and some even halted the program.
How can I make it explode with KeyHit?
It triggers like normal so far exept that in the original code I had to use KeyDown and hold the key down for the blast to expand.
When I trigger it in the game, it acts like I was using a KeyHit command and just shows the first part of the explosion as if it were the first frame.
I would like it to explode completely with a single hit of the key.
Here's the code for the Explosion:
;Simple Explosion ;---------------- Graphics3D 1024,768 SetBuffer BackBuffer() light=CreateLight() cam=CreateCamera() PositionEntity cam,0,0,-30 Global cone=CreateCone() Global flashfade#=1 Global boomx#=1 Global boomy#=1 Global boomfade#=1 Global boomsprite=LoadSprite("Blahblah.bmp") HideEntity boomsprite Global boom=LoadSound("Blah blah blah.wav") While Not KeyDown(1) If MouseDown(1)=True Then ;<<<<<<<<And There it is. I want it to be KeyHit. simple_explode() If Not ChannelPlaying(boomchn) boomchn=PlaySound(boom) ChannelVolume boomchn,1 EndIf EndIf RenderWorld Text 10,10,"Press and hold the left mouse button for a simple explosion" Flip Wend End Function simple_explode() ShowEntity boomsprite PositionEntity boomsprite,EntityX(cone,1),EntityY(cone,1),EntityZ(cone,1) boomx#=boomx#+.3 boomy#=boomy#+.3 ScaleSprite boomsprite,boomx#,boomy# boomfade#=boomfade#-.011 EntityAlpha boomsprite,boomfade# End Function
I've tried several loops but they did not work and some even halted the program.
How can I make it explode with KeyHit?