Why do my bullets always go the wrong way when my player turns around?

So I tried to make a shooting mechanism for my game. My player can shoot in the direction pointed by the mouse. My player can also turn around, facing the other way as he walks. The firing mechanism is fine when my player is facing right, but when my player is facing left (I used transform.localscale and set my x scale to a negative value so my player sprite is flipped) the gun is also reversed, i solved the problem on the gun, but when i shoot the bullet, the first bullet fired after i turn around will go in the wrong direction. I set my weapon as child of an empty game object named gunHolder like this:

enter image description here

When it play, it looks like this, when i trun around and shots my first bullet, the bullet go in mirror direction:

how it looks like when it play

My shooting code look like this:

void FixedUpdate()     {                  Vector3 difference=Camera.main.ScreenToWorldPoint(Input.mousePosition)-transform.position;         float rotZ=Mathf.Atan2(difference.y,difference.x)*Mathf.Rad2Deg;                  if(player.transform.localScale.x==1)turnOffset=0;         else turnOffset=180;          transform.rotation=Quaternion.Euler(0f,0f,rotZ+offset+turnOffset);         if(timeBtwShots<=0){             if(Input.GetMouseButtonDown(0)){              Instantiate(projectile,shotPoint.position,transform.rotation);              float transX= (float)(player.transform.localScale.x*0.3);             projectile.transform.localScale= new Vector3(transX,projectile.transform.localScale.y,projectile.transform.localScale.z);              BulletBehaviour bulletBehaviour=projectile.GetComponent<BulletBehaviour>();             if(player.transform.localScale.x==1){                 bulletBehaviour.flip=false;             }             else{                 bulletBehaviour.flip=true;                 Debug.Log("flip");             }             timeBtwShots=startTimeBtwShots;         }         }else{             timeBtwShots-=Time.deltaTime;         }              } 

So I flip my weapon based on where my player is facing. I handle my player animation when facing another direction by changing transform.localscale.x:

scale=transform.localScale; if (Input.GetKey(KeyCode.A))      {           isMoving=true;           Vector2 movement = transform.right.normalized * -moveSpeed;           rb.AddForce(movement);           scale.x=-1;      }      else if (Input.GetKey(KeyCode.D))      {           isMoving=true;           Vector2 movement = transform.right.normalized * moveSpeed;           rb.AddForce(movement);           scale.x=1;      } 

And my bullet script look like this:

void Update()     {         if(!flip){             transform.Translate(Vector2.right*speed*Time.deltaTime);                          }         else {             transform.Translate(Vector2.left*speed*Time.deltaTime);             }     } 

Based on where my player facing, i change my bullet direction(I did this because before, my bullet went in the wrong direction if my player was facing left). Now my bullets are facing the right direction, it’s just that the first bullet that is fired after my player turns around always goes in the wrong direction (the opposite direction to the direction it should be, even the sprites are reversed). Anyone know why this happening and how to solve this?

Best algorithm for switching between bullets before reloading the current one

I’m wondering about how most 2d games deal with switching between player bullets when the current one isn’t / is being reloaded.

Currently, I have these configurations in my brain:

  1. Let the player switch to another bullet but he will have to reload the current one completely even if it was 100ms left to be fully reloaded, when he switches back to it.

  2. Let the player switch between bullets and when he switches back to the current one (the one he was left not reloaded), he will just need to wait the remaining time for it to be reloaded and not the entire reload time.

  3. The player would be able to switch between bullets but after some delay and when he gets back to the one that was left not reloaded, he will find it ready for use.

These are the ideas that came to my mind, but I’ll be glad if you present better ones for me.

So which one is better ? Which improvements do they need ?

Bullets Stop when Shooting Unity 2D

using System.Collections; using System.Collections.Generic; using UnityEngine;  public class Makarov : MonoBehaviour {     public GameObject Bullet;      public float BulletSpeed;      public Transform ShootPoint;      // Update is called once per frame     void Update()     {         if(Input.GetMouseButtonDown(0))         {             shoot();         }     }      void shoot()     {         GameObject BulletIns = Instantiate(Bullet, ShootPoint.position, ShootPoint.rotation);         BulletIns.GetComponent<Rigidbody2D>().AddForce(BulletIns.transform.forward * BulletSpeed);     } } 

When I shoot the bullets just stop right in front if the gun. This is for a top down shooting.

200 Words SEO Product Description with Bullets Features on Amazon for $3

With this gig, I will create unique product descriptions on Amazon that will convert leads to greater sales volume than ever before! As an experienced digital marketing content writer, I perceive how can an SEO friendly Amazon product listing be an important factor in generating more sales online. I will help you creating SEO product title, tags, and descriptions for your products that will communicate the value of products and services you offer and convince the potential buyers to make purchases. Services Included: Focus KeywordsCompelling Sales CopySearch Optimized TitlesBranding of New ProductsAmazon Products Descriptions Competitors’ ResearchSEO Marketing Keywords PlacementGoogle AnalyticsSelling eBay Listings Why me? Quality work (100% original content)ยท Well Researched Content100% Money-Back GuaranteeCustomer’s satisfaction is the priority Inbox me to see sample work! Best Regards ABDULLAH AKHTAR

by: WebOWrite
Created: —
Category: Content & Writing
Viewed: 240

How to add style bullets to Summary Links Web Part

I am working with Summary Links Web Part and I notice that when I click on Configure Styles and Layouts that in the dropdown the selection is different from one Site Collection to another.

My question is, is there a way to add a style selection to the dropdown?

For a better explanation please see below:

enter image description here

Based on the above, is there a way for me to add a bullet style for example, something called SmallBullet to the dropdown list in Summary Links Web Part?

I heard it was possible but I have not seen it performed.