Archive

Posts Tagged ‘2D Graphics’

2D Platform Games Part 7: Player Character Animation

January 28, 2013 4 comments

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. The Redistributable Package can be freely bundled with your own applications.

IMPORTANT! From Part 6 onwards, compatibility with Windows Vista in the pre-compiled EXEs has been dropped. To run the pre-compiled EXEs, you must have Windows 7 Service Pack 1 with Platform Update for Windows 7 installed, or Windows 8.

This article builds upon the demo project created in 2D Platform Games Part 6: Creating Platforms and Geometry the Player can be Inside (Ladders, Ropes and Water). Start with 2D Platform Games Part 1: Collision Detection for Dummies if you just stumbled upon this page at random!

Download source code and compiled EXE for the code in this article.

Figure 1. A sprite sheet of our player. This is a 160x160 sprite containing 4 rows of 20x40 player sprites at 8 columns each. The first row of sprites represents the player walking left, the second row represents the player walking right, sprites 1-3 on the third row represent the player jumping left, sprites 4-6 on the third row represent the player jumping right, and the fourth row represents the player climbing up or down a ladder.

Figure 1. A sprite sheet of our player. This is a 160×160 sprite containing 4 rows of 20×40 player sprites at 8 columns each. The first row of sprites represents the player walking left, the second row represents the player walking right, sprites 1-3 on the third row represent the player jumping left, sprites 4-6 on the third row represent the player jumping right, and the fourth row represents the player climbing up or down a ladder.

After the trauma of player physics, collision detection and surface dynamics it’s probably a good time to take a little breather and tackle a less vexing subject, that of animating your player. We shall look at how to animate the player as they walk left and right along a normal platform or slope, when they jump, and when they climb or descend a ladder. This covers all the types of animation we need so far in our project, and gives a flavour of the maths involved which should make it easy to adapt to new animations as and when you need them.

Read more…

Installing Simple2D and Compiling your first application

May 21, 2012 34 comments

Simple2D is my graphics library for students and beginners looking to experiment with drawing 2D graphics in C++ in the simplest possible way. It is based on the Direct2D API but removes almost all of the complexity. This article contains instructions on installing the software and all of the extras it requires, and shows how to compile your first program using Simple2D.

Read more…

Pages: 1 2 3

%d bloggers like this: