10.07.2015 Views

[ebook]Programacion de videojuegos con SDL

[ebook]Programacion de videojuegos con SDL

[ebook]Programacion de videojuegos con SDL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

P R O G R A M A C I Ó N D E V I D E O J U E G O S C O N S D L/***************************************************************************Ejemplo6_2(C) 2003 by Alberto Garcia SerranoProgramación <strong>de</strong> vi<strong>de</strong>ojuegos <strong>con</strong> <strong>SDL</strong>***************************************************************************/#inclu<strong>de</strong> #inclu<strong>de</strong> #inclu<strong>de</strong> #inclu<strong>de</strong> "csprite.h"#<strong>de</strong>fine MAXMAP 400<strong>SDL</strong>_Surface *screen;CFrame fnave;CFrame fmalo;CFrame tile1;CFrame tile2;CFrame tile3;CSprite nave(1);CSprite malo(1);CSprite suelo[3];<strong>SDL</strong>_Rect rectangulo;<strong>SDL</strong>_Joystick *joystick;char mapa[401];int joyx, joyy;int done=0;int indice, indice_in;FILE *f;// estructura que <strong>con</strong>tiene la información// <strong>de</strong> nuestro aviónstruct minave {int x,y;} jugador;// Estructura que <strong>con</strong>tiene información// <strong>de</strong>l avión enemigostruct naveenemiga {int x,y;} enemigo;// Dibuja el escenariovoid DrawScene(<strong>SDL</strong>_Surface *screen) {int i,j,x,y,t;// movimiento <strong>de</strong>l scenario (scroll)indice_in+=2;if (indice_in>=64) {indice_in=0;indice-=10;}if (indice

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!