Side Scrolling in Java

Hi ... I would like to know how to do side scrolling in java... then same concept of how MapleStory did it. I have tried with Graphics and other awt packages but it dont seem to work out...
Can someone give me a head start or if possible the full implementation.. :P

I found this on http://www.apartmenttherapy.com/do-scroll-bars-still-matter-151901 and it worked for me.

Similar Messages

  • 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.

  • 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

  • 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.

  • 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."

  • 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

  • Problem with Horizontal Scroll on java.awt.List

    I use the same code for a General Application as a CDC Application.
    I have no problem at all with the General Application but on the CDC I can't scroll to the right (horizontal).
    Why do I get this problem on the CDC application and not on a regular application?
    I use the PP-1.0 Profile for the CDC application. Does it not support horizontal scroll on java.awt.List?
    This is the code:
    * Main.java
    * Created on den 22 augusti 2007, 10:52
    package cdcapplication6;
    * @author  Erik Rothman
    public class Main extends java.awt.Frame {
        /** Creates new form Main */
        public Main() {
            initComponents();
              for (int i = 0; i < 10; i++) {
                   list1.add("Short text");
                   list1.add("Some very long text indeed. Some very long text indeed.");
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            list1 = new java.awt.List();
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            add(list1, java.awt.BorderLayout.CENTER);
            pack();
        }// </editor-fold>                       
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {                         
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Main().setVisible(true);
        // Variables declaration - do not modify                    
        private java.awt.List list1;
        // End of variables declaration                  
    }

    I use the same code for a General Application as a CDC Application.
    I have no problem at all with the General Application but on the CDC I can't scroll to the right (horizontal).
    Why do I get this problem on the CDC application and not on a regular application?
    I use the PP-1.0 Profile for the CDC application. Does it not support horizontal scroll on java.awt.List?
    This is the code:
    * Main.java
    * Created on den 22 augusti 2007, 10:52
    package cdcapplication6;
    * @author  Erik Rothman
    public class Main extends java.awt.Frame {
        /** Creates new form Main */
        public Main() {
            initComponents();
              for (int i = 0; i < 10; i++) {
                   list1.add("Short text");
                   list1.add("Some very long text indeed. Some very long text indeed.");
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">                         
        private void initComponents() {
            list1 = new java.awt.List();
            addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    exitForm(evt);
            add(list1, java.awt.BorderLayout.CENTER);
            pack();
        }// </editor-fold>                       
        /** Exit the Application */
        private void exitForm(java.awt.event.WindowEvent evt) {                         
            System.exit(0);
         * @param args the command line arguments
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Main().setVisible(true);
        // Variables declaration - do not modify                    
        private java.awt.List list1;
        // End of variables declaration                  
    }

  • Side-scrolling photo gallery on iweb????

    I have created a site on IWeb, and have several pictures on the site (www.sharonrai.com)
    and I would like to make a side-scroll on the side with all my pictures from each section on it, so you can view all the pictures in a glance on the side, and if you want to look at one, click on it, and it becomes big...
    Anyone know how to do this?
    Thank You.

    If you are publishing to .mac, create a new site in iWeb for each folder you would like password-protected and enable password protection for that site. Repeat the process however many times you need a new site (folder) with unique username and password. You have to do all of this manually however, the process is not dynamic where the user could register on your site and create their own username/pw and have their username be their folder location on your site. Can't do that with iWeb and/or .mac but you can do the manual creation in iWeb as mentioned.

  • How Can I Side Scroll in Folder Pane

    I have recently started using Lightroom again (has 2 then upgraded to 5 in the past year) one thing I've noticed is that there's no side scrolling in the Folders pane. Because of that I can't read the folder names.
    I know if I move my photos to a higher level directory that would fix it but it's not like my photos are in an unusual place. The path structure I use is:
    Mac HD : /Users/Terriann/Photos/2014/12-17 - Folder of images/
    I could of sworn the last time I seriously used Lightroom (years ago and on a PC, now I'm on a Mac) I could side scroll that panel so I could read the folder names.

    Although I agree that a "scroller" on the folder panel would be useful, Lightroom is designed to use a keywords, metadata and filters workflow for selectings photos instead of a folder based workflow and once you start using it that way you will not have to "drill" down through folders looking for files.
    For instance, to select dates for any given day or month you can use the filter bar
    or you can click on the little arrow next to the date in the metadata on a photo and it will filter for all the photos on that date.
    It is a different concept to folders but once you set it up it is very powerful.

  • Plzzzz solve my problem my side scroll bar does nt appear due to which i have to face the problem in scrolling page up and dowen quicly.

    i am using latest version of mozilla suddenly on mozilla searching page side scroll bar is not appearing due to which i have to face prob in scrolling the page which i see i am not understanding what has happened.plz solve this problem as soon as possible.

    Here you go.

  • Browser displays no slider bar to side-scroll if a page is oversized.

    I'm having a problem with the new Firefox 4 and how it displays websites that are oversized. This new browser has a lack of a side scroll bar at the bottom of the page (or top) that allows me to view the whole page.
    Also, I can't have my Fonts set at low 18 because my eyesight gets blurry quickly if it's that size. Anyone else have this problem and know how to remedy it? Thanks.

    It is possible that the screen is too high and that the status bar and scroll bar fall off at the bottom.<br />
    Open the system menu via Alt+Space and see if you can resize that window.<br />
    If that works then close Firefox to save that setting.<br />
    See also:
    * http://kb.mozillazine.org/Resizing_oversize_window
    You can use one of these extensions to adjust the default font size and page zoom on web pages:
    * Default FullZoom Level - https://addons.mozilla.org/firefox/addon/6965
    * NoSquint - https://addons.mozilla.org/firefox/addon/2592

  • ITune side scroll bars won't scroll when up or down arrow held

    This is a problem, only in iTunes. My side scroll bars stopped working. When I push arrow up or down, they barely budge. I have to manually slide the bar.
    I want my scroll bar function back. Thanks for your help.

    Create a new profile exclusively for the 4.0 beta version and create a desktop shortcut with -P "profile" appended to the target to launch that profile.
    * http://kb.mozillazine.org/Testing_pre-release_versions
    * http://kb.mozillazine.org/Creating_a_new_Firefox_profile_on_Windows
    * http://kb.mozillazine.org/Shortcut_to_a_specific_profile
    * http://kb.mozillazine.org/Using_multiple_profiles_-_Firefox

  • AS3 Creating Side Scrolling Thumbnails?

    I'm creating a gallery page for my site, and I need a side
    scrolling thumbnail display.
    Basically it would have several thumbnails that would keep
    scrolling for ever (some how duplicating the content in a mask). If
    anyone has anything like this or any links that would be great.
    Cheers!
    Parallels.fm

    Six different examples here:
    http://robdillon.com/flash.html

Maybe you are looking for

  • Here we go again...headphone jack prob

    Alright, so this isnt the first time i've had this problem. Last year in May 2005, i emailed creative about the notorious headhpone jack problem i've had in my zen micro, and they sent me a new one. But now, over a year later, this one they gave me i

  • Palm pilot IIIc

    hello i was wondering if you can help me out here i bought a second hand palm pilot IIIc model i lost my first one and i found my cradle and my software for that. i put the palm pilot on the cradle it doesn't seem to be charging at all now is that ba

  • Will Iphone 5s be compatible with Honda Accord HFL texting feature?

    The previous iphones does not support the Text/email function of Handa Accord 2013. Will the new update with iOs7 fix this issue?

  • Smart Card Middleware

    I'm trying to install a cherry smart card (CAC) reader on my iMAC G5 OSX 10.4.11. I have downloaded the driver but see that I need to install PCSC lite 1.1.1 of PCSC Framework before loading the driver. To load those middleware products I have to per

  • Invalid object access execption

    JBO-25036 an invalid object operation was invoked on type View Object with name <viewname> can somebody tell me what is the root cause for the exception. Some time its working fine and sometimes its giving the error. frequency level is approx. once i