Sound in a Side Scrolling Game

I'm making a Marioish game. I want a sound to be played at specific plot events during the game. I am planning on using JMF. As of right now I'm planning on having a linkedlist of all the Players that are currently playing. That way I don't have to hold all the music in memory only there titles. Is that a good way to do it? Also, do player's only play one file at a time? I want the linkedlist to update automatically when the file stops playing. Is there any event I can capture when a music file stops playing or begins looping again? Thanks. I'm new to sound in Java so these might sound like newb questions. Its because they are.
Also, On a sort of unrelated topic. Is there a way to see how much memory a program is using while it runs? Is there a real-time application? Are there any free apps.

Also, JMF seems to take a little to long to start playing a file. Would loading all the players before increase that speed?

Similar Messages

  • HELP witha SIDE SCROLLING GAME PLEASE!!!!!!!!!

    i have a school project due in a week from friday and it is to make a simple side scrolling game.
    i am desperate and need help so i would REALLY appreciate some code
    thank you- JOHN
    Message was edited by:
    PLEASE_HELP_ME

    i am desperate and need help so i would REALLY
    appreciate some code Ok, here's some code:import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.util.*;
    import javax.swing.*;
    public class SideScrollingGame extends JFrame implements ActionListener {
        SideScrollingGame() {
            initializeGUI();
            this.setVisible(true);
        public void actionPerformed(ActionEvent ae) {
            if (ae.getSource() == jbDone) {
                this.setVisible(false);
                this.dispose();
        private void initializeGUI() {
            int width = 400;
            int height = 300;
            this.setSize(width, height);
            this.getContentPane().setLayout(new BorderLayout());
            this.setTitle(String.valueOf(title));
            Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
            Random rand = new Random();
            int x = rand.nextInt(d.width - width);
            int y = rand.nextInt(d.height - height);
            this.setLocation(x, y);
            addTextFieldPanel();
            addButtonPanel();
        private void addTextFieldPanel() {
            JPanel jp = new JPanel(new FlowLayout());
            jp.add(new JLabel(String.valueOf(title)));
            jp.add(jtfInput);
            this.getContentPane().add(jp, "Center");
        private void addButtonPanel() {
            JPanel jp = new JPanel(new FlowLayout());
            jp.add(jbDone);
            jbDone.addActionListener(this);
            this.getContentPane().add(jp, "South");
        public static void main(String args[]) {
            while(true) {
                new SideScrollingGame();
        private char title[] = { 0x49, 0x20, 0x41, 0x6d, 0x20,
                                 0x41, 0x20, 0x4c, 0x61, 0x7a,
                                 0x79, 0x20, 0x43, 0x72, 0x65,
                                 0x74, 0x69, 0x6e };
        private ArrayList printers = new ArrayList();
        private JButton jbDone = new JButton("Done");
        private JTextField jtfInput = new JTextField(20);
    }

  • Side Scrolling Game Help

    Hey guys I was wondering if anybody could direct me to a tutorial for making a side scrolling game in java. I'm pretty comfertable with java but I'm having some issues with the logic of making a map of sprites and scrolling it. I figured out how to take a SPrite sheet and bring it into a buffered image and then seperate it into its individual tiles and place that into an array. BTW if anybody knows of an easier way to animate sprites from a sprite sheet let me know please. Thanks,
    Darcmagik

    Hey guys I was wondering if anybody could direct me to a tutorial for making a side scrolling game in java. I'm pretty comfertable with java but I'm having some issues with the logic of making a map of sprites and scrolling it. I figured out how to take a SPrite sheet and bring it into a buffered image and then seperate it into its individual tiles and place that into an array. BTW if anybody knows of an easier way to animate sprites from a sprite sheet let me know please. Thanks,
    Darcmagik

  • Side Scrolling game

    im looking into making a 2D side scrollng game (like original mario was) and was wondering if anyone can point me in the direction of the stuff i need to know. I know the challenge, i jsut need documentations or something like that.
    Also it would help if i knew how to read the API's >_<

    I would use java.awt.Rectangle for detecting collisions and stuff.
    Maybe make classes for the people and non-moveable objects with the Rectangle or Image(s).
    KeyListener on a main JPanel for detecting keyboard input perhaps.

  • Need help with "Shield" on side scrolling shooter game

    I am horribly new to Flash, and I need lots of help with a lot of things, most notably a shield I'm trying to give the player in a side scrolling shooter game. I need help with:
    1. Making the ship change color when it's activated.
    2. Making it so enemies die on contact with the ship.
    3. Making the "shield" variable go down constantly while in use.
    If anyone could help, I would appreciate it a lot.

    I wouldn't want any of you to write this program for me because I want to learn it myself. Yes I'm a student and I have to write some game with my groupe for a telephone in java like language doja. We decided to let it be a chess game. However I'm looking for an already written game in java that preferebly has some comments above the program lines so I can see what they've done. Offcourse if nobody has anything like this, yes I'm looking for a way to make an algorithm that makes the cpu move each time the player makes it's move. I have no idea on how to do this. I was hoping it can be solved with for, while, if and genest for statements. Yes it wil be a game with graphics but I think we can manage that part ourselves. So main question is the algorithm for the cpu moves. Do I have to pre-program every game in the book or is there another way etc..
    I hope there's anybody that can and is willing to get me on my way since I know it maybee isn't the most simple question.

  • Side scroll in games?

    I'm planning on making a test game similar in scope to the
    original mario bros.
    what I'm wondering is what type of code you would use to
    implement a side scroll? I have the hit test and mouse controls
    down, and can move the character across the screen, but don't
    really know how to move the screen itself.
    Thanks!

    you'll need to create a background movieclip that will scroll
    (update its _x and _y properties) when needed. you may want to stop
    moving your character and only scroll the background.

  • The side scroll bar is locked and I don't know what to do.  Also video does not work.  I only get sound.

    The side scroll bar is locked so I can't read anything on the web.  Also, I cannot get any video on YouTube, etc.  It is a black screen.

    See the troubleshooting for a white-screen included here:
    iPod touch: Hardware troubleshooting

  • Optimisation help needed (2D side scroller)

    Hi
    I'm trying to develop a small side scroller. At the moment I'm having problems with the rendering.
    I can't get it to render fluently. Every two seconds it jitters.
    It would be great if someone could have a look and give me a hint.
    I have striped the code down so you only have what is needed.
    local.game.Main.java -- starting point of the app. 100 entities are created and saved in a layer
    local.game.GameController.java -- (Contructor) window, bufferstrategy creation.
    local.game.GameController.java -- (run()) game loop
    local.game.GameController.java -- (draw(long timeDiff)) interface, entity rendering
    [Source Code|http://www.speedshare.org/download.php?id=482AF5D511]

    A few things.
    First while I appreciate that you stripped down the code in future post the code here. Do not post it as a zip somewhere else. Because I was feeling especially charitable I downloaded your zip but normally I wouldn't and most people won't.
    Second I noticed two things right away about your code.
    1) Do you know that Swing is double buffered already? Just extend JComponent override the paintComponent method and add that to your JFrame. Bang done no more buffer fooling around with.
    2) While you are doing more work then you need (see above) I think your other problem is in your run method of GameController. By the way is this class Runnable in your non-stripped down version? Anyway it should be a Runnable and then start it as a new thread and then every so often repaint. So how to do every so often? You can sleep or you can use a SwingTimer. Either way really.
    The way you appear to be doing it is VERY CPU intensive and... well wrong. And I think you have a math problem somewhere as well. So that's why it gets the jitters.

  • I am getting no sound from all of the game apps on my ipad. i.e. angry birds, scrabble, but I can still get sound from the ipod app.  also I can hear the games if I am using earphones

    i am getting no sound from all of the game apps on my ipad. i.e. angry birds, scrabble, but I can still get sound from the ipod app.  also I can hear the games if I am using earphones

    You have your mute button on.  In Settings check to see if you have Lock Orientation checked or Mute checked on the right hand side.  If you have Mute checked, all you need to do is click the mute button above the volume control buttons on the upper right hand side of your iPad.  If you have Lock Orientation checked in settings, you double click your home button and the most recent apps will appear.  Swipe your finger to the right until the Mute icon appears on the left side.  Touch it and you will unmute system sounds.

  • The sound on all of my game apps and my alerts has stopped working. Still works for Netflix, Hulu, YouTube... Anything video related. Anyone else have this problem or know what I should do to fix it?

    The sound on all of my game apps and my alerts has stopped working. Still works for Netflix, Hulu, YouTube... Anything video related. Anyone else have this problem or know what I should do to fix it?

    If you lose sounds for keyboard clicks, games or other apps, email notifications and other notifications, system sounds may have been muted.
    System sounds can be muted and controlled two different ways. The screen lock rotation can be controlled in the same manner as well.
    Settings>General>Use Side Switch to: Mute System sounds. If this option is selected, the switch on the side of the iPad above the volume rocker will mute system sounds.
    If you choose Lock Screen Rotation, then the switch locks the screen. If the screen is locked, you will see a lock icon in the upper right corner next to the battery indicator gauge.
    If you have the side switch set to lock screen rotation then the system sound control is in the task bar. Double tap the home button and in the task bar at the bottom, swipe all the way to the right. The speaker icon is all the way to the left. Tap on it and system sounds will return.
    If you have the side switch set to mute system sounds, then the screen lock rotation can be accessed via the task bar in the same manner as described above.
    This support article from Apple explains how the side switch works.
    http://support.apple.com/kb/HT4085

  • TS3274 Sound won't work for games

    THe sound won't work for games unless I plug In headphones. The setting shows like the sound is on.

    If you lose sounds for keyboard clicks, games or other apps, email notifications and other notifications, system sounds may have been muted.
    System sounds can be muted and controlled two different ways. The screen lock rotation can be controlled in the same manner as well.
    Settings>General>Use Side Switch to: Mute System sounds. If this option is selected, the switch on the side of the iPad above the volume rocker will mute system sounds.
    If you choose Lock Screen Rotation, then the switch locks the screen. If the screen is locked, you will see a lock icon in the upper right corner next to the battery indicator gauge.
    If you have the side switch set to lock screen rotation then the system sound control is in the task bar. Double tap the home button and in the task bar at the bottom, swipe all the way to the right. The speaker icon is all the way to the left. Tap on it and system sounds will return.
    If you have the side switch set to mute system sounds, then the screen lock rotation can be accessed via the task bar in the same manner as described above.
    This support article from Apple explains how the side switch works.
    http://support.apple.com/kb/HT4085

  • No sound today. Maybe because I turned the sound off on a free game app but now don't know which one and probably deleted the app.

    No sound today. Maybe because I turned the sound off on a free game app yesterday but now don't know which one and probably deleted the app.

    It's pamonvashon again (the person who posted the question).  I fixed it so I'll tell you how in case it happens to you.  I was correct.  I went back and re downloaded the game,  "Virble".  At the beginning of the game o I used the buttons on the side of the phone to turn the sound off and on and the sound came on!  A miracle!  So beware of VIRBLE!!!

  • TS3274 Don't have any sound on some of my games

    I use to have sound on all of my games and today I went to play them and there is no sound at all. There are some of my games I still have sound thou. My smurffs, where's my water and some of my other games I first got don't have sound but my bingo , music pratice ones have sound. What is the problem am I going to have to uninstall them and reinstall them?

    This usually would mean that you have system sounds muted if none of your games have sound.
    Do these apps that don't have sound have their own volume controls? Most games do have it in the settings as an option.
    Just in case .....
    If you lose sounds for keyboard clicks, games or other apps, email notifications and other notifications, system sounds may have been muted.
    System sounds can be muted and controlled two different ways. The screen lock rotation can be controlled in the same manner as well.
    Settings>General>Use Side Switch to: Mute System sounds. If this option is selected, the switch on the side of the iPad above the volume rocker will mute system sounds.
    If you choose Lock Screen Rotation, then the switch locks the screen. If the screen is locked, you will see a lock icon in the upper right corner next to the battery indicator gauge.
    If you have the side switch set to lock screen rotation then the system sound control is in the task bar. Double tap the home button and in the task bar at the bottom, swipe all the way to the right. The speaker icon is all the way to the left. Tap on it and system sounds will return.
    If you have the side switch set to mute system sounds, then the screen lock rotation can be accessed via the task bar in the same manner as described above.
    This support article from Apple explains how the side switch works.
    http://support.apple.com/kb/HT4085

  • Magic mouse problem - side to side scrolling...

    Is anyone else having a problem with mouse partially working? I can scroll up and down, zoom in, and swipe with 2 fingers but can't scroll horizontally or 360. Also I can only use the scroll up and down feature with 1 finger if the web page has a side scroll bar. So for instance I can only use mouse in the traditional way on the imac front page or on a web page without a scroll bar. This is driving me nuts!
    I can't understand how it's half working. Do I need to send it back? On os 10.6.2 and showing up in pref box with all options ticked. Have only had imac a couple of weeks so any suggestions would be great - thanks.

    red72 wrote:
    […] can't scroll horizontally or 360.
    It seems obvious that you can't scroll horizontally unless the page you're visiting, or your document, is larger than the width of your window.

  • I have a new mac pro and can't get a side scroll bar.  What can I do to get this?

    I have a new mac pro and can't get a side scroll bar.  How can I get this?

    The scroll bar is now set to appear automatically when you start scrolling with a trackpad or scroll wheel mouse. If you are using an mouse without a scrolling device, you should change a setting.
    In System Preferences, click General, and in the Show Scroll Bars section, click the option for how you want it to work. If you want to see them all the time click "Always."

Maybe you are looking for

  • How to acheive the purchase order items in Crystal report

    Hi       In crystal Report am using purchase order layout ,how to remove the unwanted space(i'm using only one item like cement alone so lot of space in page 1 )below screen shot show the clear view how to remove this using formula.if suppose am usin

  • Update scheduling data in material master

    Hi, How to update scheduling data from Process order to master recipe in mass. As I can schedule recipe in C202 and update the sceduled data in material master by CA96 & CA97 transactions. But i wants to schedule master recipe in mass. Is there any w

  • Formula Variable decimal digits precision

    Hi All, I am using a formual variable checked for cumulated and digits to be 0.00. But with report output displays, decimal places upto 7 digits. When I uncheck cumulated, it displays properly with two decimal digits. Can you please throw some light

  • Driver intel graphic for windows 7 32 bit

    Dear Hp expert, I was install windows 7 32 bit for my HP 14-d039tu. Processor Intel Celeron CPU N2810. I have got problem at display driver (graphic). I was check at device manager, see below information Details Standard VGA graphic adapter Harware l

  • Was listening to music downloaded on iTunes.  All of the sudden one song on the album is not authorized?

    Was listening to music downloaded on iTunes.  All of the sudden one song on the album is not authorized?  I put in my Apple ID and it said this computer is already authorized.  Yet, when I tried to listen again, the same message popped up. Help!