- Home /
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
Answer by ahaykal · Apr 28, 2013 at 08:19 AM
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.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Gun Script Help 2 Answers
How to use Enum? 1 Answer
Casting Variables 1 Answer
Public variable in script different for every game object. 1 Answer