Java Programming: Let's Build a Game #11

preview_player
Показать описание

In this video we add sound into our game! If you have any questions then be sure to leave a comment or contact me on twitter; realtutsgml. If you learned something then be sure to leave a like, comment, and favorite.

Have you ever wanted to create games? Have you ever gotten fed up with it being to difficult? Well now is the time to thank me and possibly subscribe because you have just found the channel for you! Game Maker Tutorials, Java Game Programming, Unity3D Tutorials, Batch, C++ and much much more! This is the channel for you, the one stop shop for an exploration of your hidden talent as a game developer. Unleash your potential and go wild with imagination when you finally figure out how to make any game you want!

Visit CodingMadeSimple for more exclusive tutorials and get the help you need to succeed as your very own indie game developer!

Follow me on twitter for exclusive content and interaction with me!

Follow me on Google+ to keep updated with all of my tutorials

Game Maker Studio: Programming
Game Maker Studio: Tutorial
Java Programming
Game Programming
Game Tutorial
Programming Tutorial

Рекомендации по теме
Комментарии
Автор

RealTutsGML this series you have done has been amazing. I can't speak for everyone, because it seems like a great many people have had issues.

I'm an experienced coder in older languages such as VFP, C, and C++, and I know a little of C#, HTML5, CSS, Angular, and Javasript. I dabble in just about everything else with a name, like Python, Ruby, Rust, and the like. However, this is my first in-depth Java project, and I have had literally no issues.

Your instructions have been pretty clear, and I think one of the main problems people are having is that they don't know Eclipse, or they aren't following what you are doing word for word.

I'd like to congratulate you on such a job well done. I look forward to learning more about Java, and game development from you. Cheers!

IAmFirstborne
Автор

I set different music to different levels so that the higher the level the more intense and driving the music gets. Excellent tutorial.

vernevens
Автор

I was struggling with so many errors so I just did this. It looks more complex but it is really simple and runs smooth and works perfect.

package first.Game;



import java.io.File;

import java.io.IOException;

import

import

import javax.sound.sampled.Clip;

import

import

import



public class AudioPlayer {



private static Clip play;



public static void playMenuSound()

{

try {

AudioInputStream menuSound =

play = AudioSystem.getClip();

play.open(menuSound);

FloatControl volume = (FloatControl)

volume.setValue(0.5f);



}catch (LineUnavailableException | IOException | UnsupportedAudioFileException e){

e.printStackTrace();

}

}



public static void playGameSound()

{

try {

AudioInputStream gameSound = File("src/res/inGame.wav"));

play = AudioSystem.getClip();

play.open(gameSound);

FloatControl volume = (FloatControl)

volume.setValue(1.0f);



}catch (LineUnavailableException | IOException | UnsupportedAudioFileException e){

e.printStackTrace();

}

}



public static void stopMusic()

{

play.close();

}

}

BTDDrewBTDwithDREW
Автор

For those of you who are getting errors with the library.
make sure you are using the classPath not the module
that by itself solved my problem.

Cerv_guitars
Автор

lmao "sperm game"

fr though these tutorials have me the most excited about coding i've been in years and it feels amazing to get that adrenaline rush again. Thank you.

xhappybunnyx
Автор

Wow dude, your alive! Where have you been?

tomo
Автор

Finally! I've been waiting on this forever.

Sirk
Автор

if youre using intellij heres how to add the libs



toushi
Автор

is anyone having issues with the "add class folder" part. My libraries tab looks different. It shows Modulepath and Classpath. How can I get rid of those?

licolhavaiia
Автор

Hi, could someone tell me how to get rid of the Exception that AL Lib: alc_cleanup: 1 device not closed? I tried AL.destroy when exit the game, but it shows another Exception which is AL Lib: FreeContext: (some error code) deleting 64 sources. Thanks for help:)

JESSENXC
Автор

Wow, this was a little frustrating trying to set it up from the command line but I learned a lot. Great tutorial, thanks a bunch.

therapy
Автор

I made a song for this part of the tutorial as I needed some music. I made it in Logic Pro. Logic saved it as wave, then I used VLC to convert it to OGG on a Windows computer.
The file size of the 13 second music went from 3.34MB to 212KB. A massive reduction in file size, the sound quality was good enough too :D

vivanecrosis
Автор

Exception in thread "main" no lwjgl in java.library.path
at
at
at
at
i m getting this exception after creating the audioplayer class....i have added the required libraries as well but the linker is not able to find the lwjgl file..can anyone help?

nishthatandon
Автор

This Tutorial was very helpful but I can't get past 01:18. So sadly this Game will be left unfinished....

Rotogas
Автор

Please show how to make a pause screen, I've tried and I can't work it out.

EliteTradersJames
Автор

Everyone in here asking for help but don't mention the "Sperm Game" in his workspace

porlearktuy
Автор

Where he initializes the musicMap and the soundMap, I would recommend writing It returns a URL so if you need a string just use the .toString() operator. That way, you are making the program more flexible.

NubPaws
Автор

I guess my game won't have sound because of a library error

mikaelkolehmainen
Автор

+RealTutsGML I love your tutorials bro :)
I found a little annoying bug, sometimes when I click the play button, the game freezes with a NullPointerException and it is caused by trying to render a deleted menu particle, I solved it by adding a boolean to the class Handler ( clearing ), this variable takes true at the beginning of clearEnemies() and false at the end, then I added a test in render() if(clearing) return; I want to know your remarks about this solution, is there a better one ?
Keep up the good work :) peace ;)

stoufa
Автор

Exception in thread "Thread-3"
at Source)
at Source)
at
at
at
at java.lang.Thread.run(Unknown Source)

I get this error sometimes (not always), but havent figured out the problem yet..

ChristofferBrandsborg