private:\r
struct line_t {\r
double start; // Where land begins, going down (i.e. y)\r
+ unsigned char color;\r
} __attribute__ ((packed)) *line;\r
unsigned int lineCount; // Size of line array, calculated in the constructor\r
unsigned int entCount; // Count of currently bound entities\r
if(e.key.keysym.sym == SDLK_a) player.left = true;
if(e.key.keysym.sym == SDLK_LSHIFT) player.speed = 3;
if(e.key.keysym.sym == SDLK_SPACE){
- player.loc.y += HLINE*1.2;
- player.vel.y += .004;
+ if(player.vel.y<=0){
+ player.loc.y += HLINE*1.2;
+ player.vel.y += .004;
+ }
}
if(e.key.keysym.sym == SDLK_i){
if(currentWorld->behind){
}else{\r
line[i].start=line[i-1].start+f;\r
}\r
+ line[i].color=(grand()%2)*10+130;\r
}\r
}\r
// Set RGB color with potentially not 8-bit values\r
y-=hline*2; // 'optimization'\r
glVertex2f(x+hline,y);\r
glVertex2f(x ,y);\r
- safeSetColor(150+shade,100+shade,50+shade); // Set shaded brown for dirt\r
+ safeSetColor(line[i].color+shade,line[i].color-50+shade,line[i].color-100+shade); // Set shaded brown for dirt\r
glVertex2f(x ,y);\r
glVertex2f(x+hline,y);\r
glVertex2f(x+hline,-1);\r
for(i=0;i<lineCount-10;i++){ // For every line in world\r
if(v->y<line[i].start){ // If we're inside the line\r
if(v->x>(HLINE*i)-1&&v->x<(HLINE*i)-1+HLINE){ // And we're inside it ;)\r
- vel->y=0;v->y=line[i].start+HLINE/4; // Correct\r
+ vel->y=0;v->y=line[i].start+HLINE/8; // Correct\r
return; // :/\r
}else if(v->x+width>(HLINE*i)-1&&v->x+width<(HLINE*i)-1+HLINE){ // Same as above, but coming from right side instead of left\r
- vel->y=0;v->y=line[i].start+HLINE/4;\r
+ vel->y=0;v->y=line[i].start+HLINE/8;\r
return; // ;)\r
}\r
}else if(v->y>line[i].start+HLINE){ // Trashy gravity handling\r