http://games.neikous.com
im working on an rpg
http://games.neikous.com
im working on an rpg
If you're really interested i can pull together some really old stuff from the CoZ archives for you... I wouldn't be able to post it here probably but I could give you bits and pieces of some really old stuff (I can't promise it's good code, this was some of the first stuff that I wrote with CoZ)
I bet you already have better code from the others, but if you're interested email [email protected].
yo cozman, what happened to your site? it never loads it, always says there isnt a web page for it. have you just stopped dealing with it? just wondering, thanks,
ok i think this will work for the map function but im not sure so if some one could check this out and help me it would be a big help
Code:... int board[5][5] = { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,}; char choice; int player[x][y]; char Player = 1; void PlayerMove() { cin<<choice; switch(player[x][y]) case 'UP': x++; break; case 'DOWN': x--; break; case 'LEFT': y--; break; case 'RIGHT': y++; break; system("cls"); Board(); } ... void Board() { playermove(); board[x][y]=player; for(int i = 0; i <= 5; i++) for(int j = 0; j<= 5; j++) cout<<" "; }
would this work?
won't work. in your switch statement there are two problems:
1) there is no point in having the
cin >> choice;
line if you arent going to use it. to use it, you need to have the var 'choice' in the switch() part...so, it should look something like this...
cin >>choice;
switch(choice) {
etc etc etc
}
2) case statements can only handle a single character/number. so instead of having case 'UP', you need something along the lines of case 'U', etc. if this wont work youll have to think of something else, sorry.
i havent dissected everything in the code, those are just the things that i catch off-hand. once you get those fixed and if you can fix anything else just post the new code and we can see if there is anything else.
hope this helped.
later
is this any better??Code:... int board[5][5] = { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,}; char choice; int player[x][y]; char Player = 1; void PlayerMove() { cin<<choice; choice=tolower(getch()); switch(choice) case 'y': x++; break; case 'h': x--; break; case 'j': y--; break; case 'g': y++; break; system("cls"); Board(); } ... void Board() { playermove(); board[x][y]=player; for(int i = 0; i <= 5; i++) for(int j = 0; j<= 5; j++) cout<<" "; }
im more conserned about displaying the map and the player than anything else because switch statements arent that hard to figure out. so does the "void Board();" work or do i still need to change one or two things?
Last edited by c++.prog.newbie; 12-21-2001 at 04:20 PM.
a question for all the intelegente people out there that know how to spell, could you tell mw ehat i did wrong here what i was trying to do is to display a player on the map and be able to move hom around using the U, J, H, K, keys but after i press on of the letters it displays the decimal value(eg, 0x204785(not exactly)) and then just exits the program
Code:#include <iostream.h> #include <stdlib.h> #include <conio.h> #include <ctype.h> char board [5][5] = { 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0,}; char player = 2; int x; int y; int u, h, k, j; char choice; void Board(); void movement(); void Board() { system("cls"); board[x][y]=player; movement(); for(int i = 0; i<5; i++) cout<<"\n"; for(int j = 0; j<5; j++) { cout<<board; } } void movement() { if (keyhit==UP) { x--; } if (keyhit==DOWN) { x++; } if (keyhit==LEFT) { y--; } if (keyhit==RIGHT) { y++; } } void main() { Board(); }
Last edited by c++.prog.newbie; 12-21-2001 at 08:26 PM.
for(int i = 0; i<5; i++)
cout<<"\n";
for(int j = 0; j<5; j++)
{
cout<<board;
}
should be....
for(int i = 0; i<5; i++)
cout<<"\n";
for(int j = 0; j<5; j++)
{
cout<<board[i][j];
}
oh... ok i get it now
but ehat header do i need to use the keyhit and RIGHT, LEFT, UP, DOWN, functions
Last edited by c++.prog.newbie; 12-23-2001 at 02:28 PM.
ok i fixed one of my problems instead of using keyhit im using kbhit() but i still need to know how to use UP DOWN LEFT RIGHT... could some one please help
heres the code i have so far
Last edited by c++.prog.newbie; 12-23-2001 at 09:39 PM.
sorry i forgot the code
well i think the problem is that youre using kbhit the wrong way. im not exactly sure how to use it but i don't believe thats how. maybe im wrong. but i still think that a switch statement would be easier...
void movement()
{
char move;
board[x][y]=board[0][0];
move=toupper(getch());
switch(move) {
case 'U': x--; break;
case 'J': x++; break;
case 'H': y--; break;
case 'K': y++; break;
case '1': Rest(); break;
case '2': Mix(); break;
}
}
try using something like that, why wont that work?
i tried running your program...its got some problems with some of the other code as well. you dont have anything to tell it to keep running after it displays the map once. after the first time its drawn, it quits.
Look no further... I take it none of you have played a 'Rogue-like game'? Or perhaps a MUD?
Quzah.
Hope is the first step on the road to disappointment.
ok i have this code and it works except that it doesnt delete the previous there for it will just leave a trail of rather than just were you are could some one please helpCode:#include <iostream.h> #include <stdlib.h> const char player = 1; char boards[5][5]; int x=0, y=0; char choice; char U, J; void board(); void movement(); void board() { system("cls"); boards[x][y]=player; for(int i=0; i<5;i++) { cout<<"\n"; for(int j=0; j<5; j++) { cout<<boards[i][j]; } } movement(); } void movement(){ cin>>choice; if(choice=='U' || choice=='u') {boards[x--][y];} if(choice=='J' || choice=='j') {boards[x++][y];} if(choice=='h' || choice=='H') {boards[x][y--];} if(choice=='k' || choice=='K') {boards[x][y++];} system("cls"); board(); }
heres the previous file if you wnat to download it