
- #Vertical screen wrap platformers for free#
- #Vertical screen wrap platformers how to#
- #Vertical screen wrap platformers code#
We will not look at player-enemy, player-power-up or other such collisions here (although with the bounding box technique explained below this is fairly trivial to implement), nor will we look at enemy-landscape collisions for situations where the enemies are allowed to move free-form as well rather than being on fixed pre-defined paths.
#Vertical screen wrap platformers code#
The code presented below is not particularly elegant, efficient and may contain a few bugs, but it should be a good start, with the theory and math kept to a minimum.
#Vertical screen wrap platformers how to#
We will look at the various problems that crop up and how to solve them.

Here I would like to present a practical, hands-on approach to 2D collision detection, developing a complete example in C++ from start to finish.
#Vertical screen wrap platformers for free#
The important thing that they have in common is they are either quite theoretical, use a certain degree of non-trivial math to get the job done or do not have complete source code available for free (and the best ones are written in Flash / ActionScript or Java anyway, not C++). There are some brilliant articles on 2D collision detection on the net and I have linked to my favourites at the end of this article. There are many types of 2D platform game, from strictly grid-based to Mario-style platformers where collision detection is simplified by limiting the game world to using certain specific types of platform at certain specific slope angles, all the way to modern games like LittleBigPlanet where the world is completely free-form with arbitrary platform geometry. Now, let’s not beat about the bush: collision detection is a nightmare when done right. For shame, I haven’t had chance to do this yet, but while I’ve been thinking about that I thought it might be nice to look at how collision detection works, as this is surely the trickiest part of coding a 2D platform game. Since the one-day game coding challenges of SimpleTetris and SimpleAsteroids, several people asked me if I could do a timed challenge to make a Mario or Donkey Kong-style platform game.

Try the demo! This article will teach you how to write the following sample project from start to finish: 2D collision detection demo (use the left and right arrow keys to move and the space bar to jump) The Redistributable Package can be freely bundled with your own applications. IMPORTANT! All of the articles in this series require you to have either Visual Studio 2010 or the Visual C++ 2010 Redistributable Package (4.8MB) installed in order to be able to try the pre-compiled EXEs provided with the examples.
