How do I Auto Runner with all kinds of stuff. (math is hard)

0 favourites
  • 7 posts
From the Asset Store
Dynamic heavy and powerful hard rock tracks. 15 tracks, loops and more.
  • Let's say you take the autorunner template and you want to add enemies and guns and stuff that moves around alot. Oh, and the speed of the autorun changes, and the camera scrolls to the player...

    Am I correct in thinking you'll have to base every bit of movement on the bullet speed of the background to get it to look right?

    Anyone know of some crazy tweaked autorunner examples I could look at?

    Mine's actually a vertical driving game. you can drive left and right farther than the viewport width, the camera follows your car around, you can speed up and slow down, so the background bullet is going all over the place.

    I've managed to get a lot of it working, but the math is exploding my head.

    (ex. traffic that goes backwards if you're going faster than it, and forwards if you're not, goes right when you go left, etc..)

    I've got every bit of movement using some crazy formula based on the background's bullet speed and angle. Am I missing some obvious concept and making things way too hard?

    Is there some other way to get these things to move around correctly or do I just keep exploding my head?

    Trying to make bullets you can shoot is the headache that finally inspired my cry for help...

  • I followed the template when making my auto-runner, and at some point it got really weird. I switched the whole concept of moving the background to actually moving the character and it got way easier. I would send you a cap.x but I'm close to publishing.

  • Can you just kind of explain conceptually what you did different?

    Did it get weird for the same reason? Having to base movement off the background bullet?

    I really like the way it all looks and works, it's just such a headache to figure out.

  • You probably use the bullet behavior for the background so it makes it seem like the character is moving. Instead of doing that, add 8 directional movement on the vehicle the player is driving and just make the viewport scroll to the vehicle. And than add bullet behavior/whatever you need to diff enemies/obstacles so that everything moves on it's own. And you can make the background static and wraping it as you progress.

  • My autorunner has 4 enemies: 2 are static, 1 is moving vertically and to the right, 1 is moving to the left. Background is static and I used platform behavior for my character to make the auto-running (everytick: simulate platform pressing right). You would need 8 directional to make it move upwards everytick, and change the speed as you accelerate/decelerate. So instead of changing the speed of the background/enemies/obstacles each time your vehicle is supossed to move at a diff speed just make your vehicle change the speed. On a small project like the template it doesn't matter but when you add more elements it matters a lot. This way if a car is moving at 200 speed and you are at 100 it's gonna go past you, but if you accelerate to 300 you will get past it, Instead of having your vehicle static and change the other cars angle of movement and speeds..

  • You probably use the bullet behavior for the background so it makes it seem like the character is moving. Instead of doing that, add 8 directional movement on the vehicle the player is driving and just make the viewport scroll to the vehicle. And than add bullet behavior/whatever you need to diff enemies/obstacles so that everything moves on it's own. And you can make the background static and wraping it as you progress.

    But I was so proud of my math!!

    ..until my head exploded.

    Thank you for pointing out something that should have been so obvious.

    Got so wrapped up in what I was doing, I couldn't see it any other way.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Np, I was in the same place.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)