fernas Posted September 24, 2009 at 11:32 PM Report Share #288565 Posted September 24, 2009 at 11:32 PM Preciso de fazer um campo de futebol com 2 jogadores e uma bola. O problema é que não consigo fazer as áreas e as balizas.. #include <graphics.h> int main() { initwindow(800,600); //open a 400x300 graphics window setbkcolor(GREEN); int poly[8]; poly[0] = 20; poly[1] = 100; poly[2] = 800 - 20; poly[3] = 100; poly[4] = 800-20; poly[5] = 500-20; poly[6] = 20; poly[7] = 500-20; setfillstyle(1, GREEN); fillpoly(4, poly); moveto(400,100); lineto(400, 480); circle(400, 300, 50); setfillstyle(1, BLUE); fillellipse(200, 150, 10, 10); //jogador de cima fillellipse(200, 400, 10, 10); //jogador de baixo setfillstyle(1, WHITE); //cor da bola fillellipse(200, 160, 3, 3); //bola while(!kbhit()); //wait for user to press a key closegraph(); //close graphics window return 0; } Aqui está o que já fiz: P.S: O compilador que estou a usar é o Dev-C++ Link to comment Share on other sites More sharing options...
bruno1234 Posted September 25, 2009 at 06:56 PM Report Share #288668 Posted September 25, 2009 at 06:56 PM Mais uns polys para aí, como fizes-te o campo. Matraquilhos para Android. Gratuito na Play Store. https://play.google.com/store/apps/details?id=pt.bca.matraquilhos Link to comment Share on other sites More sharing options...
Metaluim Posted September 26, 2009 at 07:19 PM Report Share #288795 Posted September 26, 2009 at 07:19 PM não seria mais fácil usares uma livraria que te permitisse carregar uma imagem para o ecrã? de qualquer das maneiras, se já fizestes um meio campo, qual a dificuldade de fazeres 2 rectângulos? Link to comment Share on other sites More sharing options...
bruno1234 Posted September 26, 2009 at 07:22 PM Report Share #288797 Posted September 26, 2009 at 07:22 PM A ideia da imagem é boa. Fica com um design mto mais agradável. Depois é só fixares as coordenadas das linhas. Matraquilhos para Android. Gratuito na Play Store. https://play.google.com/store/apps/details?id=pt.bca.matraquilhos Link to comment Share on other sites More sharing options...
fernas Posted September 27, 2009 at 03:27 PM Author Report Share #288896 Posted September 27, 2009 at 03:27 PM Sou mesmo distraído, postei isto na área de C, o programa tá em C++ lol Update: #include <graphics.h> int main() { int poly[8], det, mod; detectgraph(&det, &mod); // Obtém o driver gráfico e o modo de acordo com o hardware initgraph(&det, &mod, ""); // inicializa modo gráfico de acordo com os parâmetros obtidos initwindow(800,600); //open a 400x300 graphics window setbkcolor(GREEN); poly[0] = 20; poly[1] = 100; poly[2] = 800 - 20; poly[3] = 100; poly[4] = 800-20; poly[5] = 500-20; poly[6] = 20; poly[7] = 500-20; setfillstyle(1, GREEN); fillpoly(4, poly); moveto(400,100); //posiciona cursor na posição lineto(400, 480); //desenha uma linha circle(400, 300, 50); rectangle(20, 150, 160, 430); rectangle(20, 220, 80, 360); rectangle(5, 260, 20, 320); rectangle(630, 150, 800-20, 430); rectangle(800-20, 220, 720, 360); rectangle(800-20, 260, 800-5, 320); //-------------// setfillstyle(1, BLUE); //cor jogadores porto fillellipse(150, 150, 10, 10); //defesa esquerdo porto fillellipse(150, 250, 10, 10); //defesa centro porto fillellipse(150, 350, 10, 10); //defesa centro2 porto fillellipse(150, 450, 10, 10); //defesa direito porto fillellipse(250, 150, 10, 10); //médio esquerdo porto fillellipse(250, 250, 10, 10); //médio centro porto fillellipse(250, 350, 10, 10); //médio centro2 porto fillellipse(250, 450, 10, 10); //médio direito porto fillellipse(350, 250, 10, 10); //Avançado porto fillellipse(350, 350, 10, 10); //Avançado2 porto //---------------// setfillstyle(1, BLACK); //cor guarda-redes porto fillellipse(50, 295, 10, 10); //guarda-redes porto //--------------// setfillstyle(1, RED); //cor jogadores benfica fillellipse(450, 300, 10, 10); //Avançado benfica fillellipse(550, 150, 10, 10); //médio direito benfica fillellipse(550, 300, 10, 10); //médio centro benfica fillellipse(550, 450, 10, 10); //médio esquerdo benfica fillellipse(620, 350, 10, 10); //médio defensivo benfica fillellipse(620, 250, 10, 10); //médio defensivo2 benfica fillellipse(690, 150, 10, 10); //defesa direito benfica fillellipse(710, 250, 10, 10); //defesa centro benfica fillellipse(710, 350, 10, 10); //defesa centro2 benfica fillellipse(690, 450, 10, 10); //defesa esquero benfica //-----------// setfillstyle(1, YELLOW); //cor guarda-redes benfica fillellipse(750, 295, 10, 10); //guarda-redes benfica //----------// setfillstyle(1, WHITE); //cor da bola fillellipse(400, 300, 5, 5); //bola //--------// while(!kbhit()); //wait for user to press a key closegraph(); //close graphics window return 0; } P.S: Decidi meter mais jogadores.. 😉 Link to comment Share on other sites More sharing options...
bruno1234 Posted September 27, 2009 at 03:30 PM Report Share #288897 Posted September 27, 2009 at 03:30 PM Só por curiosidade, isso q estás a fazer é um jogo? Matraquilhos para Android. Gratuito na Play Store. https://play.google.com/store/apps/details?id=pt.bca.matraquilhos Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now