安装 Steam
登录
|
语言
繁體中文(繁体中文)
日本語(日语)
한국어(韩语)
ไทย(泰语)
български(保加利亚语)
Čeština(捷克语)
Dansk(丹麦语)
Deutsch(德语)
English(英语)
Español-España(西班牙语 - 西班牙)
Español - Latinoamérica(西班牙语 - 拉丁美洲)
Ελληνικά(希腊语)
Français(法语)
Italiano(意大利语)
Bahasa Indonesia(印度尼西亚语)
Magyar(匈牙利语)
Nederlands(荷兰语)
Norsk(挪威语)
Polski(波兰语)
Português(葡萄牙语 - 葡萄牙)
Português-Brasil(葡萄牙语 - 巴西)
Română(罗马尼亚语)
Русский(俄语)
Suomi(芬兰语)
Svenska(瑞典语)
Türkçe(土耳其语)
Tiếng Việt(越南语)
Українська(乌克兰语)
报告翻译问题


1. You're using sound_isplaying instead of audio_is_playing for your conditional
2. Your sound effect might have a large period of silence at the end of the sound file, keeping too many instances of the sound effect open (if the sound is let to loop and it sounds very rapid - then it's not this)
1. Tried using audio_is_playing and it's still the same thing
2. That's not the case since the lenght of the audio is 0.5 seconds
Set up key press and key release events for all of your directions. Create an alarm event. In each key press event, set the new alarm = 1. This starts the code in the alarm instantly.
Then in the alarm, double-check buttons (not keyboard_check_pressed, but keyboard_check) for all of your directions, in an if statement. Inside each of them, add your audio_play_sound function, and restart your alarm equal to an amount that fits your footsteps the way you want them to.
Then at the very end of all that, put in a check to make sure no buttons are being pressed (!keyboard_check) for all of your directions. Inside this check, set your alarm to 0 so you can make sure it doesn't repeat more than you need it to.
Here's a sample from a platform game I'm making that uses the same idea:
Alarm 0:
if(keyboard_check(ord("A"))) {
scr_play_random_footstep();
alarm[0] = 24;
} else if(keyboard_check(ord("D"))) {
scr_play_random_footstep();
alarm[0] = 24;
} else if(!keyboard_check(ord("A")) || !keyboard_check(ord("D"))) {
alarm[0] = 0;
}
That script inside the checks plays a random footstep clip to give it a more authentic sound.
Finally, after all that, go to your key release events for your direction keys (WASD release, or whatever you have them set to) and set the alarm to 0, just to ensure that the alarm doesn't loop after you've released the keys.
Hope this helps!
There are a number of ways to fix this, but for testing purposes, you could try something like: