Jump to content
Fórum Script Brasil
  • 0

Space Invaders - Dúvida na replicação do alien


senppuu

Question

Então galera, estou montando um código do jogo Space Invaders usando a biblioteca <graphics.h>.

Eu fiz o alien mas to com dúvida em como fazer pra replicá-lo e ficar tipo a imagem abaixo, no meu caso eu quero 3 fileiras com o mesmo alien.

spacez.png

E depois colocar eles em um loop pra ficar indo de um lado pro outro.

Código do alien:

#include<graphics.h>

#include<conio.h>

void alien(int x)

{

int i,gd = DETECT, gm;

initgraph(&gd, &gm, "C:\\TC\\BGI");

for (i = 0; i <= 420; i = i + 10){

fillellipse(100 + i + x, 100, 10, 5);

setcolor(0);

circle(96 + i + x, 99, 1);

circle(104 + i + x, 99, 1);

setcolor(15);

line(90 + i + x, 94, 90 + i + x, 98);

line(109 + i + x, 94, 109 + i + x, 98);

line(95 + i + x, 92, 106 + i + x, 107);

line(104 + i + x, 92, 94 + i + x, 107);

delay(500);

cleardevice();

}

getch();

closegraph();

}

int main()

{

alien(1);

return 0;

}

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...