Engine |
02-09-2010 10:31 PM |
My ungodly amount of questions thread.
Instead of creating a new thread for every possible problem I come across, I have decided that it would be a better idea just to keep all my questions in one thread.
Right now I'm currently attempting to make it so every time I press 'f' fire comes out in the direction the player is facing and then disappears 2 seconds later. I cannot figure out why it's not working correctly. Can anyone try to walk me through what I'm doing wrong?
Weapon
PHP Code:
//#CLIENTSIDE function onKeyPressed() { if(params[1] = "f"){ player.attr[12] = "enginetest7.gani"; scheduleevent("2","ClearFire", ""); } } function onClearFire(){ player.attr[12] = NULL; findimg(200).destroy(); }
Gani
PHP Code:
//#CLIENTSIDE function onCreated(){
with(findimg(200){ emitter.delaymin = 0.01; emitter.delaymax = 0.01; emitter.nrofparticles = 1; emitter.particle.image = "g4_animation_fire.gif"; emitter.particle.alpha = 0.99; emitter.particle.lifetime = 0.5; emitter.particle.speed = 10; emitter.particle.spin = 2; emitter.particle.red = 1; emitter.particle.green = .4; emitter.particle.blue = .4; } this.showtime=timevar2 + 2; setTimer(0.05); }
function onTimeout(){ showimg(200); if(this.showtime >timevar2){ this.fireangles= {-4.7,-3.1,-1.6,0}; x =player.x; y = player.y; for(i=0;i<4;i++){ if(player.dir=i){ findimg(200).emitter.particle.angle = this.fireangles[i]+random(-.5,.5); } } setTimer(0.05); } }
Edit: I removed //#CLIENTSIDE from the gani, I assume I don't need it twice. I forgot I had it in there from when I was testing it as a class.
|