Side scroller with hills, instead of just flat bottom.
croc0000
Member Posts: 11
I'm building a side-scrolling bike game with hills. I can have the actor travel along a level line. What I want is to have gear choices with uphills and downhills. Right now I just want to build the level using line segments that vary in rotation angle. What is the coding so that the actor remains above the line segment. or travels at the same rotation as the line segment? Or am I going about this all wrong?
Comments
With one of my old games Bumps I made curves using several rectangle actors that are hidden (alpha turned to 0) seemed to work well for my game with the curves appearing smooth.
You now have custom collision which might make things easier.
I'm not sure if this still works but it might be helpful.
http://forums.gamesalad.com/discussion/72434/automated-terrain-collisions/p1
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Jamie that was very helpful for building race levels. Thanks a bunch. I'm still too unfamiliar with what I'm actually doing though to know how to get my actor to match the line, I was trying something like a constrain att.
self.Position.Y to currentScene.layer.road.Position.Y
The bike wouldn't jump but that doesn't matter to me right now.
but it wasn't working. I also am thinking the simple: key down move 270 won't work in this case. Mainly I just think I'm punching above my weight class and need to slow down, work on some simpler projects while I keep knocking away at this one.
Thanks so much for being here.
It's a lot more straightforward than you might think, I'd do it like this . . . .
1) Build your environment, you can use 'line segments' (long/thin actors) or even easier would be to make custom collision shape/s.
2) Make sure all the environment elements you want your player to drive across have 'moveable' switched off (so they don't move).
3) For your player/bike/car (etc) . . give it an Accelerate behaviour / 270° (down) relative to 'scene'.
4) Also give your player/bike/car a collide behaviour (collide with environment 'actor')
5) Add in your left / right drive controls/buttons for the player.
6) Done !
You might also want to play around with the bounciness and friction settings for both the environment actor/s and the player, to tune the grip of the tyres to your taste.
I've made you a very quick example project (attached)
Use the left and right arrows on your keyboard to drive the ball left and right.
I made a slight modification to the project to make it more realistic.
I changed it so that the left/right drive only works when the ball is in contact with the floor, new project attached.
Holy Moly, this is super awesome! (that super cheesy) But this is the most helpful forum I've ever seen!
THANK YOU!
Obviously I will want to copy the wheel actor u made and create a second following. What I'm not sure is, what would the coding look like to float the bike so the forks will sit about center of the wheels.
I can't believe I'm saying this, but could I see the coding and try to input it myself, I want to get better figuring it out too. All the help has been great! Though I'm feeling like a moocher.
No coding at all ! Just make a bike with collision shapes that hold onto the wheels.
Thanks, I'll give that a try
Here's a quick demo project (attached) with bike.
(left and right arrows to move)
are you using Using Physics Body Editor or PhysicsEditor?
i cant make physics body editor work
Physics Body Editor.