Random Object Movement Question

Hey guys. After a certain time period in my game I want to spawn an actor that initially starts moving in a random direction then bounces off any of the 4 walls surrounding the rectangle arena if it hits them. I then want it to bounce off the walls (already done this). I finally want it to increase its speed over time so it bounces around faster and faster. Any ideas?

Comments

  • CharlieG97CharlieG97 Member Posts: 52
    Anyone?
  • AdrenalineAdrenaline Member Posts: 523
    Which are you having trouble with? Because you said "already done this".

    Are you asking for help with the increasing speed?
  • AdrenalineAdrenaline Member Posts: 523
    If so, here's how I've done it.

    Make 2 game attributes. "speed" and "speed modifier" or any other names you want, of course. Set the initial values to something that makes sense, but I strongly recommend setting speed modifier to 1 right now.

    Inside each actor, you want a behavior that will constantly be checking itself so place it in a timer with a very low number. Set the velocity of the actor equal to speed * speed multiplier.

    In an outside actor, you can increase the speed multiplier with a timer. Set up a timer behavior and every few seconds you can set speed modifier equal to speed modifier * 1.1

    This will give you a steady increase in speed. If at any time you want to change the base speed of the actors, just change the attribute "speed" that you created earlier.
Sign In or Register to comment.