Page 3 of 5

Re: [GAME] Duck Hunt Remake [NES]

Posted: Mon Mar 12, 2012 8:11 pm
by shao
Puedes ponerle un scroll, que no rebote en la pantalla el pato, tambien puedes meterle otros cazadores que te roben el pato si tardas mucho en acertar (aunque ya necesitarias sprite), tambien se podria poner un lago que el perro no cruza si no le lanzas un hueso al otro extremo, se podrian añadir muchas cosas.

Re: [GAME] Duck Hunt Remake [NES]

Posted: Mon Mar 12, 2012 11:00 pm
by erkosone
@NightWolf: El Wiimote funciona en cualquier PC con los diferentes drivers que hay.. ni se instalan ni nada, ejecutas el programa que te manipula el mouse y lee desde el wiimote..

De entre los mejores softwares que existen para esto están:

GlovePIE, se puede configurar para cualquier caso por raro que sea lo que quieras hacer..
WiiMouse, tiene varios modos de funcionar, de entre los cuales está el modo mouse.
WiiRemote, uno de los primeros que apareció, muestra el estado de los acelerometros y se deja configurar como un mouse.

Yo me quedo con el GlovePIE.

Re: [GAME] Duck Hunt Remake [NES]

Posted: Tue Mar 13, 2012 1:03 am
by SimulatorOne
:D bieeeenn!! otro juego que puedo utilizar mi Wiimoteee

Gracias erkos, gran aporte por el ejemplo practico juego de pipas con el mando de la wii.

En mi juego de Rosie tiene tambien opcional jugar con el wiimote, y el globepie preconfigurado

Re: [GAME] Duck Hunt Remake [NES]

Posted: Tue Mar 13, 2012 1:10 am
by SimulatorOne
Nightwolf wrote:¿pero como usar la pistola de la wii que funcione bien en gemix?
ademas de uno de los programas que dice Erkos...

antes debes linkear/relacionar tu mando Wiimote a traves de Bluethood, con un soft de blouethood para windows.
como el BlueSolei ese...
es el mas seguro y estable.

despues de relacionarlo, ejecuta el GlobePie + el Scrip que hace acctivar el mando de la Wii.
Depues ya puedes ejecutar el juego de gemix.

Re: [GAME] Duck Hunt Remake [NES]

Posted: Tue Mar 13, 2012 9:46 am
by BigHead
erkosone wrote:@BigHead: Ya que conoces bien el juego, he pensado el programar el modo B y para el C... quiero hacer algo mas actual, cualquier tipo de sugerencia para el tipo de juego C será bien recibida.
Si se te ocurre algo no dudes en postearlo, estoy pensando en montar un modo C totalmente nuevo.

Por cierto.. anoche me pegué 3 horas seguidas con la pistola de wii matando patos XD.. que vicio tiene el juego jeje..
para el modo B

Se me ocurre un modo de dos player simultáneo, en el que aparezcan los patos por color (azul y rojo) segun si eres el player uno o dos, es una competición (cuando tengamos módulo de red partidas online ;) también) la barra de patos de abajo llena y segun pierdes pato vas perdiendo patos abajo(en el panel), si el rojo mata al azul o biceversa pierde dos, se trata de ver quien aguanta más.

Para el modo C: cuatro posibles opciones se me ocurren;

Opción A: Pues un poco loco lo que se me ocurre de buenas a primera, que al disparar lances uno de los discos para cargarte el pato, esto tendria el retardo desde la salida del disco hasta llegar al pato, por lo cual tendrías que calcular ese timing.También se le podria añadir viento para complicarlo más.

Opcion B: Bandadas de patos pasando a distintas profundidades (en forma de V como vuelan cuando emigran o sueltos o ambos) y poco a poco más velocidad y alguna nuve por medio donde desaparecen por un instante o cosas así, pierdes cuando se escapan tantos como patos blancos tienes en el panel.Estos van mas rápido en función del nivel de dificultad.

Opción C: añadir conejos u otros animales

Opcion D: mapa scroll lateral relativamente largo, salen de un lado uno o dos, tres o más patos en función del nivel de dificultad, que van ocultandose detrás de arbustos u otras cosas donde no puedes dispararles, ellos tratan de llegar al otro lado y tu no puedes dejar escapar ni uno (Esta es la opción que más me gusta quizá)

Eso se me ocurre así derrepente, basámdme en que no tengás que tirar de muchos graficos que no tenga ya el juego (sólo conejos o nuves),no sé si quieres un modo que no sea de caza exclusivamente? espero que alguna idea te valga, sobre todo la del dos player online eso podria ser la bomba, haríamos un torneillo con todos los del foro jeje

EDITO: MODO LOCO: mata al perro que corre y se oculta rápidamente, o lanzarle discos, que los coja o que te lo tengas que tumbar a discos! :P

Saludetes y animo con esos modos B y C !

Re: [GAME] Duck Hunt Remake [NES]

Posted: Tue Mar 13, 2012 10:11 am
by erkosone
Me ha gustado la idea del modo online, voy a estudiarlo. :)

Re: [GAME] Duck Hunt Remake [NES]

Posted: Tue Mar 13, 2012 1:39 pm
by OskarG
Hola erkos,me ha gustado el remake,mas queria pedirte no el codigo fuente,no pretendo tal cosa,mas como se que te agrada hacer tutoriales y me resultan muy utiles ,a mi y creo que a bastantes mas les seria interesante un tutorial de las funciones draw que incluye gemix,ya que por ejemplo me gustaria saber como evitar miles de procesos con esta funcion.

Re: [GAME] Duck Hunt Remake [NES]

Posted: Tue Mar 13, 2012 2:36 pm
by erkosone
Hola Oscar, pues somentarte que este juego utiliza 2 procesos, 1 que controla el flujo del juego y otro que son los patos.. por no liar en exceso el código lo he hecho así.. pero vaya.. que creo que ha quedado como uno de mis mejores códigos, a un buen nivel.

Pues por mi deacuerdo, montaré algún tutorial sobre esto por que es algo importante, rompe con las limitaciones que tienen todos los demás div_like en cuanto a procesos..

Pero el principal tema que hay que plantearse es el de programar por máquinas de estados como se suele hacer en otros lenguajes, mira este es el proceso de un pato.. verás que poco o nada se parece a un proceso DIV , y esta técnica de maquina de estados cuando le cojes el punto y la dominas te permite hacer con 1 solo proceso cosas muy muy grandes. :)

El source del proceso de un pato:
[Codebox=gemix file=Untitled.gemix]process Duck(num_duck_);
private
int counter_ = 0;
int seconds_ = 0;
int estado = 0;
int delay_flags_ = 0;
int delay_fly_sound = 0;
int delay_cuak_sound = 0;
int fly_away_state = 0;
int delay_dog_risa_ = 0;
int anima = 0;
int anima_away[8] = 7,7,7,8,8,8,9,9,9;
int anima_low_angle[11] = 1,1,1,2,2,2,3,3,3,2,2,2;
int anima_high_angle[11] = 4,4,4,5,5,5,6,6,6,5,5,5;
int this_score = 0;
int x_this_score;
int y_this_score;

int angle_ = 0;
begin
resolution = 100;
ducks[num_duck_].active_ = 1; // activate this duck in panel..
file = rand(1,3); // randomize duck color..
switch (file)
case 1:
file = f_blue_duck;
end
case 2:
file = f_green_duck;
end
case 3:
file = f_red_duck;
end
end
graph = 1;
x = rand(2000,30000);
y = 17100;
z = 512;
angle_ = rand(40000,140000); // initial angle at start..
loop
//-----------------------------initial state-----------------------------------------
if(estado == 0) // Initial state el this duck..
counter_ = ( counter_ + 1 ) % 30; // counter of 30 frames = 1 second..
if(counter_ == 29) // if 1 second passed..
seconds_++; // increase seconds counter..
if(seconds_ == 5) // if 5 seconds are passed..
estado = -1; // change state..
end
if(seconds_ == 4)
fly_away_state = 1;
put_screen(f_main, 26);
end
end
if(collision(id_mouse))
if(shot_event == true) // if collision with shot..
estado = 1; // change state..
end
end

delay_fly_sound = ( delay_fly_sound + 1 ) % 4;
if(delay_fly_sound == 1)
play_sound(sfx_19);
end

delay_cuak_sound = ( delay_cuak_sound + 1 ) % 25;
if(delay_cuak_sound == 1)
play_sound(sfx_10);
end

// Code for move This Duck..
if( (angle_ < 90000) && (angle_ > -90000) )
flags = 0;
end
if( (angle_ > 90000) && (angle_ < 280000) )
flags = 1;
end

if( (angle_ > 280000) && (angle_ < 360000) )
flags = 0;
end


if(y < 0)
y = 0;
angle_ = rand(220000, 320000);
end
if(y > 17000)
y = 17000;
angle_ = rand(40000,140000);
end
if(x < 0)
x = 0;
angle_ = rand(50000,-50000);
flags = 0;
end
if(x > 32000)
x = 32000;
angle_ = rand(130000,240000);
flags = 1;
end

XADVANCE(angle_, (round * 10) + 300);

anima = ( anima + 1) % 11;
graph = anima_low_angle[anima];

switch (angle_)
case 45000..135000:
graph = anima_high_angle[anima];
end

case 225000..325000:
graph = anima_high_angle[anima];
end
end

end
//-----------------------------------------------------------------------------------


//--------------------------duck scape from player-----------------------------------
if(fly_away_state == 1) // if duck scape..
draw_text( fnt_white, "FLY AWAY", 4, 160, 45, 255 );
draw_graphic( f_main, 27, 160, 45, 256, 0,0, 100, 100 );
end

if(estado == -1)
ducks[num_duck_].active_ = 0; // deactivate this duck in panel..
ducks[num_duck_].escape_ = 1; // duck scaped..
estado = -2;
end

if(estado == -2)
anima = ( anima + 1 ) % 8;
graph = anima_away[anima];
if(y > -2000)
y-=300;
else
fly_away_state = 0;
estado = -3;
end
end

if(estado == -3)
put_screen(f_main, 4);
x = 16000;
y = 17000;
file = f_main;
graph = 18;
estado = -4;
play_sound(sfx_22);
end

if(estado == -4)
delay_dog_risa_ = ( delay_dog_risa_ + 1 ) % 6;
if(delay_dog_risa_ < 3)
graph = 18;
else
graph = 19;
end
if(y > 14500)
y-=100;
else
estado = -5;
end
end

if(estado == -5)
frame(1000);
estado = -6;
end

if(estado == -6)
delay_dog_risa_ = ( delay_dog_risa_ + 1 ) % 6;
if(delay_dog_risa_ < 3)
graph = 18;
else
graph = 19;
end
if(y < 18000)
y+=100;
else
estado = -7;
end
end

if(estado == -7)
put_screen(f_main, 4);
break;
end
//-----------------------------------------------------------------------------------


//----------------------------player kill duck---------------------------------------
if(estado == 1) // if player kill this duck..
fly_away_state = 0;
ducks[num_duck_].active_ = 0;
ducks[num_duck_].dead_ = 1;
switch (seconds_)
case 0:
this_score = 1500;
end
case 1:
this_score = 1000;
end
case 2:
this_score = 800;
end
case 3:
this_score = 600;
end
case 4:
this_score = 400;
end
end
score += this_score;
estado = 2;
end

if(estado == 2) // wait a moment in shock..
graph = 10;
frame(2000);
graph = 11;
play_sound(sfx_20);
x_this_score = x;
y_this_score = y;
estado = 3;
end

if(estado == 3) // downs with flags animation..
delay_flags_ = ( delay_flags_ + 1 ) % 3;
if(delay_flags_ == 1)
flags = flags xor 1;
end
if(y < 17000)
draw_text( 0, itoa(this_score), 4, x_this_score/resolution, y_this_score/resolution, 0 );
y += 300;
else
stop_sound(all_sound);
play_sound(sfx_18);
frame(2000);
estado = 4;
end
end

if(estado == 4) // change graphic to dog with duck in hand..
file = f_main;
graph = 20;
if(x > 23000) // correction for z preference..
x = 23000;
end
if(x < 9000) // correction for z preference..
x = 9000;
end
estado = 5;
end

if(estado == 5) // dog ups for sowh duck..
if(y > 14000)
y-=200;
else
play_sound(sfx_4);
frame(1500);
estado = 6;
end
end

if(estado == 6) // dog downs..
if( y < 18000 )
y += 200;
else
break;
end
end
//-----------------------------------------------------------------------------------



// Exception for no enought shots left..
if(shots_left == 0) // if no shots left..
if(estado == 0) // if duck are in normal state "flying"..
put_screen(f_main,26);
fly_away_state = 1; // now this duck scape..
estado = -1; // now this duck scape..
end
end

frame;
end
end[/Codebox]



Como puedes ver.. en 1 único bucle se encuentra todo el código del proceso, y esta técnica es la que hay que aprender antes de usar al 100% draw graphic.. cuando la dominas puedes hacer cosas como este otro proceso, esto es el proceso de la pantalla de inicio del juego, todo a base de draw_text y draw_graphic :)
[Codebox=gemix file=Untitled.gemix]process Inicio();
private
int music_timer = 0; // delay for play sound..
int pos_ = 1; // cursor starts on position 1..
int pos_1_ = 133; // set position 1..
int pos_2_ = 150; // set position 2..
int pos_3_ = 165; // set position 3..
int y_pos_ = 0; // value of Y cord position on screen for draw the cursor..
int estado = 0; // for control of diferent state process..
int flash_counter_ = 0;
begin

if(file_exists(getwpath()+"DATA.dat")) // SI EL ARCHIVO EXISTE LO CARGO..
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
FILE_=FOPEN(getwpath()+"DATA.dat","r"); // CARGO EN MEMORIA EL FILE DEL ESTADO DEL JUEGO..
fread(offset score, sizeof(score), FILE_);
fclose(FILE_);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
ELSE // SI EL ARCHIVO NO EXISTE LO CREO VACIO..
score=0;
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
FILE_=FOPEN(getwpath()+"DATA.dat","w"); // GUARDO EL FILE Preparado..
fwrite(offset score, sizeof(score), FILE_);
fclose(FILE_);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
end


ducks[0].panel_x_ = 128;
ducks[1].panel_x_ = 137;
ducks[2].panel_x_ = 146;
ducks[3].panel_x_ = 155;
ducks[4].panel_x_ = 164;
ducks[5].panel_x_ = 173;
ducks[6].panel_x_ = 182;
ducks[7].panel_x_ = 191;
ducks[8].panel_x_ = 200;
ducks[9].panel_x_ = 209;

ducks[0].panel_y_ = 217;
ducks[1].panel_y_ = 217;
ducks[2].panel_y_ = 217;
ducks[3].panel_y_ = 217;
ducks[4].panel_y_ = 217;
ducks[5].panel_y_ = 217;
ducks[6].panel_y_ = 217;
ducks[7].panel_y_ = 217;
ducks[8].panel_y_ = 217;
ducks[9].panel_y_ = 217;

let_me_alone();
clear_screen();
frame;

put_screen(f_main, 1);
y_pos_ = pos_1_;


loop

flash_counter_ = ( flash_counter_ + 1 ) % 20;
if(flash_counter_ > 10)
draw_text(fnt_white, "Remaked by: Luis Lopez Martinez on 48 hours", 4, 160, 10, z);
end


music_timer = ( music_timer + 1 ) % 600; // counter from 1 to 600 = 30 frames per second = 30 second delay..
if(music_timer == 1) // after 30 seconds..
play_sound(sfx_2); // play sound..
end

if(estado == 0) // initial state process..
if(key(_up)) // if key up pushed..
if(pos_ > 1) // if cursor pos > 1
pos_--; // cursor pos decrease 1 position..
estado = 1; // change proces state to 1..
end
end

if(key(_down)) // if key down pushed..
if(pos_ < 3) // if cursor pos < 3..
pos_++; // cursor pos increases 1 position..
estado = 1; // change proces state to 1..
end
end

if(key(_enter)) // if key enter pushed..
switch (pos_) // select cursor pos with variable pos_ value..
case 1: GAME_A();end // select 1 duck game mode..
case 2: exit("Only A mode implemented. Powered by GemixStudio.",0);end // select 2 duck game mode..
case 3: exit("Only A mode implemented. Powered by GemixStudio.",0);end // select 3 clay shooting game mode..
end
break; // break this treath..
end

end

if(estado == 1) // state 1.. when up or down key are pushed..
switch (pos_) // select cursor pos with variable pos_ value..
case 1: y_pos_ = pos_1_; end // select position 1..
case 2: y_pos_ = pos_2_; end // select position 2..
case 3: y_pos_ = pos_3_; end // select position 3..
end
estado = 2; // change proces state to 2..
end

if(estado == 2) // when decide the position of cursor...
if(scan_code == 0) // when no key pushed..
estado = 0; // restart proces state machine..
end
end



draw_text(fnt_orange, "GAME A 1 DUCK", 3, 89, 135, z);
draw_text(fnt_orange, "GAME B 2 DUCK", 3, 89, 151, z);
draw_text(fnt_orange, "GAME C CLAY SHOOTING", 3, 89, 167, z);
draw_text(fnt_green, "TOP SCORE = " + itoa(score), 3, 80, 190, z);
draw_graphic( f_main, 2, 76, y_pos_, 512, 0 ); // draws cursor graphic..
frame;
end
end[/Codebox]




Y uniendo las dos técnicas obtienes un código como este, que es el control del juego desde un solo proceso, el tipo de código no es apto para alguien con poca experiencia.. es creo una de las mejores técnicas para programar con pocos recursos.. pero requiere de bastante experiencia y un conocimiento muy preciso de lo que se está haciendo :D

[Codebox=gemix file=Untitled.gemix]process GAME_A();
private
int intro_ = true; // if true.. intro plays..
int estado = 0; // for control states..
int fade_delay = 0; // delay for shot fade..
int game_state = 0; // intro state machine..
int anima_; // for dog animation..
int anima_walk[14] = 12,12,12,12,12,11,11,11,11,11,10,10,10,10,10; // dog walk animation..
int anima_snif[11] = 13,13,13,13,13,13,14,14,14,14,14,14; // dog snif animation..
int x_dog, y_dog; // the position of dog..
int delay_x_dog = 0; // the position of dog..
int counter_ = 0; // counter for intro control steeps..
int flash_counter_ = 0; // for flashing ducks in panel..
int i; // for duck draw active/killed bucle..
int ID_Duck;
int Counter_ducks = 0;
int Round_State = 0;
int Delay_new_duck_ = 0;
int total_kills = 0;
int delay_dog_risa_ = 0;
int counter_game_over_ = 0;
int id_wait_for_reallocate_ducks;
begin
fade(0,0,0,64);
stop_sound(all_sound);
frame(300);
Raton();
score = 0;
shots_left = 3;
shot_posible = 0;
clear_screen();
put_screen(f_main, 4);
fade(100,100,100,63);
play_sound(sfx_5);
loop
//--------------------------------- I N T R O B L O C K C O D E --------------------------------
IF(intro_ == true)
if(game_state <= 4)
draw_text( fnt_white, itoa(round), 4, 160, 55, 199 ); // draw round num..
draw_text( fnt_white, "ROUND", 4, 160, 43, 199 ); // draw round title..
draw_graphic( f_main, 25, 160, 50, 200, 0,0, 100, 100 ); // draw round panel..
end

if(game_state == 0) // start dog position..
x_dog = 30;
y_dog = 200;
game_state = 1;
end

if(game_state == 1) // dog walks forward..
anima_ = ( anima_ + 1 ) % 14;
delay_x_dog = ( delay_x_dog + 1 ) % 2;
if(delay_x_dog == 1)
x_dog++;
end
if(x_dog == 60)
anima_ = 0;
game_state = 2;
end
draw_graphic( f_main, anima_walk[anima_ + 1], x_dog, y_dog, 200, 0,0, 115, 110 );
end

if(game_state == 2) // dog snnifing..
anima_ = ( anima_ + 1 ) % 11;
if(anima_ == 1)
counter_++;
end
if(counter_ == 3)
counter_ = 0;
anima_ = 0;
game_state = 3;
end
draw_graphic( f_main, anima_snif[anima_ + 1], x_dog, y_dog, 200, 0,0, 115, 110 );
end

if(game_state == 3) // dog walks forward..
anima_ = ( anima_ + 1 ) % 14;
delay_x_dog = ( delay_x_dog + 1 ) % 2;
if(delay_x_dog == 1)
x_dog++;
end
if(x_dog == 100)
anima_ = 0;
game_state = 4;
end
draw_graphic( f_main, anima_walk[anima_ + 1], x_dog, y_dog, 200, 0,0, 115, 110 );
end

if(game_state == 4) // dog snnifing..
anima_ = ( anima_ + 1 ) % 11;
if(anima_ == 1)
counter_++;
end
if(counter_ == 3)
counter_ = 0;
anima_ = 0;
game_state = 5;
end
draw_graphic( f_main, anima_snif[anima_ + 1], x_dog, y_dog, 200, 0,0, 115, 110 );
end

if(game_state == 5) // happy dog..
counter_++;
if(counter_ == 20)
counter_ = 0;
game_state = 6;
end
draw_graphic( f_main, 15, x_dog, y_dog, 200, 0,0, 115, 110 );
end

if(game_state == 6) // dog jumps..
if(x_dog < 130)
counter_++;
x_dog+=3;
y_dog-=4;
else
game_state = 7;
end
draw_graphic( f_main, 16, x_dog, y_dog, 200, 0,0, 115, 110 );
end

if(game_state == 7) // dog walls..
counter_++;
x_dog+=2;
y_dog+=4;
if(y_dog > 190)
game_state = -1;
intro_ = false;
end
draw_graphic( f_main, 17, x_dog, y_dog, 200, 0,0, 115, 110 ); // draw dog..
draw_graphic( f_main, 22, 160, 176, 128, 0,0, 100, 100 ); // draw grass mask on top..
end

if(game_state == 6 or game_state == 7)
if(counter_ == 1)
play_sound(sfx_9);
end
if(counter_ == 10)
play_sound(sfx_9);
end
if(counter_ == 19)
play_sound(sfx_9);
end
end
END
//----------------------------------------------------------------------------------------------



//-------------------------------- DUCKS PANEL B L O C K C O D E --------------------------------
flash_counter_ = ( flash_counter_ + 1 ) % 30; // flasing ducks counter..
for(i=0; i<=9; i++) // flashing active ducks in panel..
// draw ducks active or not active in panel..
if(ducks.active_ == 1)
if(flash_counter_ < 15)
draw_graphic( f_main, 9, ducks.panel_x_, ducks.panel_y_, 128, 0,0, 100, 100 );
end
else
draw_graphic( f_main, 9, ducks.panel_x_, ducks.panel_y_, 128, 0,0, 100, 100 );
end

// draw duck killed in panel..
if(flash_ducks_in_red == 0)
if(ducks.dead_ == 1)
draw_graphic( f_main, 24, ducks.panel_x_, ducks.panel_y_, 127, 0,0, 100, 100 );
end
else
if(flash_counter_ < 15)
if(ducks.dead_ == 1)
draw_graphic( f_main, 24, ducks.panel_x_, ducks[i].panel_y_, 127, 0,0, 100, 100 );
end
end
end

end
//----------------------------------------------------------------------------------------------


//-------------------------- ROUND CONTROLLER B L O C K C O D E --------------------------------
if(game_state == -1) // if intro as finished..

if(round_state == 0) // Starts new round..
put_screen(f_main, 4); // restore initial background..
Shots_left = 3; // now you have 3 shots left..
ID_DUCK = Duck(Counter_Ducks); // launch duck..
Counter_Ducks++; // increase duck counter..
shot_posible = 1; // now has posible to shot..
round_state = 1; // change round state..
end

if(round_state == 1)
if(!exists(ID_DUCK)) // when NOT exists duck process..
shot_posible = 0; // no shot posible..
round_state = 2; // change round state..
end
end

if(round_state == 2)
delay_new_duck_ = ( delay_new_duck_ + 1 ) % 31; // counter for 1 second..
if(delay_new_duck_ == 30) // when 1 second are passed..
delay_new_duck_ = 0; // reset delay por 1 second counter..
if(Counter_Ducks < 10) // if ducks remaining..
round_state = 0; // lauch a new duck..
else // else..
game_state = -2; // finish round.. go to recount ducks..
end

end
end
end

if(game_state == -2)
total_kills += ducks[0].dead_;
total_kills += ducks[1].dead_;
total_kills += ducks[2].dead_;
total_kills += ducks[3].dead_;
total_kills += ducks[4].dead_;
total_kills += ducks[5].dead_;
total_kills += ducks[6].dead_;
total_kills += ducks[7].dead_;
total_kills += ducks[8].dead_;
total_kills += ducks[9].dead_;

if(total_kills > 5)
game_state = -10; // go to next round..
else
play_sound(sfx_16,sound_channel_game_over);
game_state = -3; // game_over..
end
end
//----------------------------------------------------------------------------------------------

//-------------------------- G A M E O V E R B L O C K C O D E --------------------------------
if(game_state == -3)
if(!is_playing_sound(sound_channel_game_over))
game_state = -4;
end
draw_text( fnt_white, "GAME OVER", 4, 160, 43, 199 ); // draw "game over" text..
draw_graphic( f_main, 28, 160, 50, 200, 0,0, 100, 100 ); // draw game over panel..
end

if(game_state == -4)
play_sound(sfx_3,sound_channel_game_over);
game_state = -5;
end

if(game_state == -5)
x = 160;
y = 170;
z = 512;
file = f_main;
graph = 18;
game_state = -6;
end

if(game_state == -6)
delay_dog_risa_ = ( delay_dog_risa_ + 1 ) % 6;
if(delay_dog_risa_ < 3)
graph = 18;
else
graph = 19;
end
if(y > 145)
y--;
else
game_state = -7;
end
draw_graphic( f_main, 22, 160, 176, 128, 0,0, 100, 100 ); // draw grass mask on top..
end

if(game_state == -7)
delay_dog_risa_ = ( delay_dog_risa_ + 1 ) % 6;
if(delay_dog_risa_ < 3)
graph = 18;
else
graph = 19;
end
if(!is_playing_sound(sound_channel_game_over))
round = 0;
estado = 0;
fade_delay = 0;
game_state = 3;
delay_x_dog = 0;
counter_ = 0;
flash_counter_ = 0;
Counter_ducks = 0;
Round_State = 0;
Delay_new_duck_ = 0;
total_kills = 0;
delay_dog_risa_ = 0;
counter_game_over_ = 0;
flash_ducks_in_red = 0;
for(i=0; i<=9; i++);
ducks[i].dead_ = 0;
ducks[i].escape_ = 0;
ducks[i].active_ = 0;
end
inicio();
end
draw_graphic( f_main, 22, 160, 176, 128, 0,0, 100, 100 ); // draw grass mask on top..
end
//----------------------------------------------------------------------------------------------



//------------------------------G O T O N E X T R O U N D--------------------------------------
if(game_state == -10) // round has passed in normal mode..
play_sound(sfx_7, sound_channel_game_over);
id_wait_for_reallocate_ducks = reallocate_ducks_on_panel();
game_state = -11;
end

if(game_state == -11)
if(!is_playing_sound(sound_channel_game_over))
game_state = -12;
end
end

if(game_state == -12)
game_state = -13;
end

if(game_state == -13)
if(!exists(id_wait_for_reallocate_ducks))
game_state = -14;
end
end

if(game_State == -14)
if(total_kills == 10) // round has passed in perfect mode..
play_sound(sfx_13, sound_channel_game_over);
draw_text( fnt_white, "PERFECT", 4, 160, 43, 199 ); // draw "perfect" text..
draw_text( fnt_white, "10000", 4, 160, 53, 199 ); // draw "1000" text..
draw_graphic( f_main, 29, 160, 50, 200, 0,0, 100, 100 ); // draw perfect panel..
score += 10000; // extra bonus score for prefect round..
game_state = -15;
else
game_state = -16;
end
end

if(game_state == -15) // End of round with perfect..
draw_text( fnt_white, "PERFECT", 4, 160, 43, 199 ); // draw "perfect" text..
draw_text( fnt_white, "10000", 4, 160, 53, 199 ); // draw "1000" text..
draw_graphic( f_main, 29, 160, 50, 200, 0,0, 100, 100 ); // draw perfect panel..
if(!is_playing_sound(sound_channel_game_over))
round ++;
intro_ = true;
estado = 0;
fade_delay = 0;
game_state = 3;
x_dog = 60;
y_dog = 200;
delay_x_dog = 0;
counter_ = 0;
flash_counter_ = 0;
Counter_ducks = 0;
Round_State = 0;
Delay_new_duck_ = 0;
total_kills = 0;
delay_dog_risa_ = 0;
counter_game_over_ = 0;
flash_ducks_in_red = 0;
for(i=0; i<=9; i++);
ducks[i].dead_ = 0;
ducks[i].escape_ = 0;
ducks[i].active_ = 0;
end
end
end

if(game_state == -16) // End of round without perfect..
round ++;
intro_ = true;
estado = 0;
fade_delay = 0;
game_state = 3;
x_dog = 60;
y_dog = 200;
delay_x_dog = 0;
counter_ = 0;
flash_counter_ = 0;
Counter_ducks = 0;
Round_State = 0;
Delay_new_duck_ = 0;
total_kills = 0;
delay_dog_risa_ = 0;
counter_game_over_ = 0;
flash_ducks_in_red = 0;
for(i=0; i<=9; i++);
ducks[i].dead_ = 0;
ducks[i].escape_ = 0;
ducks[i].active_ = 0;
end
end
//----------------------------------------------------------------------------------------------








//----------------------------------------------------------------------------------------------
// masc of grass and tree..
if(game_state == -1) // after intro animation..
draw_graphic( f_main, 23, 60, 92, 128, 0,0, 110, 110 ); // draw tree on top..
draw_graphic( f_main, 22, 160, 176, 128, 0,0, 100, 100 ); // draw grass mask on top..
else // before intro animation..
draw_graphic( f_main, 23, 60, 92, 512, 0,0, 110, 110 ); // draw tree on background..
end
//----------------------------------------------------------------------------------------------

//--------------------------------- S H O O T B L O C K C O D E --------------------------------
if(shot_posible == 1) // if a shots posible..
if(shots_left > 0) // if shots availables..
if(estado == 0)
if(mouse.left) // if mouse.left..
stop_sound(sound_channel_shot); // stop/clear sound channel of shot..
play_sound(sfx_17, sound_channel_shot); // play sound of shot..
shot_event = true; // enable shot event.. for duck proces..
fade(200,200,200,64); // instant fade to white screen..
shots_left--; // decrease shot counter..
estado = 1; // change state machine..
end
end
end
end
if(estado == 1) // if shot has begun..
fade_Delay = ( fade_Delay + 1 ) % 5; // start delay for fade to normal color screen..
if(fade_delay == 4) // if delay finished..
estado = 2; // change state machine..
end
end
if(estado == 2)
fade_delay = 0; // reset delay var..
shot_event = false; // disable shot event.. for duck proces..
fade(100,100,100,64); // and instant screen fade to normal color..
estado =3; // change state machine..
end
if(estado == 3)
if(!mouse.left) // when release fire button..
estado = 0; // reset state machine..
end
end
//----------------------------------------------------------------------------------------------

//--------------------------------- P A N E L B L O C K C O D E --------------------------------
if(shots_left == 1) // 1 shot available..
draw_graphic( f_main, 5, 26, 216, 200, 0,0, 115, 110 );
end
if(shots_left == 2) // 2 shots availables..
draw_graphic( f_main, 5, 26, 216, 200, 0,0, 115, 110 );
draw_graphic( f_main, 5, 35, 216, 200, 0,0, 115, 110 );
end
if(shots_left == 3) // 3 shots availables..
draw_graphic( f_main, 5, 26, 216, 200, 0,0, 115, 110 );
draw_graphic( f_main, 5, 35, 216, 200, 0,0, 115, 110 );
draw_graphic( f_main, 5, 44, 216, 200, 0,0, 115, 110 );
end

// draw panels and score..
draw_text( fnt_white, itoa(score), 5, 296, 217, 255 ); // draw score..
draw_graphic( f_main, 6, 35, 220, 256, 0,0, 100, 100 ); // shots panel..
draw_graphic( f_main, 7, 150, 220, 256, 0,0, 100, 100 ); // hit panel..
draw_graphic( f_main, 8, 270, 220, 256, 0, 0, 100, 100 ); // score panel..
//----------------------------------------------------------------------------------------------
frame;
end
end[/Codebox]

Re: [GAME] Duck Hunt Remake [NES]

Posted: Tue Mar 13, 2012 2:43 pm
by OskarG
:D Genial erkos,te lo agradezco ya que entiendo que debes estar ocupado en mil cosas,a ver si aprendo este sistema nuevo de programar y exprimo gemix al maximo.

Re: [GAME] Duck Hunt Remake [NES]

Posted: Tue Mar 13, 2012 2:47 pm
by erkosone
Animo con ello Oscar, verás que poco a poco el cuerpo te pide mas y mas.. y esto se aprende solo a base de pegarte horas y horas codeando jeje..