ball.c.g = ball.c.b = 0x50;
ball.c.a = 0xff;
- ball.v.y = speed;
+ ball.v.y = speed/2;
}
static void vbox_render(const Vbox *b)
pads[0].v.x = 0;
pads[1].v.x = 0;
- if(keyStates[SDL_SCANCODE_RIGHT]) { pads[0].v.x += speed; }
- if(keyStates[SDL_SCANCODE_LEFT]) { pads[0].v.x -= speed; }
- if(keyStates[SDL_SCANCODE_D]) { pads[1].v.x += speed; }
- if(keyStates[SDL_SCANCODE_A]) { pads[1].v.x -= speed; }
+ if(keyStates[SDL_SCANCODE_RIGHT]) { pads[0].v.x = speed/2; }
+ if(keyStates[SDL_SCANCODE_LEFT]) { pads[0].v.x = (speed/2) * -1; }
+ if(keyStates[SDL_SCANCODE_D]) { pads[1].v.x = speed/2; }
+ if(keyStates[SDL_SCANCODE_A]) { pads[1].v.x = (speed/2) * -1; }
for(int i = 0; i < 2; ++i){
pads[i].r.x += pads[i].v.x * dt;
}
if(collidingWith == 0) {
- if(keyStates[SDL_SCANCODE_RIGHT]) { ball.v.x += speed; }
- if(keyStates[SDL_SCANCODE_LEFT]) { ball.v.x -= speed; }
+ if(keyStates[SDL_SCANCODE_RIGHT]) { ball.v.x += speed/2; }
+ if(keyStates[SDL_SCANCODE_LEFT]) { ball.v.x -= speed/2; }
} else if (collidingWith == 1) {
- if(keyStates[SDL_SCANCODE_D]) { ball.v.x += speed; }
- if(keyStates[SDL_SCANCODE_A]) { ball.v.x -= speed; }
+ if(keyStates[SDL_SCANCODE_D]) { ball.v.x += speed/2; }
+ if(keyStates[SDL_SCANCODE_A]) { ball.v.x -= speed/2; }
}
// applying velocity if needed