- Home /
Implementation of power-up functionality
I have a power-up (red color bullet), how can I realize that my character can shoot them? Also in the lower left corner of the screen, I have a circle and I want the picture/icon of this power-up to appear in this circle and the countdown starts inside the circle (the remaining time of red bullets will be indicated)
FYI: I have a 2d shooter game
At that moment when there will be power-up shots, it is necessary that simple shots do not exist. By default, I have blue color bullets.
Here is my code:
public GameObject PlayerDefaultShip;
public GameObject BulletPosition01;
public GameObject BulletPosition02;
// Update is called once per frame
void Update ()
{
if(Input.GetKeyDown("space"))
{
GameObject bullet01 = (GameObject)Instantiate (PlayerDefaultShip);
bullet01.transform.position = BulletPosition01.transform.position;
GameObject bullet02 = (GameObject)Instantiate (PlayerDefaultShip);
bullet02.transform.position = BulletPosition02.transform.position;
}
}
Here is screenshot(Unity): https://drive.google.com/file/d/1Dn_l5dFjOf2_JrZ-w4ISdIUjLynqhsNf/view?usp=drivesdk
So, here is my question: If I go back to my question about the blue bullet, how can I use it (power-up bullet(red bullet)) if I use the blue bullet prefab(default bullet)? How can I change this code? Or what should I do?
So: My default bullet is - blue color, i want to make red bullet color(power-up), but i dont know how to implement this is in my code
so for starters what causes your character to be able to shoot the power up bullet in the first place? I don't see anything that causes your player to shoot one or the other.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Illuminating a 3D object's edges OnMouseOver (script in c#)? 1 Answer
how to create a custom type in C#? public Atype atype; 1 Answer
calling a class named by a string -1 Answers