Scrolling Game

I want to make a game that scrolls. I've made games before and I've had to use voids like checkMap() to find out where the user is and put him in the right place and all this boolean, int, void crap and I think it would be much easier if I could just make it so that the game scrolls instead of having to reload a new map. Heres what I want to do overall. Have one big map, that I created and just make it so that the user can walk around the map but still within the applet size 500/500.
Now my problem is more about the logic of the scrolling. I have no idea about how to approach this. But this is what I want
In the start of the game you are placed in front of your house which is the CENTER of the map. So lets say the player starts moving to the top of the applet which is where the school is. Now the school is not shown so the applet must scroll upward to show the school. Now at the top of the applet (before it scrolls) the Y position is 0. When it scrolls, WHAT IS THE Y POSITION NOW? Is it a negative number? How would I portray a negative number? And also how would I make the screen scroll upward. I mean thats really all I need to know because this is confusing to me.
Thanks for any help,
- Mimz

Mimz wrote:
I want to make a game that scrolls.By that, I assume you mean you want the "character" to stay in the center of the screen, and have the world move around him?
I've made games before and I've had to use voids like checkMap() to find out where the user is and put him in the right place and all this boolean, int, void crap and I think it would be much easier if I could just make it so that the game scrolls instead of having to reload a new map. No idea what you're saying here, but easier != better.
Heres what I want to do overall. Have one big map, that I created and just make it so that the user can walk around the map but still within the applet size 500/500. So move the background instead of the player.
Now my problem is more about the logic of the scrolling. I have no idea about how to approach this.Instead of moving the character up one, you move everything else down one. The logic should be basically the same, shouldn't it?
And also how would I make the screen scroll upward. I mean thats really all I need to know because this is confusing to me.How would you make the character scroll upward? Do that to everything else instead. What is so confusing about that?

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

  • I want to play an Elder Scrolls game on my iPad.  What's the next best thing?

    You know, like Morrowind, Oblivion, or Skyrim.  A full on rpg.  I would settle for something with a similar feel to it, a science fiction setting might even be ok.  If I can't play an Elder Scrolls game on my ipad, what's the next best thing?
    Thank you.

    A fair number of folks ask here for certain types of apps. In you search the app store you will get at least a couple that look like rpg games.  But the form factor is not real good.     Rage hd would give you a feel for  what tou and cannout get on tablet.   Pretty good graphics, pretty rough controls.

  • Creating a vertical scrolling game.

    I'm in a java class in high school and for our final we must create a video game. My game is a vert. scrolling plane fighting game like the old 1942 arcade game. I need some help w/ how to make the screen scroll and how to make the enemy planes appear from the top of the screen and move towards the bottom. Any help would be nice.

    You do not use scroll pane for that. Get a subimage of a long long image and incrementally call repaint(). That's all you should do. Prepare a special image where some length of the top-part is same as some length of the bottom-part. Then, incremental sub-image getting should work by wrapping around the long image. Use BufferedImage instead of Image. Or, this one uses multiple images drawing by incrementally changing their coords on the game panel: http://hp.vector.co.jp/authors/VA011187/java/poc98.html

  • Scroll game image memory

    i am making a game with scrolling background. I am using a tiled background.
    in  actionscript I was going to hide background objects off the screen but  this cause memory to still be taken up by the hidden images so what do i do?
    the scrolling background isnt repeating so i could have 4-5 screens of image tiles off screen and made invisible until required.

    If your problem is memory you could youse the child method. Only adding the background when its being used.
    addChildAt(image, , 0);
    And before you add the next image remove the current image.
    removeChildAt(image, 0);
    to better keep track of the images you should add them to a sprite and simply put the sprite name before "addChild" function.
    var container:Sprite = new Sprite;
    container.addChildAt(image, 0);

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

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

  • The Elder Scrolls Online Wallpaper Contest

    ***Winner Announce***
    Thanks for all of your submissions to The Elder Scrolls Online Wallpaper Contest.
    Four lucky designers have been chosen for their creativity, Your four winners are as follows:
    Grand Price: MSI X99S GAMING 9 AC Motherboard
    Lo Relyn
    Creative Awards: MSI X99S GAMING 7 Motherboard
    Sam Nicko
    Bonus Prize: The Elder Scrolls Online Imperial Edition
    John Nakazato
    Joseph A. Fakhry
    And also, the following winners are for the bonus prize “The Elder Scrolls game codes”
    (Each of you will receive two game codes):
    Andrea Ristic
    Diyan Tuban
    Eduardo Veldi
    Errol Gonzaga
    Edmar L Reb
    Hachi Roku
    Jasper John S. Cecilio
    Nikolaos Daniilidis
    Pandu Ihsan Pondel
    Raymond Morales
    Winners must private message (PM) the admin of our MSI Fan Club their details within 7 days of the announcement of the winner’s list. The details needed are: Full Name, Address, E-Mail, and Contact Number. If the details are not pm-ed to the admin within the 7 days, the winners will be disqualified.
    [/b]
    =========================================================================
    Keen photographers, illustrators and graphics ninjas amongst you now have the chance to join the "The Elder Scrolls Online" Wallpaper Contest and get chance to win the MSI X99s Gaming Series Motherboards!
    Join the Contest at: http://woobox.com/o8puby
    As an open content, anyone can take part in the “The Elder Strolls Online” wallpaper contest. You don’t have to be an award winning photographer or degree-laden illustrator to take part. All that’s needed is creativity and the know-how to be able to put it into pixels.
    ***Prize Pool***
    Grand Prize: MSI X99S GAMING 9 AC Motherboard *1
    Creative Awards: MSI X99S GAMING 7 Motherboard *1
    ***Bonus Prize***
    The Elder Scrolls Online Imperial Edition *2
    (For the bonus prize, you have to using the MSI Dragon Shield Logo and MSI X99S GAMING 7 image.)
    ***Evaluation/Winning Criteria***
    Creativity: 60%
    Votes: 40%
    ***Contest Rules***
    1.   The theme for this contest is “The Elder Scrolls Online”.
    2.   Your wallpaper must be submitted in a standard desktop resolution. Accepted resolutions is 1920x1080, image size shouldn’t exceed 2 MB.
    3.   The wallpaper must include the MSI Logo, and also the The Elder Scrolls Online logo.
    4.   The file type can be JPEG or PNG.
    5.   For the bonus prize, you have to using the MSI Dragon Shield Logo and MSI X99S GAMING 7 image.
    6.   By submitting your wallpaper entry to this contest you give MSI the right to use/upload/print
    any wallpaper entries for marketing activities during or after this contest.
    7.   Any copyright infringement or piracy is absolutely forbidden. Your designs should be just that – your own designs!
    You can use the image from game, hand-drawing, or from the Website:
    http://www.elderscrollsonline.com/en-us/media/wallpapers
    Also, you can download the logo/product image files at:
    MSI Logo (white)http://goo.gl/UpBkBN
    MSI Gaming Logo http://goo.gl/TyBcnq
    MSI X99S GAMING 7(1) http://goo.gl/o1l6ss
    MSI X99S GAMING 7(2) http://goo.gl/bYn4DF
    MSI X99S GAMING 7(3) http://goo.gl/3I3GjP
    The Elder Scrolls Online Logo http://goo.gl/FxAgUg

    2014/9/18 update
    Haven't join this contest? join it now! http://woobox.com/o8puby
    and also share your wallpaper to your friends!
    Created by: Jasper C.
    Created by: Joseph F.
    Created by:  Løs B.
    Created by: Nils P.
    Created by: Edmar R.
    Created by: Geoff G.
    Created by: George A.
    Created by: Hachi R.
    Created by: Jasper C.
    Created by: Michael P.
    Created by: Raymond M.
    Created by: Raymond M.
    Created by:  Sam N.
    Created by: Yusuf H.
    Created by:  一条の光

  • Need help on setting up the strucute for a SideScrolling game

    I am using the tile approach and put the objects in a 2D array. For objects that move and interact with the chracters beyond just being there I have a list. The first group of Objects are called bricks and the second is World Objects. Bricks' locations are confined to the grid, but worldObjects' locations aren't. In the levelcreator I''ve made for the game you can select a brick and place it down and select a worldObject and place it down on the grid. I was wondering how I should make it so worldObject's aren't confined to the grid in the levelcreator. I've also made it so the levlecreator is zoomed out more than in the game. The grid consists of 75x75 tiles in the game and 50x50 tiles in the levelcreator. To switch from the levelcreator to the game I simply multiply by 1.5. Any suggestions. Or should I make it so All objects lie on the grid? Thanks. Any questions just post them here

    make the world objects totally independent of the grid while the bricks be dependent on it. have the world objects in a list with their positions stored in the object itself. When your doing, say, collision checking with bricks, just take their positions and see if the cell it occupies has a brick in it.
    personally i won't use a 2d array for a side scrolling game, the level tends to be rather large and a giant 2d array wastes annoying amounts of memory.

  • Sidescrolling game help

    Now, I'm not sure if this is in the right section..
    But I'm working on a videogame, and I'm newish to Flash. I found out that you can import .gifs to the stage, and now what I want to do is make it so you can move it side to side with the arrow keys. And I can do it fine with a single frame, something that doesn't move, but obviously I need the sprites to make a walking motion.
    So I went through the steps I'd go through with a non-gif, and it... would move for a bit, but then snap back to the beginning. I can post it if anyone needs it.
    Thankyou for your help in advance.

    make the world objects totally independent of the grid while the bricks be dependent on it. have the world objects in a list with their positions stored in the object itself. When your doing, say, collision checking with bricks, just take their positions and see if the cell it occupies has a brick in it.
    personally i won't use a 2d array for a side scrolling game, the level tends to be rather large and a giant 2d array wastes annoying amounts of memory.

  • Mhp games

    Hi
    I'm approaching game development under MHP...
    till now I have been developing some prototypes using emulators such as xletview... I'm going to get a developer set top box (what would you suggest? ADB? there is a specific model better than another to make tests?)
    I don't see any problems coding games with no 'hard' animations and real time interaction... but many questions arise when I come to think to games even simple as a snake or a pacman.
    I can see two main problems:
    - remote control response time: can I assume that response time can be sufficient to deal with real time interaction games? some decoder may be suitable and others not?
    - graphics capabilities: can I assume that the decoder will have a resonable screen refresh? are there problems using time threads to control animations?
    someone told me: 'forget about scrolling game'. Is there a reason for this? If I have a good refresh rate, why should I forget this type of games? memory or graphics problems?
    Coding games I were used to use double buffering... on an MHP game double buffering is not useful?
    thanks.
    bye
    Virtual Mad

    This is a game named "Nova"?
    Where are you downloading it from?
    Detailed questions from you would be helpful, rather than just one line statements.
    1. If any post helps you please click the below the post(s) that helped you.
    2. Please resolve your thread by marking the post "Solution?" which solved it for you!
    3. Install free BlackBerry Protect today for backups of contacts and data.
    4. Guide to Unlocking your BlackBerry & Unlock Codes
    Join our BBM Channels (Beta)
    BlackBerry Support Forums Channel
    PIN: C0001B7B4   Display/Scan Bar Code
    Knowledge Base Updates
    PIN: C0005A9AA   Display/Scan Bar Code

  • Tumiki fighters PKGBUILD - help! [solved]

    This is my first PKGBUILD and I'm having a bit of trouble with it as this is a binary app, so no need to compile.  It's in the D programming language so it would have to use a non-open-source compiler anyways.  Of course, I should mention again which app it is - tumiki fighters, a 2D side-scrolling game.  This PKGBUILD isn't done yet, but I have a couple of problems I'd like to figure out.
    First, here's the PKGBUILD:
    arch=(i686)
    pkgname=tumiki
    pkgver=0.2c
    pkgrel=1
    pkgdesc="An addictive game where you salvage parts from your enemies to become stronger"
    depends=('mesa' 'sdl' 'sdl_mixer')
    source=(http://prdownloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.gz)
    md5sums=('afb4476b9556fff4d18db124b20141a9')
    build () {
    # cd $startdir/src/tf
    mkdir -p $startdir/pkg/usr/bin
    cp -r $startdir/src/tf $startdir/pkg/usr/tumiki
    # mv $startdir/pkg/usr/tumiki/tf $startdir/pkg/usr/bin/tumiki
    # ln -sf /usr/tumiki/tf $startdir/pkg/usr/bin/tumiki
    This results in the files simply being copied into the /usr/tumiki folder (subject to change in the future).  The app will not run at first but if I change the ownership of the dir and the binary (named tf), it runs.  Strangely enough, if I run the app once after this I can then copy it to /usr/bin/tumiki and it will run fine, but if I tell it to move or copy it over during the installation no matter what ownership specified it will not run properly, giving me an error about being unable to find a file within the /usr/tumiki dir - presumably it's trying to find it starting at the startdir, in this case /usr/bin/, and failing.  Creating a symbolic link doesn't work, either.
    The gentoo package has some install settings I'm unfamiliar with and has a script added, link here: http://bugs.gentoo.org/show_bug.cgi?id=80435 .  I'm not sure what I can do with them exactly, though, as I don't read ebuild-ese and the ebuild howto isn't helping with some of the variables invoked.
    Thanks for any help!
    Nick
    Edit: Problem solved, just tweaked stuff around and used the gentoo script.
    Last edited by Shirakawasuna (2007-05-07 07:19:13)

    There are different ways to do it, but you can just replace all the $pkgver references with 2.6-4004 directly.  Change the 2 lines that originally called $pkgver to this:
    source=(http://ardour.org/files/releases/${pkgname}-2.6-4004.tar.bz2 \
    cd ${startdir}/src/${pkgname}-2.6-4004
    Last edited by creslin (2008-10-24 16:04:07)

  • CopyPixles() performance: bug or feature ?

    As anyone who has tried, knows that the performance of copyPixels/Blitting is unacceptably slow under the current version of PFI, which is a shame as most high-end flash games use blitting for their rendering.
    However its not clear if this is a Bug, that can be expected to be fixed in the next version, as the current one out is still a 'preview 2' not a final, or a permanent feature of how the PFI conversion will impact projects in all future versions as well.
    I have my doubts, as i *Think* its NOT actually copyPixels() thats causing the problem, as in my test if our game is getting about 7FPS with about 150 copyPixels() operations per frame.
    When I've cut that down to 15 copyPixels/frame, its still only 8FPS! I think its actually the fact that we have a new 480x320 BitmapData filled every frame and uploaded to the GPU/stored in the Memory. So even if just a blank 'canvas' bitmapdata gets filled with a flat color it could be the same.
    I tried setting the export to CPU, and even explicitly setting the bitmapdata/Movieclip to cacheAsBitmap = false but it didn't improve the performance.
    So my question is obvious, is this  a 'normal' behavior? Or should we expect this to be fixed in the next version?
    I can imagine either way, as an architecture that relies on the GPU and assumes 3D applications might work differently to a PC, as in a 3D application you dont typically create/fill a new 480x320 Texture/Bitmapdata each frame, but have a singe set that you cache initially and never add anything new to that.
    Any Ideas ?
    Martin

    Colin: you are welcome to test, This is pasted into an FLA's first frame set to 30FPS. Some of the sections are commented out, you can enable them to test different aspects. I also recommend testing both CPU and GPU.
    The time Delta is calculated in both cases the same way
    and you will see a that the Timer class uses a LOT of CPU. Where as if you use ENTER_FRAME you will get better performance
                // Initial Variables
                var gameTimer:Timer;
                // FPS and Debug Variables
                var FPS :int = 30;
                var _lastTimeUpdated:int;
                var fpstextField:TextField;
                var memoryField:TextField;
                // display Object
                var _canvasBD:BitmapData;
                var _canvasBitmap:Bitmap;
                _canvasBD = new BitmapData(480,320,false,0x06b111);
                _canvasBitmap = new Bitmap(_canvasBD);
                addChild(_canvasBitmap)
                // Performance Monitoring text fields
                var debugLayer:Sprite;
                debugLayer = new  Sprite();
                addChild(debugLayer);
                fpstextField = new TextField()
                memoryField= new TextField()
                debugLayer.addChild(fpstextField);   
                debugLayer.addChild(memoryField);
                memoryField.textColor = 0xFF00CC;
                fpstextField.textColor = 0xFF00CC;
                fpstextField.width = 100;
                memoryField.width = 100;   
                memoryField.y = 75;
                fpstextField.y = 55;
                // Start Gameloop
                 gameTimer=new Timer(1000 / FPS);   
                _lastTimeUpdated = getTimer();  
                gameTimer.start();
                gameTimer.addEventListener(TimerEvent.TIMER, render, false, 0, true);
                 // If you use Enter Frame performance will be better
                //this.addEventListener(Event.ENTER_FRAME, render, false, 0, true);
    function render(e:TimerEvent):void  // e:Event):void // use this for ENTER_FRAME
    {    //trace("runing");
            // Render a flat color into a Bitmap. You can comment this out, so there is nothing on stage,
            // and still see poor performance when the timer is running
            var bitmapRect: Rectangle = new Rectangle (0, 0, 480, 320);
            _canvasBD.fillRect(bitmapRect, 0x06b111);
            // Calculate FPS and memory usage
            var currentTime:int = getTimer();
            var timeDeltaInSeconds:Number = (currentTime - _lastTimeUpdated) / 1000; 
            _lastTimeUpdated = currentTime;  
            var actualFPS:Number =  Math.round (1 / timeDeltaInSeconds );
            fpstextField.text = "FPS: " + actualFPS + " / " +  FPS;
            memoryField.text = "mem: " + Math.floor(System.totalMemory / (1024 * 1024) * 100) / 100;
        // Have an optional 2nd timer that does nothing other than running, to see performance degrade even further
        //var gameTimer2:Timer;
        //gameTimer2=new Timer(1000 / FPS);   
        //gameTimer2.start();
        //gameTimer2.addEventListener(TimerEvent.TIMER, doNothing, false, 0, true)
    //function doNothing(e:TimerEvent):void
    //{    //trace("run");
            // Render a flat color
    - This above does about 15 FPS, jumping to 29FPS. Its weird even if you disable the rendering the green block, it will still be bad, suggesting that its actually the timer that causes the performance problems
    In my book 24FPS is poor for a scrolling game, 30FPS+ is the minimum for something commercially acceptable ... You've seen the Unreal video I posted in the other thread, noone is going to tell me that if That is possible at 30FPS, then 24FPS ( in fact a lot less ), is the max Iphone 4 can do.

  • No battery display , Wont save settings , Tech Please help

    Firstly My Ipod nano 2GB is working really fine .
    One day it wouldn't turn on , So i plug it into my USB/SYNC cable and its ON .
    After disconnecting it , I realized there was no
    1. No battery display
    2. No sound from the 3.5mm jack
    3. Everytime i reset , The language menu pops out .
    So i did restore , reinstall my softwares , Update , Downdate , reset , drain the battery , yet still the same .
    Everything is working fine , with display & stuff
    Scrolling , Games , clicks , Music playing , But problem 1,2 & 3 persists
    Ipod nano 2GB   Windows XP Pro  

    you did the restore with the iPod Updater?
    and it compleated??
    If yes you need iPod service you need to send your iPod in.
    How old isit maybe you can take it back to the shop.

Maybe you are looking for