Allegro help needed.
Posted: Thu Jul 22, 2010 8:38 am
Hi. I am new in Allegro. I know basics of C++. Took a few tutorials of that.
As for allegro, i cannot find any 'advanced' tutorials. Only tutorials for beginners, working on how to detect collision, how draw a picture, insert a sound or an animation.
Is there any websites, which are not so popular on Google, i haven't found, with little advanced tutorials? I am creating my first Allegro game which is Ping Pong. I got the idea, as someone has given an advice to someone else at other forums, to create ping pong as a first game. I currently would like to create a specific speed for a ball and the paddles. Also i am failing a detecting the collision on the paddles. The ball is not reacting to the paddles and just keep bouncing on the screen's walls. I have used this tutorial to make the ball moving by the way:
Any help is greatly appreciated. I would love to learn these things. But please explain what you write, so i can understand everything clearly.
P.S. generally, for the tutorials, i am looking into creating just a few simple basic games, not a Mario like game. To keep things simple and learn efficiently. Later i would like to move to those Mario style games. But that would be after i would work on a few such style games, to get the methods of creating basic and average stuff good.
Thank you, if you will help me learn Allegro.
As for allegro, i cannot find any 'advanced' tutorials. Only tutorials for beginners, working on how to detect collision, how draw a picture, insert a sound or an animation.
Is there any websites, which are not so popular on Google, i haven't found, with little advanced tutorials? I am creating my first Allegro game which is Ping Pong. I got the idea, as someone has given an advice to someone else at other forums, to create ping pong as a first game. I currently would like to create a specific speed for a ball and the paddles. Also i am failing a detecting the collision on the paddles. The ball is not reacting to the paddles and just keep bouncing on the screen's walls. I have used this tutorial to make the ball moving by the way:
Code: Select all
#include
#include
int x = 100;
int y = 100;
int tempX = 100;
int tempY = 100;
int dir = 1; //This will keep track of the circles direction
//1= up and left, 2 = down and left, 3 = up and right, 4 = down and right
BITMAP *buffer; //This will be our temporary bitmap for double buffering
void moveCircle(){
tempX = x;
tempY = y;
if (dir == 1 && x != 20 && y != 20){
--x;
--y;
} else if (dir == 2 && x != 20 && y != 460){
--x;
++y;
} else if (dir == 3 && x != 620 && y != 20){
++x;
--y;
} else if (dir == 4 && x != 620 && y != 460){
++x;
++y;
} else {
dir = rand() % 4 + 1;
}
acquire_screen();
circlefill ( buffer, tempX, tempY, 20, makecol( 0, 0, 0));
circlefill ( buffer, x, y, 20, makecol( 128, 255, 0));
draw_sprite( screen, buffer, 0, 0);
release_screen();
rest(10);
}
int main(){
allegro_init();
install_keyboard();
set_color_depth(16);
set_gfx_mode( GFX_AUTODETECT, 640, 480, 0, 0);
buffer = create_bitmap( 640, 480);
while( !key[KEY_ESC]){
moveCircle();
}
return 0;
}
END_OF_MAIN();
Any help is greatly appreciated. I would love to learn these things. But please explain what you write, so i can understand everything clearly.
P.S. generally, for the tutorials, i am looking into creating just a few simple basic games, not a Mario like game. To keep things simple and learn efficiently. Later i would like to move to those Mario style games. But that would be after i would work on a few such style games, to get the methods of creating basic and average stuff good.
Thank you, if you will help me learn Allegro.