SHMUP - Scoring and Scripting Help

Hey guys and gals,

I’m creating a SHMUP using unity 4. However, I am a beginner to scripting and am still quite lost and unsure of whats what so I was wondering if anyone would be able to offer some help.

The idea behind it is that enemies spawn in waves so that’s all fine and working great. However the problem is in the scoring.

What I want to happen is that when the enemies spawn then are randomly 1 of 3 colours (Red, Blue, Green). So I know I need a new variable enemyColor: int

However I’m not sure of the script I actually need for making them spawn one of these colors. Can anyone help me out?

Cheers

  • Prophet

1 Answer

1

I don’t know if I understood your question correctly but anyway, in the start function of the enemy script assign a random color to the enemies.

var colorChoices : Color[];

function Start()
{
renderer.material.color = colorChoices[Random.Range(0, (colorChoices.length))];
}

Yeh cool I'll give it a try, thanks man :) I may of worded it badly haha :S sorry But yeh the main point of it will be when enemies spawn they will be one of three colors (R,G,B). Enemies will spawn in waves. If you kill 3 blue enemies in a row you will get a multiplier of 3x. The same applies for the other colors. But the second you kill an enemy that isn't the same color the chain is broken.