[2D MMORPG] Firing a projectile

Updated on March 28, 2017 in [A] 2D
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
9 on March 16, 2017

Hello here, im making a 2d mmorpg, and i wanted to know how can i make a firing projectile. You change ur direction with w a s d, but i don’t know how to make it fire a projectile to the direction my char is looking at. (i have a firepoint but im not able to change it’s position or direction when my char turn.)
If anyone could help pls.
Thanks.

  • Liked by
Reply
0 on March 24, 2017

Up, anyone pls ?

  • Liked by
Reply
Cancel
1 on March 24, 2017

Parent the FirePoint and use Transform.Forward

on March 25, 2017

The projectile still not moving, and i have no idea how to make my firepoint rotate when my char rotate. If you could help please. Thanks !
My script : 
void Shoot(){

GameObject projectile = Instantiate (Projectile, firePoint.position, Quaternion.identity) as GameObject;
 Projectile.GetComponent<Rigidbody>().AddForce(statR.rapidite,0,0);
 }

Show more replies
  • Liked by
Reply
Cancel
2 on March 25, 2017

Ok now i can fire my projectile.
Fire point script : 

void Shoot(){
 GameObject projectile = Instantiate (Projectile, firePoint.position, Quaternion.identity) as GameObject;
 }

and projectile script : 

Rigidbody rb;
 void Start () {
 rb = GetComponent<Rigidbody> ();
 }
 void Update () {
 rb.AddForce(0,5,0);
 }

The projectile is only fired to up and his direction don’t change when my char direction change.
Need help please. thanks

Wise
on March 25, 2017

What kind of direction changing are you looking for?

on March 25, 2017

The first one.
My char direction change with
Input.getbutton(“horizontal”) and (“vertical”).    
(arrow keys)
And i want : when my char change his direction with arrow keys, the firePoint do the same.

Show more replies
  • Liked by
Reply
Cancel
2 on March 27, 2017

Up, Anyone pls ?

on March 28, 2017

https://www.youtube.com/watch?v=KKgtC_Gy65c

Check this tutorial and it’s B part

on March 28, 2017

Already tryed, don’t work.

Show more replies
  • Liked by
Reply
Cancel