Monday, June 8, 2015

P2D6

Used another bunch of rather crude int triggers (I really need to figure out how bool works) to make enemy movement direction random.

Randomized all the timers just a little.

Made graphic for background and spawner.

Defined walls and made enemies turn back when they hit the wall.  Currently player can still walk past the walls, I think I can make the player's speed 0 if he walks into the wall.  Might need to tag top/bot and side walls differently so it only affect the proper axis.

I want to make sure minions face the other way when they walk left, like the player does.

Still need to make the minions shoot at player, and hurt the player if they overlap.

I want to make the minions not overlap each other as much.  I wonder if I can define a secondary collision box tagged differently just for this?

Need UI and scoring.

I'd like to make animations and fx for everything too.

Eventually need sounds.


Here's the round-about way I did the randomized turning/pausing etc:


void Start () {
        timeStamp5 = Time.time;
        timeStamp6 = Time.time;
        ispaused = 0;
        randomPause = 0f;
        randomWalk = 0f;
        isFaced = 2;
        //randomFacing = 1;
    }
   
    void Update () {

        if (isFaced == 2)
        {randomFacingDice = Random.Range (-1, 2);
         randomFacingDice2 = Random.Range (-1,2);

        }

        if (randomPause == 0)
        {
            randomPause = Random.Range (0.1f, 1f);
        }
        if (randomWalk == 0)
        {
            randomWalk = Random.Range (0.1f, 1f);
        }

        if ((ispaused == 0) && Time.time - timeStamp6 >= pauseTime + randomPause)
        {
            timeStamp5 = Time.time;
            GetComponent<Rigidbody2D> ().velocity = new Vector2 (randomFacingDice*enemySpeed, randomFacingDice2*enemySpeed);
            ispaused = 1;
            randomPause = 0;
            isFaced = 2;
        }
        if ((ispaused == 1) && Time.time - timeStamp5 >= pauseRate + randomWalk) {
            GetComponent<Rigidbody2D> ().velocity = new Vector2 (0, 0);
            timeStamp6 = Time.time;
            ispaused = 0;
            randomWalk = 0;
        }
   
    }

No comments:

Post a Comment