|
« on: February 16, 2008, 03:57:58 am »
|
|
Hi all Zelda fanatics , I'm working on a Zelda game at the moment and today i have been trying to make an Ocarina engine. It have gone quite well, but as always something goes wrong. All tones(music) works correct but the draw event doesn't. So the reason I'm writing this post is that when i play a tone on my ocarina it should draw images of the tones(like in OOT) but i cant get it to work :/ Creation code (ocarina obj) ObjLink.image_speed=1 soundstring=0 ObjLink.sprite_index=SprLinkOcarina lk=0; vA=0; vL=0; vR=0; vD=0; vU=0; sn=""; do { lk=keyboard_lastkey screen_redraw() draw_text(ObjLink.x,ObjLink.y,sn) screen_refresh() if vA>0 vA-=0.01 else sound_stop(wav_oc_A) if vL>0 vL-=0.01 else sound_stop(wav_oc_L) if vR>0 vR-=0.01 else sound_stop(wav_oc_R) if vD>0 vD-=0.01 else sound_stop(wav_oc_D) if vU>0 vU-=0.01 else sound_stop(wav_oc_U)
if lk = ord('S') {if !sound_isplaying(wav_oc_A) sound_play(wav_oc_A);vA=1; if string_copy(sn,string_length(sn),1)!='A' sn+='A'} if lk = vk_up {if !sound_isplaying(wav_oc_U) sound_play(wav_oc_U);vU=1;if string_copy(sn,string_length(sn),1)!='U' sn+='U'} if lk = vk_down {if !sound_isplaying(wav_oc_D) sound_play(wav_oc_D);vD=1;if string_copy(sn,string_length(sn),1)!='D' sn+='D'} if lk = vk_left {if !sound_isplaying(wav_oc_L) sound_play(wav_oc_L);vL=1;if string_copy(sn,string_length(sn),1)!='L' sn+='L'} if lk = vk_right {if !sound_isplaying(wav_oc_R) sound_play(wav_oc_R);vR=1;if string_copy(sn,string_length(sn),1)!='R' sn+='R'} if string_length(sn) > 7 sn = string_copy(sn,string_length(sn)-6,7) sound_volume(wav_oc_A,vA) sound_volume(wav_oc_L,vL) sound_volume(wav_oc_R,vR) sound_volume(wav_oc_U,vU) sound_volume(wav_oc_D,vD)
if keyboard_check(vk_up) or keyboard_check(vk_down) or keyboard_check(vk_left) or keyboard_check(vk_right) or keyboard_check(ord('S')){ soundstring=+1 }
if string_copy(sn,string_length(sn)-5,6) = "RADRAD" {sleep(200); sound_play(mid_timesong);sn='';do{sleep(100)}until !sound_isplaying(mid_timesong); instance_destroy()}
keyboard_lastkey=0 sleep(50/3) } until lk = ord('D') or lk = vk_escape instance_destroy()
The step event (ocarina obj)
switch(sn){ case 'A': image_index=4; break; case 'U': image_index=3; break; case 'D': image_index=1; break; case 'L': image_index=2; break; case 'R': image_index=0; break; }
and the draw event (ocarina obj) draw_sprite(Ocarinamenu,0,view_xview+50,view_yview+180)
if soundstring=1 then{ draw_sprite(OcarinabuttonsU,(execute_string('sprite_index=Ocarinabuttons'+sn)),view_xview+20,view_yview+190) } if soundstring=2 then{ draw_sprite(OcarinabuttonsU,(execute_string('sprite_index=Ocarinabuttons'+sn)),view_xview+20,view_yview+190) } if soundstring=3 then{ draw_sprite(OcarinabuttonsU,(execute_string('sprite_index=Ocarinabuttons'+sn)),view_xview+20,view_yview+190) }
I tried to make a code that changes the "soundstring" variable but i cant get it to work, so please help me :'( i would appreciate any kind of answer and i should be really glad if someone could help me to get rid of my problem // Jegge (sorry for my bad English)
Logged
|