Question by
Officialmanish · Sep 12, 2017 at 05:45 PM ·
scripting beginnerdynamic variables
How to increase/decrease background scroll speed in a game like flappy birds?
Ok, so my question is simple. Let say the player has scored > 100 so I want to increase the background scroll speed from 2 to 5 using the script. This is what I am doing right now :
private Rigidbody2D rb2d;
void Start ()
{
rb2d = GetComponent<Rigidbody2D> ();
rb2d.velocity = new Vector2 (0,
GameController.instance.scrollSpeed);
}
As you can see the speed is coming from another script called GameController. So If I change the speed in the GameController itself it does not work because Start function is called only once. So what is the solution to this problem ?
Comment
Your answer
Follow this Question
Related Questions
How would I add rotation limits to this? 1 Answer
How do I improve my teleport script? (Screen freeze, delay, fade). 1 Answer
Transitioning 3 colors depending on int value. 1 Answer
Can anybody help me with a smooth touch control? 0 Answers
,How can you make a GameObject/Prefab spawn on a wall a player is looking at? 0 Answers