Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Blit each bullet with her position. It not starts until the user not press space for first time */
- SDL_Rect posicion2;
- for (int i = 0;i < disparos;i++) {
- posicion2.x = posDisparo[i].x;
- posicion2.y = posDisparo[i].y;
- SDL_BlitSurface(disparo, NULL, screen, &posicion2);
- }
- //Looking succes
- while (SDL_PollEvent(&suceso)) {
- if (suceso.type == SDL_QUIT) {
- terminado = 1;
- }
- if (suceso.type == SDL_KEYDOWN) {
- if (suceso.key.keysym.sym == SDLK_ESCAPE) {
- terminado = 1;
- }
- }
- }
- /* Space = add one bullet and the position of it with one array that are controllated for the variable "disparos" */
- if (teclas[SDLK_SPACE]) {
- disparos++;
- posDisparo[disparos].x = xNave + 25;
- posDisparo[disparos].y = yNave + 20;
- }
- //-1 pixel each bullet
- for (int i = 0;i < disparos;i++) {
- posDisparo[i].y -= 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment