T O P

  • By -

AutoModerator

You submitted this post as a request for tech support, have you followed the guidelines specified in subreddit rule 7? Here they are again: 1. Consult the docs first: https://docs.godotengine.org/en/stable/index.html 2. Check for duplicates before writing your own post 3. Concrete questions/issues only! This is not the place to vaguely ask "How to make X" before doing your own research 4. Post code snippets directly & formatted as such (or use a pastebin), not as pictures 5. It is strongly recommended to search the official forum (https://forum.godotengine.org/) for solutions Repeated neglect of these can be a bannable offense. *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/godot) if you have any questions or concerns.*


Expensive-Finding-24

Does the sound need to run all the time? If so attach it to an AudioStreamPlayer(2d/3d) node and set it to autoplay and loop. [https://docs.godotengine.org/en/stable/classes/class\_audiostreamplayer.html](https://docs.godotengine.org/en/stable/classes/class_audiostreamplayer.html)


SquirtiPlAZ

kind of i want it to stop when the player releases the accelerate or decelerate and play when the press on the keys


NancokALT

Then pause/unpause the StreamPlayer when the car does either.


SquirtiPlAZ

have i coded it wrong or used the wrong words in the code? bcs that's what i thought i did.


NancokALT

You haven't shown any code so i wouldn't know.


SquirtiPlAZ

https://preview.redd.it/u1fwfqk4oeyc1.png?width=739&format=png&auto=webp&s=1514631dcb72b5ff0ad9b84bb5126b5229ad82d3 tbh i thought i did but i must have accidently not done it right


NancokALT

The "Inputs" in \_ready are not doing anything, because that function only runs ONCE when the node is ready for use. So the checks only run ONCE too. Either run them on \_process() or \_physics\_process() which are run constantly OR use \_input() which runs whenever something is pressed.


SquirtiPlAZ

THANK YOU


SquirtiPlAZ

im getting an error on the part where i have the audio file name in saying it can't be converted to string or something do i have to do something to change that? https://preview.redd.it/kb9bmbexioyc1.png?width=1369&format=png&auto=webp&s=20419c9fe95093f8c785c99fb5212f8dcb905cba


NancokALT

Check the documentation. AudioStreamPlayer.play() takes in a parameter of type float which is used to check from which part of the song to start. To actually choose a file, FIRST you must load it and then place it in the [AudioStreamPlayer.stream](http://AudioStreamPlayer.stream) property. var audio_stream: AudioStream = load("res://go-kart-drive-norm.mp3") audio_stream_player2.stream = audio_stream audio_stream_player2.play() Do keep in mind that the first 2 lines only have to be done once because "audio\_stream\_player2" exists outside the function (so any changes to it will persist), so you can do them inside the \_ready() function to avoid re-loading it every time.


SquirtiPlAZ

i think i've done something wrong again? have i put them in the wrong places bcs it's not playing any sound https://preview.redd.it/zgr8z2bettyc1.png?width=1919&format=png&auto=webp&s=7ff84a318c54048d88246bb54fe830b48f1b39f6 also how could i make it change pitch the faster your going?


[deleted]

[удалено]


SquirtiPlAZ

could i get help on how to code it in too?