Group Group Group Group Group Group Group Group Group

Chapter 3, my SpaceMarine is shooting continuously

For sure, i’ve bought the book before like you saw when i send you my project. I hope that you will trust me. I promess i wont send it to any one.

Hi there!

You should be able to download the PDF from this page if you’re logged in: https://store.raywenderlich.com/products/unity-games-by-tutorials

Cheers!
Eric

Hi ! I’ve already bought the book ! In paper version. I asked if i could have it for free, in PDF, because i forget my book at my home.
Cheers !
Raphaël.

Hi Raphaël,

In order to gain access to the pdf, you will need to have purchased it as part of a bundle or purchase it on its own. By default, the book does not come with the pdf included. For more information, you can head over to the store or you can contact support@razeware.com.

Thanks,
Brian

Oh, I think that you didn’t understand well what i was saying. I was asking you if you agreed to send me by mail
:frowning: I knew that you wont be trusting me…

Sorry i pressed the enter button. So i was asking you if you agreed to send me by mail a PDF of the book for free, because i forget my paper book at my home and i’m in vacations… I really want to continue this fantastic book and this is the only way. Please trust me :slight_smile:

You’ll need to contact support@razeware.com. They may be able to help, but if you haven’t purchased the bundle, you may be asked to purchase it.

Because you don’t have access to the book ?

Hi @overdoze,

I’m sorry you forgot your book :frowning:

Unfortunately we are not able to offer you a free PDF, however if you did purchase the print version and would like to buy the PDF version at 50% discount, please email support@razeware.com with your Amazon receipt and I can add it to your account for $27.50.

Thanks!

Hi ! This is kind but i won’t buy the book another time :wink: I’ll wait for the end of the vacations to continue the book. Thanks,
Raphaël.

By the way, @bdmoakley, i’m trying to do a 2D game with a tank which is firing bullets when i click with the mouse. But i have a problem : the bullets doesn’t have any speed ! I tried AddForce, AddRelativeForce, .velocity and nothing worked… I know that it’s not a help room but, please, i’ve been trying for a long time and i don’t understand why i arrive at nothing. Here’s the code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Gun : MonoBehaviour {
public GameObject bulletPrefab;
public Transform launchPosition;
public float shootingspeed = 10f;
public float fireRate = 0;
float timeToFire;

void fireBullet() {
// 1
GameObject bullet = Instantiate(bulletPrefab) as GameObject;
// 2
bullet.transform.position = launchPosition.position;
    // 3
    Physics2D.IgnoreCollision(bullet.GetComponent<Collider2D>(), GetComponent<Collider2D>());
    bullet.GetComponent<Rigidbody2D>().AddRelativeForce(new Vector2(shootingspeed, 0f), ForceMode2D.Force);
}
// Use this for initialization
void Start () {
	
}

// Update is called once per frame
void Update () {
	if (Input.GetMouseButtonDown (0)) {
        if (!IsInvoking("fireBullet"))
        {
            InvokeRepeating("fireBullet", 0f, 1.25f);
        }
        else
        {
            if (Input.GetButton("Fire1") && Time.time > timeToFire) {
                timeToFire = Time.time + 1 / fireRate;
            }
        }
	}
			if (Input.GetMouseButtonUp (0)) {
				CancelInvoke("fireBullet");
			}
		}
	}

Please help ! :wink:

That’s ok, don’t worry about that, i solved the problem alone ! Thanks anyway :wink:

This topic was automatically closed after 166 days. New replies are no longer allowed.