Question by
simonellis1979 · May 12, 2018 at 08:46 AM ·
c#scrolling
Increase scroll Speed on point scored
This might be a simple answer to you c# experts but I just can't get my 2d side scroller to change speed on point scored. My player is static and I'm scrolling the background. I want to increase the scroll speed slightly when a point is scored can anyone tell me how I change public float scrollSpeed; from the game controller script in my point scored script?
Comment
Best Answer
Answer by simonellis1979 · Jul 08, 2018 at 08:52 PM
Ok I worked this out for anyone interested. In my game controller I added these lines to the following voids. void start resets the the speed to 1 each time you restart the game.
void Start ()
{
Time.timeScale = 1f;
}
public void Scored()
{
if (gameOver) {
return;
}
Time.timeScale += 0.5f * Time.deltaTime;