Download

Shooting to screen touch direction in 2d side scroller

Hi, gyus I am trying to make 2d character to shoot on screen hit location but I have fail with that. Does anybody have ideas? May be you have tried to make it on your own? There is my non-working logics
http://i72.fastpic.ru/thumb/2015/0807/42/bf00af7f5281f8bf064d444ded2dce42.jpeg
http://i72.fastpic.ru/thumb/2015/0807/86/53f82e37de02fb8be5677155f5fc4186.jpeg
With this my character shooting anywhere but not to the screen touch direction .Can you help me , please?

Ok , I have solved this problem , but I have got another one. Evrething works good untill I’m trying to apply forward vector (red circle on the screen)
Forward vector does note rotate with 2dVector between onscreen player location and onscreen touch hit location. And this causing not accurate shots and projectile spawning only to the right from player
http://s1.uploadpics.ru/images/-y2onrUXEe.jpg

You should be careful when you add a float to a vector, as I’m pretty sure that float is added to all three components of the vector, which would make a very different vector.
If you want to make that vector longer, you should multiply it instead, or add a vector with the components you want.

Oh thanks a lot . You have really helped me!