Clicking in the enterFrame

Subscribe to Clicking in the enterFrame 3 posts, 2 voices

 
avatar for lacorp lacorp 8 posts

Hello Kongregate users. I am in the process of programming a simple shooter game and am in need of some help. I have a turret that fires when you move the mouse. Currently my code looks something like this:

onClipEvent (enterFrame) {
     //Movement stuff goes here and such
}
onClipEvent(mouseDown){
      //Firing stuff
}

Now this is great and all, but I want to get the mouse down stuff into the enterFrame thing. If I do this then I can make it so the user doesn’t have to click to fire and then they can just hold down the mouse key.

Thank you, lacorp

 
avatar for SalsaJoe13 SalsaJoe13 391 posts
onClipEvent(mouseDown){shooting=true}
onClipEvent(mouseUp){shooting=false}
onClipEvent(enterFrame){
//movment stuff
if(shooting == true){
//shooting stuff
}
}
 
avatar for lacorp lacorp 8 posts

Thank you SalsaJoe13, that fixed my problem. :)