I want make game. I have got board (chart): http://img474.imageshack.us/img474/7083/planst5.png
and pawn (checker):
http://img381.imageshack.us/img381/121/pawnjg7.png
Pawn is on field number 6, player throws bone and pawn has passages about this number of fields on left or right - player choose.
I have got this programm in c++:
1 | |
2 | #include<iostream> |
3 | #include<ctime> |
4 | #include<cstring> |
5 | using namespace std; |
6 | |
7 | int main () |
8 | { |
9 | |
10 | int tab[11]={1,2,3,4,5,6,7,8,9,10,11}; |
11 | int *index=&tab[5]; |
12 | int *start=&tab[0]; |
13 | int *end=&tab[10]; |
14 | |
15 | int eye; |
16 | srand (time(0)); |
17 | int i=0; |
18 | cout<<"You are now on field number 6."<<endl; |
19 | |
20 | while (i!=100) |
21 | { |
22 | eye = 1+rand()%6; |
23 | cout<<"The number of eyes in throw the bone "<<eye<<endl; |
24 | cout<<endl; |
25 | cout<<endl; |
26 | cout<<"Press l if you want go on left or r if you want go on right"<<endl; |
27 | string b; |
28 | cin>>b; |
29 | cout<<endl; |
30 | if (b=="l") |
31 | { |
32 | if ((index-eye)>=start) |
33 | { |
34 | index=index-eye; |
35 | cout<<"You are now on field number "<<*index<<endl; |
36 | } |
37 | else |
38 | { |
39 | index=end-(eye-*index); |
40 | cout<<"You are now on field number "<<*index<<endl; |
41 | } |
42 | |
43 | } |
44 | |
45 | else if (b=="r") |
46 | { |
47 | |
48 | if ((index+eye)<=end) |
49 | { |
50 | index=index+eye; |
51 | cout<<"You are now on field number "<<*index<<endl; |
52 | } |
53 | else |
54 | { |
55 | index=start+(eye-(*end-*index))-1; |
56 | cout<<"You are now on field number "<<*index<<endl; |
57 | } |
58 | } |
59 | i++; |
60 | } |
61 | |
62 | |
63 | system ("pause"); |
64 | return 0; |
65 | |
66 | } |
And I have part of code with library ALLEGRO – but I don’t know what I should do have I can join this two codes ?
1 | #include <allegro.h> |
2 | |
3 | int main() |
4 | { |
5 | BITMAP *plan = NULL; |
6 | BITMAP *pawn = NULL; |
7 | |
8 | allegro_init(); |
9 | install_keyboard(); |
10 | set_color_depth(16); |
11 | set_gfx_mode(GFX_AUTODETECT,1280,1024,0,0); |
12 | set_palette(default_palette); |
13 | clear_to_color(screen,15); |
14 | |
15 | plan = load_bitmap("plan.bmp",default_palette); |
16 | pawn = load_bitmap("pawn.bmp",default_palette); |
17 | |
18 | |
19 | |
20 | blit(plan,screen,0,0,0,0,plan->w,plan->h); |
21 | blit(pawn,screen,0,0,0,0,pawn->w,pawn->h); |
22 | |
23 | |
24 | destroy_bitmap(plan); |
25 | destroy_bitmap(pawn); |
26 | |
27 | readkey(); |
28 | allegro_exit(); |
29 | return 0; |
30 | } |
31 | END_OF_MAIN() |
Uhm... are you serious? Allegro isn't any special concept, just use your old program and use allegro for the drawing routines.
I am noob in library ALLEGRO - could you help me ?
You may have to do something else for cin since you cannot just grab char input without a console. Look into the text routines in allegro to put text on the screen, and the allegro key functions. Should get you started.
[edit]
We won't write it for you if that's what you are asking. Look into the allegro examples folder for code examples.
[/edit]
/facepalm
Move along, folks.
Try learn english
Try learn english
I could say the same to you, troll. For the record, it appears most of these problems have been resolved in another thread.
But I left out the "to" on purpose... hahaha
But I left out the "to" on purpose... hahaha
You missed some punctuation too (in both posts).
Candies for all !
Read my game creation articles..