Home > Electronic Games, Projects > 2D Sprite Animation & Movement Engine For ‘The Crime Tracer’.

2D Sprite Animation & Movement Engine For ‘The Crime Tracer’.

October 17, 2011 Leave a comment Go to comments

The project ‘tct‘ (The Crime Tracer) made me wish to create an engine for moving various sprites in two-dimensional games. This engine is a prototype and is continuously optimized. It has also been developed with the help of Pygame and Python. Additionally, you can find a rough example that uses the engine of the project ‘tct‘ (The Crime Tracer).

The engine can be used to generate static sprites (without movement) as well as dynamic sprites (with movement). The movement of sprites in any case is Time-Based and can either be erect-angled, either to the eight directions of the compass, or a specific angle for best accuracy. Moreover, there are sprites in the engine that can move at random oscillation with as much sensitivity we desire.

All sprites have coordinates in space, belong to a level (layer) and have a specific opacity (alpha). However, only the dynamic sprites that can move have constant speed and direction. In any case, the motion is carried with the help of vectors and trigonometry as we well know from mathematics.

It is worth mentioning, that even sprites that can be dynamically directed to a particular destination have been implemented in this engine. Moreover, there are limiters in the engine that can be used together with dynamic sprites and can be set to run-time depending on the circumstance.

For the best performance of the engine, there is an internal resource manager used which maintains an internal cache for resources. So, for example, if an image is requested from the disk, it is loaded and then stored in cache memory so as to retrieve faster if wanted again.

Also, the engine supports and sprites that are animations. To these, we can also define a linear sprite sheet, the dimensions and frames per second (fps) to play as well as the position in space, the level and opacity.

Finally, it should be mentioned that the engine does not meet all the requirements of the design document of the project ‘tct‘ (The Crime Tracer) and that we are going to cover the other requirements in time when more emphasis will be put on the graphical part of the game (at this time we are working mainly on the part of architecture). However, the first version of the engine is ready and tested.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: