parent and .localposition?

I’m currently working on a scrolling shooter which gives more of the visual impression of being a fully fledged 3D flight game (which I’m later going to turn into something more along the lines of an Afterburner-ish thing).
An important part of this is to make both bullets and enemy vehicles move together with the gameplay area.

Now, I’ve read enough about this stuff to know that I need to use parenting and .localposition to solve the problem. I am however such a noob at programming (I began programming in Unity two days ago), that I don’t quite know HOW to use those two things. The script on the bullet currently looks like this:

using UnityEngine;
using System.Collections;

public class Projectile : MonoBehaviour {
public float ProjectileSpeed;

	// Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {
		float amtToMove = ProjectileSpeed * Time.deltaTime;
		transform.Translate (Vector3.back * amtToMove);
	}
}

Also, I’ve put the player object inside an object called GameplayArea, which should be the parent of all other game objects. Could someone help me make this work?

You can use the transform of the bullet itself to propel it forward:

void Update () 
{
transform.position = transform.position + transform.forward * Time.deltaTime * 5f;
}

Depending on what you want to achieve, I would tell you to use ray-hitscanning or projectile with rigidbody and use of forces for your projectiles.

I’ve finally managed to make it work… partially.


The problem here is that, while the bullets are parented to the the plane, they’re not programmed to be launched in the direction that the plane is flying, but rather in worldspace.
This image hopefully clarifies things. The white lines are trails after the bullets. All bullets should follow each other, since I haven’t provided any input beyond shooting.

This is the script I’m using now:

using UnityEngine;
using System.Collections;

public class Projectile : MonoBehaviour {
	public float ProjectileSpeed;
	public Transform iTweenrider;
	// Use this for initialization
	void Start () {
		
	}
	void Awake () {
		transform.parent = iTweenrider;
		//GameObject Projectile = Instantiate(Projectile,PlayerCannon ,Quaternion.identity);
		//Projectile.transform.parent = iTweenrider;
	}
	// Update is called once per frame
	void Update () {
		float amtToMove = ProjectileSpeed * Time.deltaTime;
		transform.Translate (Vector3.back * amtToMove);
	}
}

The (hopefully) last thing I’ll need is to figure out how to make the bullet fire in the direction the Player object is facing.