Skip to content

Created in allegro 5 to demonstrate simple 2d mechanics, such as collision detection, gravity, and navigation. All along with the classes created for sprites in the Animation-Demo project.

uffbruno/simple-2d-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

SIMPLE 2D DEMO
--------------

Change History
--------------
01-30-2011 - First version of README.

Author
------
Created by Bruno Oliveira
uffbruno@gmail.com

Dependencies
------------
- Allegro 5: to build the demo, you'll need Allegro 5 (http://alleg.sourceforge.net/). Follow it's instructions to build the static libs (or download the precompiled binary versions), since these are what the demo uses (for distribution purposes). You can look at the makefile, the variable A5LINKLIBS describes all libs used to build Animation Demo.

- This demo was built using MingW for Windows. In the future, i might include a Linux version of the makefile for building on Linux machines, but you are free to modify the makefile if you know what you're doing (it shouldn't be too hard).

How it works
------------
The Simple 2D Demo loads two artifacts from the 'resources' directory. These are:
- resources/mariobros -> a set of sprites for animating our character
- resources/map -> uses map.txt to locate the images composing the map, load and display them on screen.

Each of these directories have a text file named 'anim_info.txt'. This file points to the location of the various image files that will compose the sprite frames. You are free to change this file (see ANIM_INFO.TXT below for the file format).

Simple 2D Demo just loads a little map, and let's you navigate in it with good old 2D fashion.
It's purpose is to demonstrate:
- map loading
- collision detection
- animation of sprites
- gravity

Instructions
------------
You can control the character using the arrow keys on the keyboard. 

Left Key: Move left
Right Key: Move right
Up Key: Jump
Down Key: No use
ESC Key: Quit demo

Anim_info.txt
-------------
The anim_info.txt file format is fairly simple. Let's see an example:

#First animation
/path/to/file/frame1.png
/path/to/file/frame2.png
/path/to/file/frame3.png
.

#second animation
/path/to/file/frame4.png
/path/to/file/frame5.png
.

In the example above, we have two sets of frames. Each set of frames composes an animation. So we have two animations.
The first one uses frame1.png, frame2.png and frame3.png, and the second one uses frame4.png and frame5.png. Note that these names and directory paths are just examples. You can use any name you like, and any number of sets (the example just uses two).

To separate the sets of animations, we use a dot [.] It indicates that set composes an animation, and what comes next is part of the next animation.
If a line starts with '#', it's a comment. If it is an empty line, it's ignored (so you can add that space between frame sets to make the file more readable).

Restrictions
------------
In this version of the Simple 2D Demo, we have one character (Mario). The anim_demo.txt of this character is a reflection of the animations present in it. Mario has animations for walking left and right, jumping, and standing still left and right. If any of the sets of frames in the corresponding anim_info.txt is removed, the program will eventually crash. You can add and remove frames for each frameset, but don't remove the framesets themselves. This will be more flexible in a future version, but for now, deal with it (or download the source code and modify it at will).

Another limitation is that the file with animation information must be called 'anim_info.txt', since that is the file the Animation Demo will look for. This one i do not intent on changing, to set up a standard.

About

Created in allegro 5 to demonstrate simple 2d mechanics, such as collision detection, gravity, and navigation. All along with the classes created for sprites in the Animation-Demo project.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages