Doubt in scripting

Updated on July 23, 2018 in [A] Brackeys Courses
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
8 on April 16, 2018

hi Guys,

I watched the How To Make A Video Game series

i just wandered weather I Can Increase the speed of the Player over Time

please help me with this issue

  • Liked by
Reply
0 on April 16, 2018

Yes, you can increase the speed of the player over time.

There are many, MANY, ways you can go about doing this. Could you give an example of when it would happen and how it would look in your game?

  • Liked by
Reply
Cancel
2 on April 16, 2018

i have created a 3d game object (Cube) and kept it as the main player then a long endless road with obstacles trough which i need to escape and reach the end /* same as Thirsland “the brackeys guy” did */ same scripting just the duplicate of it. i added another script and named it Speed Increase and i want to access the variable (the force of the object) of the Player Movement script and increase it with time and the side velocity with increase in time

on April 16, 2018

the side velocity is the velocity that is required to move left and right

Wise
on April 16, 2018

Ok, so you’re making a SubwaySurfer-like game.

I suggest keeping the speed increase in the player script opposed to a separate one. Specially because it’s only gonna affect the player’s speed only.

You can keep track of the time you’re in the level with a float variable and increase it by Time.deltaTime in the update loop. Then you can just multiply your initial speed by that number to get a speed that increases linearly as time progresses.

Show more replies
  • Liked by
Reply
Cancel
1 on April 16, 2018

Do you have a time variable or something similar? If so, as it gets higher you could make it ( if (time > 1550) {speed = speed + 50; sideVelocity = sideVelocity + 50;} and so on so forth for every say 1550 increments in time! I hope I could help, and please DO NOT hesitate to ask more questions! 🙂

on April 16, 2018

nope i don’t have but i want know to count the time from the start of the level 

Show more replies
  • Liked by
Reply
Cancel
0 on April 17, 2018

Thanks A lot Shanks and Mouledoux the problem is solved by you guys

  • Liked by
Reply
Cancel