I'm quite a newbie to AnEngine and I have a problem. I have been searching a lot, but I couldn't find answer. I'm trying to make my first game, but I have no idea how to make ground. I'd like to make ground like in this game: https://play.google.com/store/apps/details?id=com.fingersoft.hillclimb&hl=cs

That ground should be static and has a lot of curves. Should I make it as one big sprite and attach body to it ? But how to make it curvy then ? I really have no idea.

Tkanks for answers.

  • \$\begingroup\$ I suggest you start by seeing some nape demos. \$\endgroup\$ – wolfdawn Sep 26 '14 at 5:33
  • \$\begingroup\$ What part are you having difficulties with, is it the physics part or the graphics part? If it it the physics path then look into Chain Shapes as a way of representing the Beizer curve Zehelvion talks about in his answer. \$\endgroup\$ – bornander Sep 26 '14 at 6:46

You aren't suppose to create it with one big sprite. That would consume too much memory for one. While we cannot tell you how it was made in that game, the general idea is using Bézier curves. If you connect multiple curves like these, you can get a smooth flowing surface.

You can see an example here on how to create such a smooth surface for your game.

To render this surface, you would have to possibly use a Framework like OpenFL or convert the bezeir enclosed surface into polygons and apply a texture to them. There are possibly other ways to do this, we cannot tell you which way that specific game used.

enter image description here enter image description here

To get the physics working, you would need a physics engine like Box2D or Nape with Haxe & OpenFL. You could roll your own physics engine in theory but it's subjectively highly not recommended because such work would possibly take a lot of time and the results are not likely to be on par with the existing solutions.

  • \$\begingroup\$ Yes, that's exactly what I was looking for. Thank you very much. \$\endgroup\$ – Jake Sep 26 '14 at 14:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.