I am new to gdevelop and have started making a platformer to test with. I am having problems with sound working right. I have a sound for walking and one for jumping, however while holding the buttons to move, the sound loops very rapidly and overlaps, it sounds horrible. how can I change this so that it will sound right? is there a variable or something that I need to do? and if so, how do I do it?
It maybe because you start playing the sound constantly multiple times while the condition is true. The solve the problem, play the sound on a channel but before playing the sound check if a sound is NOT being played on a channel and play it only if no sound is played.
Also in case the sound is a long one you may also need to stop it manually if it being played. It is unlikely to be a problem with short sound effects but with long ones you may find your self in the situation when the player stop walking while the sound played only half way through then the sound is keep playing to the end even though the player is no longer walking…
So, you can try something like this:
thanks for the info, the sound clip I am using is very short, probably not even 2 seconds long. I’t just a simple foot step sound, but I think the above post may have shown me where I messed up. I have the sound linked to a key press and not the actual player movement lol. so I will change that and see how it goes. now I have come across another thing. actually a few other things. 1- how do I die? I have player set to where hitting enemy kills them, however I can walk right through them and nothing happens at all if I touch them without attacking. also if I fall it seems to be a never ending fall and never die, the scene just keeps going down forever. I am guessing it would be a “floor action” that if player “falls from floor then player dies” but that wouldn’t be good for elevated platforms you are allowed to “fall” from. and I am guessing there is an action to where if “enemy touches player while on floor, then player dies” but haven’t been able to figure this out. I have done some google searching and a little looking around here, but haven’t found anything that helps yet. maybe I am just not looking in the right place or for the right syntax. and my last question concerns the camera. is there a way to have the camera follow the player on the x axis only so that the scene stays centered on the y axis? it’s not a huge issue, more of a personal preference, but I would like the camera to scroll with the player on the x but not move on the y.
sorry for all the questions and long post, I am a noob in the purest sense of the word lol.
Thanks for the help
I’m not sure if I understand your problem, if you can kill the enemies on collision, you can damage and kill the player the same way. Perhaps you should complete the beginner tutorials on the wiki first:
The scene in GDevelop is infinite in all directions so you are right, it is a never ending fall. I can think of 3 ways to solve this problem:
Since you are using the platformer behaviour, you have a condition to check if the player is or is not on the floor and if it falling. Unless the player can fly, you could start a timer if the player is not on the floor or falling and see how long it takes, if it too long then probably it falling to death so you can reset it position or the whole scene.
You can check the position of the player on the Y axis. If it too low, probably it means it falling so you can reset the player position or the whole scene… Of course in this case you need to take in to account the lowest position the player can get to and see if it get below that position.
Probably the easiest way is to use an actual object on the bottom of the scene and check collision between the object and the player. If player is in collision with that object, that means it falling…
Yes, you can center the camera on X position, in place of value you need to use an expression to make it work.
In this case you need to get the X position of the player using the expression “objectname.X()”.
Expressions are very powerful, you can do many things with them. There are many expressions in GDevelop that you can find in the expression editor. Most fields where you can enter expression there is a button on the right side that opens the expression editor for you and you can browse the available expressions…
Instead of trying to find the answer how to do specific tasks like kill enemy, kill player…etc I recommend to read the tutorials and become familiar with the basics first because most of the times you need to (and better to) come up with you own ways of doing things: