Pokemon game

Pages: 12
closed account (NUj6URfi)
Anyone want to help create a pokemon game with me for pc? I would do it alone except I have come across some errors. It is in SDL and is not scrolling so you have to enter a new room for the floor to change but if you know how to make it scrolling that would be great. You may be like what about your previous projects but the difference is this is my number 1 priority and this is the project I will put all my efforts too. The more people the better here.
Can't help without source code :P
closed account (NUj6URfi)
Yes but I am looking for someone who wants to contribute more than just a few lines of code and actually wants to help build the majority of the game. It would be a project.
closed account (NUj6URfi)
So?
Make a project on github or bitbucket and let everyone contribute!
@toad1359
With nothing to show, you won't find too many people willing to help. You stated:

I would do it alone except I have come across some errors. It is in SDL and is not scrolling so you have to enter a new room for the floor to change but if you know how to make it scrolling that would be great.

There are tutorials for SDL (lazyfoo.net). Also, no code or github repository to see you work or alpha release to see what you have, makes this seem sketchy. You are doing a common beginner mistake, asking for help with no scrap of proof that you actually have anything done.
closed account (NUj6URfi)
My code is this and this is all my files:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256

#include <iostream>
#include <string>
#include <windows.h>
#include <fstream>
#include "SDL.h"
using namespace std;

int b, a, roomnum;

int firstroom();
void secondroom();

SDL_Surface *load_image( std::string filename );

bool gamestatus;
bool pokemon1yn = false;
bool pokemon2yn = false;
bool pokemon3yn = false;
bool pokemon4yn = false;
bool pokemon5yn = false;
bool pokemon6yn = false;
int x, y;
    int SCREEN_WIDTH = 10;
    int SCREEN_HEIGHT = 11;
    int PLAYER_WIDTH = 5;
    int PLAYER_HEIGHT = 5;
    int MAPTOTAL_HEIGHT = 11;
    int MAPTOTAL_WIDTH = 10;
    int hfhf = 1;
    
	SDL_Surface* floor = NULL;
	SDL_Surface* player2 = NULL;
    SDL_Surface* screen = NULL;
    
    int room;
    int xwall, ywall;
string PLAYERTOTAL_WIDTH2,PLAYERTOTAL_HEIGHT2, room3;

int PLAYERTOTAL_WIDTH, PLAYERTOTAL_HEIGHT;
    
    
    void apply_surface( int x, int y, SDL_Surface* source, SDL_Surface* destination ){
    SDL_Rect offset;
    offset.x = x;
    offset.y = y;
    SDL_BlitSurface( source, NULL, destination, &offset );
}

int main( int argc, char *argv[] ) {
    cout << "Test";
    hfhf++;
	SDL_Init(SDL_INIT_EVERYTHING);
	
	Uint8 *key;
	Uint8 *player;
    
	gamestatus = true;

	ifstream load("xlocation.txt", ios::ate);
	PLAYERTOTAL_WIDTH2 = "xlocation.txt", ios::ate;
	PLAYERTOTAL_WIDTH = atoi(PLAYERTOTAL_WIDTH2.c_str());
    load.close();

	ifstream file1("ylocation.txt", ios::ate);
	PLAYERTOTAL_HEIGHT2 = "ylocation.txt";
	PLAYERTOTAL_HEIGHT = atoi(PLAYERTOTAL_HEIGHT2.c_str());
	file1.close();

	ifstream roomd("room.txt", ios::ate);
	room3 = "room.txt", ios::ate;
	if (room3 == "room1") {
	firstroom(); }
	if (room3 == "room2") {
	secondroom(); }
    roomd.close();
    
	SDL_WM_SetCaption("Pokemon", "Pokemon");
	screen = SDL_SetVideoMode( 640, 480, 32, SDL_HWSURFACE );
	
	while (gamestatus == true) {
          SDL_WM_SetCaption("Pokemon2", "Pokemon2");
    if (hfhf != 1) {
             SDL_Flip( screen ); }
        PLAYERTOTAL_HEIGHT = PLAYER_HEIGHT;
		PLAYERTOTAL_WIDTH = PLAYER_WIDTH;



	
    SDL_WM_SetCaption("Pokemon6", "Pokemon6");
        player2 = load_image( "player.bmp" );
        SDL_WM_SetCaption("Pokemon7", "Pokemon7");
        
    apply_surface(PLAYERTOTAL_WIDTH, PLAYERTOTAL_HEIGHT, player2, screen );
        SDL_WM_SetCaption("Pokemon8", "Pokemon8");
        SDL_Delay( 2500 );
    
	key = SDL_GetKeyState( FALSE );
	
    if (key[SDLK_UP]) {
	    y++; 
	     if (roomnum == 1) {
         if (y == 11) {
        if (x == 5 or 6) {
    secondroom(); }
    else if (y == 11) {
         if (x != 5 or 6) {
   y--; } }
   else if (y == 1) {
        y--;}
        else if (x == 1 or x == 10) {
             y--; }}
}}
	else if (key[SDLK_DOWN]) {
	    y--; 
        if (roomnum == 1) {
         if (y == 11) {
        if (x == 5 or 6) {
    secondroom(); }
    else if (y == 11) {
         if (x != 5 or 6) {
   y++; } }
   else if (y == 1) {
        y++;}
        else if (x == 1 or x == 10) {
             y++; }}
}}
	else if (key[SDLK_LEFT]) {
	    x--; 
        if (roomnum == 1) {
         if (y == 11) {
        if (x == 5 or 6) {
    secondroom(); }
    else if (y == 11) {
         if (x != 5 or 6) {
   x++; } }
   else if (y == 1) {
        x++;}
        else if (x == 1 or x == 10) {
             x++; }}
}}
	else if (key[SDLK_RIGHT]) {
	    x++; 
        if (roomnum == 1) {
         if (y == 11) {
        if (x == 5 or 6) {
    secondroom(); }
    else if (y == 11) {
         if (x != 5 or 6) {
   x--; } }
   else if (y == 1) {
        x--;}
        else if (x == 1 or x == 10) {
             x--; }}
}}
	else if (key[SDLK_z]) {
	}
	else if (key[SDLK_x]) {
		
	}
	else if (key[SDLK_LSHIFT]) {
		
	}
	
	else if (key[SDLK_s]) {
		ofstream file2( "ylocation.txt", ios::trunc | ios::out );
		ofstream file3( "xlocation.txt", ios::trunc | ios::out );
		ofstream file10( "room.txt", ios::trunc | ios::out );
        x = MAPTOTAL_WIDTH - PLAYERTOTAL_WIDTH;
        y = MAPTOTAL_HEIGHT - PLAYERTOTAL_HEIGHT;
        file3 << x;
        file2 << y;
        file10 << room;
		file2.close();
		file3.close();
		file10.close();
		
		if(pokemon1yn != FALSE){
		ofstream file4( "pokemon1.txt", ios::trunc | ios::out);
		
		file4.close();
	}
		if(pokemon2yn != FALSE) {
		ofstream file5( "pokemon2.txt", ios::trunc | ios::out);
		
		file5.close();
	}
		if(pokemon3yn != FALSE) {
		ofstream file6( "pokemon3.txt", ios::trunc | ios::out);
		
		file6.close();
	}
		if(pokemon4yn != FALSE) {
		ofstream file7( "pokemon4.txt", ios::trunc | ios::out);
		
		file7.close();
	}
		if(pokemon5yn != FALSE) {
		ofstream file8( "pokemon5.txt", ios::trunc | ios::out);
		
		file8.close();
	}
		if(pokemon6yn != FALSE) {
		ofstream file9("pokemon6.txt", ios::trunc | ios::out);
		
		file9.close();
	}
	
		gamestatus = false;
		
	}

		if (room3 == "room1") {
        if (x == 11) {
              if (y == 5 or y == 6) {
                    secondroom();
                    x = 0;
                    }}}
	
}

SDL_FreeSurface( player2 );
    SDL_FreeSurface( floor );
    SDL_Quit();
	system("PAUSE");
	return 0;
}

int firstroom() {
     SDL_WM_SetCaption("Pokemon3", "Pokemon3");
     roomnum = 1;
     floor = load_image( "walkablefloor.bmp" );
    apply_surface( 250, 275, floor, screen );
     SDL_Flip( screen );
     SDL_Delay( 2500 );
     SDL_WM_SetCaption("Pokemon4", "Pokemon4");
     return 0; } 


void secondroom(){
roomnum = 2;
return;  }

SDL_Surface *load_image( std::string filename ){
    SDL_Surface* loadedImage = NULL;
    SDL_Surface* optimizedImage = NULL;
    loadedImage = SDL_LoadBMP( filename.c_str() );
    if( loadedImage != NULL ){
        optimizedImage = SDL_DisplayFormat( loadedImage );
        SDL_FreeSurface( loadedImage );
    }
    return optimizedImage;
}



xlocation.txt:
 
5


ylocation.txt:
 
5


room.txt:
 
room1


player.bmp is 1 blue pixel and walkablefloor.bmp is 11 high red pixels with a 10 red pixel length forming a rectangle.
closed account (NUj6URfi)
https://github.com/toad1359/Pc-Pokemon/
After looking at code, I think, Herb Sutter died in me.
I think I actually sent you a pm about this, though it was about a different but similar code. I see some issues in your program that I addressed in that pm.
closed account (NUj6URfi)
That was about tbsg not this I thought. I am sorry. Do you want in on this? If so please create a github account and use a pull request.
You can add collaborators on GitHub by going to Settings and then to Collaborators. No need to have pull requests. I would join, but I've got time devoted to at least two other projects not including the TBSG one.

And in the pm I sent you, I linked you to a couple of my projects on GitHub, which also shows my username.
Last edited on
closed account (o1vk4iN6)
Why are you using "or" instead of "||" ? Is that a macro ...
closed account (NUj6URfi)
Thanks for pointing that out. Updated code accordingly.
I don't even know where to start.

Edit: Actually yes I do, what errors are you getting?
Last edited on
closed account (NUj6URfi)
No errors. The program freezes upon runtime and I have to use dev-c++'s program reset to stop the program from crashing my computer.
and, or, etc. are macros keywords to mean their operator counterparts. There should be no difference.

Edit:
http://en.cppreference.com/w/cpp/language/operator_alternative
Last edited on
I've been programming in C/C++ for at least six years, how in the hell have I NEVER known that this was in the standard?
@Cheraphy
It's okay, I've been doing it for 17 years and never knew that. Not many books or colleges mention them and defer to ! || && += != etc.
closed account (N36fSL3A)
.... I have you code long ago that I had, but you refused to use them. I already did something like this...

Also, why are you still using multidimensional arrays?
Pages: 12