Touch and Hold Question

Hello there,

let’s get straight to the point, I’m quite new to this so please be gentle if i say or ask something stupid  :smiley:

So I’m basically trying to make some sort of top-down 2D shooter, the exception to normal top-down shooters

would be that the player character stands still at the middle of the screen and the enemies attack from all directions.

Everything works fine so far.

At the moment the touch event anywhere on the screen shoots a projectile from the player in

the direction of the touch event per linearVelocity.

But how do i get it to work so that i can keep it pressed and continue shooting while doing so?

Found some examples already but none of them really helped.

Would be nice if someone could take the time to enlighten this noob here  :slight_smile:

Best regards

Alex

Maybe this tutorial is what you’re looking for:

http://coronalabs.com/blog/2014/02/04/tutorial-continuous-actions-in-corona/

Rob

Hey there Rob,

i think that’s exactly what i was looking for, and it’s so simple too!  :slight_smile:

Now I feel kinda embarrassed for not finding that tutorial or even finding the solution myself… 

Thank you very much, that really helped!  :slight_smile:

//EDIT: I just realized it’s not that simple… is there any way to access the coordinates of the last touch event that happened or something like that?

I still need to tell them bullets where they need to fly to, and normally i’d use the x/y coordinates directly from the touch event.

//EDIT2: I just figured out a simple solution! Thanks again for getting me on the right track  :smiley:

Best regards

Alex

Maybe this tutorial is what you’re looking for:

http://coronalabs.com/blog/2014/02/04/tutorial-continuous-actions-in-corona/

Rob

Hey there Rob,

i think that’s exactly what i was looking for, and it’s so simple too!  :slight_smile:

Now I feel kinda embarrassed for not finding that tutorial or even finding the solution myself… 

Thank you very much, that really helped!  :slight_smile:

//EDIT: I just realized it’s not that simple… is there any way to access the coordinates of the last touch event that happened or something like that?

I still need to tell them bullets where they need to fly to, and normally i’d use the x/y coordinates directly from the touch event.

//EDIT2: I just figured out a simple solution! Thanks again for getting me on the right track  :smiley:

Best regards

Alex