×

Langue

Fermer
Atelier 801
  • Forums
  • Dev Tracker
  • Connexion
    • English Français
      Português do Brasil Español
      Türkçe Polski
      Magyar Română
      العربية Skandinavisk
      Nederlands Deutsch
      Bahasa Indonesia Русский
      中文 Filipino
      Lietuvių kalba 日本語
      Suomi עברית
      Italiano Česky
      Hrvatski Slovensky
      Български Latviešu
      Estonian
  • Langue
  • Tribus
  • /
  • Longcat
Profil Forum Membres
Longcat
    • Tribu

Date de création : 22/09/2013
Communauté : Internationale

Recrutement : Ouvert

  • ¿¡Y VOS QUÉ LEÉS!?
  • ???
  • main.c

¡El rinconcito de mierda que todo usuario desea tener!


http://i.imgur.com/2BiR22Y.gif

Longcat, una de las pocas tribus sin un mierdihilo de presentación.

AGUANTE LA VIOLENCIA SIN SENTIDO



¡Estás buscando algo que...existe pero es viejo!

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <conio.h>
#define w 119
#define a 97
#define d 100
#define s 115
#define ESC 27
#define SPA 32
#define KEY_UP 72
#define KEY_LEFT 75
#define KEY_RIGHT 77
#define KEY_DOWN 80

COORD coord={0,0}; //esto es una variable global

int keypress, x = 0, y = 0, fin = 0, shootx=0, shooty=0, contShoot=0, oneshoot=0, enemigoX = 5, enemigoY = 5;
int personajeVisible = 1, disparoVisible = 0, refresh = 1, enemigoVisible = 1;

int main()
{
while (fin == 0)
{
Dibujar();
Movimiento();
Colisiones();

//Sleep(5);
}
return 0;
}

void gotoxy(int x,int y)
{
coord.X=x;
coord.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}

void Dibujar()
{
if (x <= 0)
x=0;
if (x >= 79)
x=79;
if (y <= 0)
y = 0;
if (y >= 24)
y = 24;

if (personajeVisible == 1)
{
if (refresh == 1)
{
gotoxy(x,y);
printf("@");
refresh=0;
}

}

if (disparoVisible == 1)
{
gotoxy(shootx,shooty);
printf("-");
}

if (enemigoVisible == 1)
{
gotoxy(enemigoX,enemigoY);
printf("O");
}

}

void Movimiento()
{
keypress=0;

if (kbhit())
{
keypress = getch();
}

if (keypress == d || keypress == KEY_RIGHT)
{
system("cls");
x+=1;
refresh=1;
}


if (keypress == a || keypress == KEY_LEFT)
{
system("cls");
x-=1;
refresh=1;
}


if (keypress == s || keypress == KEY_DOWN)
{
system("cls");
y+=1;
refresh=1;
}


if (keypress == w || keypress == KEY_UP)
{
system("cls");
y-=1;
refresh=1;
}

if (keypress == SPA || contShoot == 1)
{
if (oneshoot==0)
{
shootx=x;
shooty=y;
oneshoot=1;
}

shootx++;
refresh=1;
Sleep(5);
system("cls");

if (shootx == 79)
{
contShoot = 0;
disparoVisible = 0;
oneshoot = 0;
}
else
{
contShoot = 1;
disparoVisible = 1;
}

}

if (keypress == ESC)
fin = 1;
}

void Colisiones()
{
if (shootx == enemigoX)
enemigoVisible = 0;
}
  • Tribus
  • /
  • Longcat
Profil Forum Membres
© Atelier801 2018

Equipe Conditions Générales d'Utilisation Politique de Confidentialité Contact

Version 1.27