Help with game

hi, im trying to make my first complex program involving applets, which is to be some take on pong. What ive been doing so far is messing with different types of input and movement in a test program called "RectRun"
i decided that im going to use the mouse wheel as the input for the moving of the paddle up and down. what im attempting to do is have the paddle "drift" almost as if it is moving on ice, which i have accomplished, but the problem is that further input from the mouse wheel will not be executed until the loop that makes it drift has completed (i hope that makes sense). so basically what i need to do is break out of the loop when a new input is received from the mouse wheel being turned, but i dont know how to tell when a new input is recieved. here is my code for RectRun so you can run it yourselves and see how the rectangle behaves because it is hard to describe :p
import java.awt.Graphics;
import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.applet.*;
public class RectApp extends Applet implements MouseWheelListener
     private int x, y, prevy, pause, changeFactor;
     public final int WIDTH = 10, HEIGHT = 45;
     Graphics g;
    public void init()
        x = 10;
        y = 50;
        prevy = 0;
        changeFactor = 0;
        wait = new Thread();
        wait.start();
        addMouseWheelListener(this);
        setBackground(Color.BLACK);
        g = getGraphics();
     public void mouseWheelMoved(MouseWheelEvent e)
         int notches = e.getWheelRotation();
         if(notches < 0)
              for(pause = 0; pause < 100; pause += 10)
                        try{ wait.sleep(pause);} catch( InterruptedException i ){}
                        prevy = y;
                        y -= 3;
                        paint(g);
         else
              for(pause = 0; pause < 100; pause += 10)
                        try{ wait.sleep(pause);} catch( InterruptedException i ){}
                        prevy = y;
                        y += 3;
                        paint(g);
    public void paint(Graphics g)
        g.setColor(Color.GREEN);
        g.clearRect(x,prevy,WIDTH+1,HEIGHT+1);
         g.drawRect(x,y,WIDTH, HEIGHT);
         g.drawRect(0,0,499,299);
            g.drawRect(1,1,497,297);
            g.drawLine(250,0,250,300);
       public boolean isFocusTraversable() {return true;}
}Edited by: adg12012 on May 8, 2008 1:20 PM

adg12012 wrote:
the reason i had to do the paint(g) as opposed to repaint is because inside the loop, repaint() wouldn't execute.[http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Component.html#repaint()]
As this documentation states, repaint() simply tries to call paint() at the next possible opportunity. I believe this comes in adding an event to AWT's event queue to trigger the repaint.
The trouble is, you are looping on the same thread as the event queue processing thread. Which means, the thread will only get back to processing events after your time-intensive loop has finished. In other words, the repaint event can't be processed until you give control back to the event queue processor, i.e. finish your actionListener code.
If you ever want to do time-intensive operations in a GUI application, you pretty much always want to do them on a separate thread, or your GUI will not respond until the operation is complete. Take, for example, Windows' File Explorer window. You know how frustrating it is when you click on a Network share, or a Floppy drive, when the destination doesn't exist? How the window freezes for like 2 minutes trying to establish the connection? That's because that particular application tries to find the target (a time-intensive operation) on the same thread that is driving the GUI.

Similar Messages

  • Can anyone help with game center I cannot accept or request friends

    Hi can anyone help with sorting this problem out, I cannot accept or request friends via game center, Any help would be much appreciated. I get request and when I click on accept friends, nothing happens, when I go to game center it says no friends.

    Thanks Martin. I'm waiting to hear back but I believe he has the Vixia HF S10 or S11. It's a flash-drive HD camcorder. I have heard that the lousy software that comes with the Canon's for windows forced the clips to downsample. I'm going to try to Log and Capture directly from him camcorder. The (canon) device only has a USB port and I didn't think USB worked on macs for video.
    My video clips are 1920x1080 AIC, @29.97 fps.
    His clips are 720x404 mpeg2 muxed. It doesn't tell me anything else.
    In MPEG Streamclip, I can export to the same specs but in FCE it still makes me re-render the clips for some reason. very time consuming...

  • Ipod nano help with games!

    hello, i have the new nano. and i was wondering if it is possible to put games on it. are there games on itunes i can download and put onto my new ipod nano (i dont know what generation it is, it is the one that has the motion sensitivity and genius feature) i saw in the comercial that a car game was being used with the motion sensor. thanks.

    do you know what that game was? (the one that uses the motion sensor feature) because though that post was very helpful, i was wondering if there are games that use the motion sensor feature.

  • Help with Game Display structure and adding independant objects

    I'd like to do two things and I'm not sure how to set up the code.
    1) Add 1 to n enemies that think and move on their own. Basically their own threaded life I think.
    2) Add 1 to n weapons fire that when the thread is finished apply the damage.
    Currently I'm only using Graphics2d to draw everything to an off screen image. The issue I have is that most of the individual object stuff is wrapped up in the main game loop rather than added to the object itself.
    Here is my current working pseudo code: I have this working but seems like I need to make it more flexible. Just not sure how.
    public class combatDisplay extends JPanel{
    @Override
    protected void paintComponent(Graphics g){
         creates Graphics2d offScreenImage
         wipeClean offScreenImage
         drawPlayers 0 to n
         drawSpaceShip 0 to n --> drawMe(offScreenImage);
         drawWeaponShots 0 to n
         drawExplosions 0 to n
         draw offScreenImage to panel
    public void setPlayers (ArrayList al) {}
    public void setObjects (ArrayList al) {}
    public void setSpaceShips (ArrayList al) {}
    public void setWeaponShots (ArrayList al) {}
    public void setExplosions (ArrayList al) {}
    class Spaceship{
         Point location
         Polygon shape
    public void drawMe (BufferedImage bf){
         draw Polygon
    class WeaponShot{
         Point location
         Polygon shape
    public void drawMe (BufferedImage bf){
         draw Polygon
    class GameLogicLoop {
         movePlayer
         moveEnemies
         fireWeapons
            applyDamage
    }It seems like I should just spawn an enemy thread that checks its own ranges and does its own movements. But I'm not sure how to get that to display the offscreen image. Can an arraylist hold a thread?
    Likewise, with the weapons fire.... it should be self contained to check hit, display itself, display explosion or hit, then apply damage to its target when animation is completed. These two seem like a similar code structure I'm just not sure how to set it up yet.
    Any psuedocode would be helpful.

    Morgalr,
    Awesome responses thanks. Normally I don't code so it is an interesting (read hard) learning curve for me. Usually I just design and hire someone smarter than me to code.
    If you don't mind taking a look, I tried reworking everything toward the approach we have been discussing. If you see anything glaring and troublesome, please yell.
    Ship Class is its own thread that can paint itself. Basically it is a sitting ship.
    DisplayPane is the image painting class.
    loopGame tells the objects when to paint and passes the image reference around.
    package controller;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Point;
    import java.awt.Polygon;
    import java.awt.image.BufferedImage;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class Controller extends JFrame {
        DisplayPane pane;
        Ship satallite;
       public Controller(){
            setTitle("Controller");
            setBounds(0,0, 400, 400);
            setLayout(null);  //absolute position
            setResizable(false);
            pane = new DisplayPane(getBounds().width, getBounds().height);       
            add(pane);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            setLocationRelativeTo(null);
            setVisible(true);
       class DisplayPane extends JPanel{
           BufferedImage offImage;
           public DisplayPane(int width, int height){
               offImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
               setBounds(0, 0, width, height);
           @Override
           protected void paintComponent(Graphics g){
                g.drawImage(offImage,0,0,this);
           public BufferedImage getImage(){
               return offImage;
           public void setImage(BufferedImage tempImage){
               offImage = tempImage;
           public void wipeImage(){
                Graphics2D big = offImage.createGraphics();
                big.setColor(Color.BLACK);
                big.fillRect(0, 0, getBounds().width, getBounds().height);
       class Ship implements Runnable{
           Thread thread;
           int speedStep;
           boolean bAlive = true;
           Point point = new Point(0,0);
           public Ship(String shipName, int speed){
               thread = new Thread(this, shipName);
               speedStep = speed;
               point.x = (int) ((int) 300 * Math.random());
               point.y = (int) ((int) 300 * Math.random());
           public void start(){
               thread.start();
           public void kill(){
               bAlive = false;
           public void drawShip(BufferedImage tempImage){
                Graphics2D big = tempImage.createGraphics();
                int[] pXfrigate = {point.x, point.x-4, point.x-4, point.x+4, point.x+4};
                int[] pYfrigate = {point.y, point.y+7, point.y+17, point.y+17, point.y+7};
                Polygon frigateShape = new Polygon(pXfrigate, pYfrigate, 5);
                Polygon currentShip = frigateShape;
                big.setColor(Color.GRAY);
                big.fillPolygon(currentShip);
                big.setColor(Color.RED);
                big.drawPolygon(currentShip);
           public void run() {
               int delay = 500;
               while (bAlive){
                   try{
                       System.out.println(thread.getName()+" x: "+point.x+" y: "+point.y);
                       Thread.currentThread().sleep(delay);
                   }catch (Exception e){}
       public void loopGame(){
            satallite = new Ship("Dot", 0);
            satallite.start();
            while (isVisible()){
                pane.wipeImage();           
                satallite.drawShip(pane.getImage());
                pane.repaint();
                try{
                    Thread.sleep(0);
                }catch (Exception e){}
                satallite.kill();           
            System.exit(0);
       public static void main(String[] args) {
            Controller control = new Controller();
            control.loopGame();
    }

  • Need help with game program in java

    Ok this is my first post and I have no idea what I'm doing for this assignment. Basically I have to construct a game with two subclasses for the player class. These two subclasses have to be able to perform different methods and act from what i understand opposite of each other. If I can get help on how to start it and how I should go about this would be great.
    The actual directions and code that I have so far is on the links below.
    Thanks again.
    directions
    Assignment

    Create a class caller Player. Then create two different classes that inherit from player. One called Team1Player and the other called Team2Player. To the Player class, add firstName and lastName varaibles. Add setFirstName,setLastName, getFirstName,getLastName (both team1 and team2 players have first and last names, therefore it goes into the base class 'Player'). Any other functions common to both player1 and player1 goes also into the Player class so they are inherited. Functions unique to player 1 or player 2 goes into those classes respectfully. The rest of your assignment is up to you to code. If you don't understand something, try to skip over it and come back to it later. Developers often rewrite their code over and over as they realize more requirements (better developers beat the requirements out of the customer first ;)

  • New mac mini user needs help with games!!!!

    We have a mac mini with osx 10.4.5 we have some older games that are compatible with Mac and say for 7.5 or higher but when we try to play them it says not supported on this system. Can any one help us out?
    Thanks!!!!

    Is it an Intel Mini, or a G4 ??
    Mac OS X is completely different from OS 9 and the previous versions of the Mac OS. While OS 9 can run OS 7 apps, OS X will not. However, you can install a copy of OS 9 on your drive, and although you cannot boot directly in OS 9, you can run OS 9 apps from within OS X through an application called Classic. That is, assuming your have a PowerPC Mini, as new Macintels don't support Classic anymore.

  • I need some help with Game Center and saving games to it

    I was playing the new app called clumsy ninja on my iPad. I had gotten pretty far an decided it would also be fun to be able to play from my iPhone. My I phone was already logged on to Game Center, but my iPad wasn't. So when I logged no to Game Center from my iPad, it had saved my level one game from my iPhone, I was all the way on level twenty four on my iPad. I tried to undo it but every time I opened up the app it was my level one game from my iPhone. I really need help. What should I do?

    That's weird I just noticed that if I change the Screen Saver selection, that I have to check then uncheck the (Main screen only) box to reset the preference before it works. Even weirder I also noticed that for some screen saver selections the iMac display and TV show different photos that both change an the same time.

  • Help with games

    I want to play a windows game o my macbook. is there any way to do this??

    yeah try using it on windows with paralels its a free download by the way but you need the windows CD as far as I know

  • Help with games and graphics

    AMD athlon 64 X2 Dual-core processor 3600+
    RAM-512mb
    Operating system-win xp
    motherboard-msi-k9ngm
    Nvidia geforce 6100
    have directx 9.0 c .Have all the latest drivers.
    Games like RTCW-behind enemy lines,FIFA-2005,Empire Earth-2,HALO etc cant be run...
    The images i get when i run these games are absolutely scrambled..Nothing can be
    made out..I have tried all kinds of drivers and also changing settings but nothing has worked..Games like aoe-2 and diablo-2 did run tho...cs works in software mode but not in opengl...
    Can somebody out there plez help me...

    hello, welcome to forum.
    onboard VGA provide basic/limited gameplay. if you want to game install external PCI-E VGA.
    install chipset drivers: http://download.msi.com.tw/support/dvr_exe/mbd_dvr/NV61xx-Chipset_8.26_2kxp_WHQL.zip
    reboot
    install latest DirectX: https://forum-en.msi.com/index.php?topic=105196.0
    install VGA Drivers: http://download.msi.com.tw/support/dvr_exe/mbd_dvr/C51_WinXP2K2003_8205.zip
    reboot
    install Dual Core HotFix V4 --> https://forum-en.msi.com/index.php?topic=103843.0
    reboot
    install Dual Core Optimizer --> http://www.amd.com/us-en/assets/content_type/utilities/Setup.exe
    reboot
    re-test

  • Help with Game boy Advance emulator VBA

    So i got Visiual boy advance form the AUR. Had to gat some dependencies so I got. I makepkg VBA then install it. WHen I try to run I get this
    [generic@ArchLinux ~]$ gvbam
    Failed to open audio: Fragment size must be a power of two
    Segmentation fault
    Which I really don't understand what that means at all. My audio works fine too. I was listening to a song while doing this. So help please? Thanks.
    Last edited by generic_ (2009-01-10 13:14:48)

    Wait I still need help! For some reason After I booted up this moring it would'nt work. I got the same problem I tried reinstalling and nothing happened. I dug deeper and found the problem.
    (gdb) run
    Starting program: /usr/bin/gvbam
    (no debugging symbols found)
    (no debugging symbols found)
    (no debugging symbols found)
    (no debugging symbols found)
    [Thread debugging using libthread_db enabled]
    [New Thread 0xb6bc0710 (LWP 6927)]
    [New Thread 0xb6af7b90 (LWP 6930)]
    Failed to open audio: Fragment size must be a power of two
    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 0xb6bc0710 (LWP 6927)]
    0xb72264f0 in pthread_mutex_lock () from /lib/libpthread.so.0
    (gdb) bt
    #0 0xb72264f0 in pthread_mutex_lock () from /lib/libpthread.so.0
    #1 0xb72925a1 in SDL_mutexP () from /usr/lib/libSDL-1.2.so.0
    #2 0x080a233c in SoundSDL::~SoundSDL ()
    #3 0x08149808 in soundShutdown ()
    #4 0x080903e2 in VBA::Window::~Window ()
    #5 0x08073317 in main ()
    (gdb)
    So i guess The problem is hear  "from /usr/lib/libSDL-1.2.so.0" or here from "/lib/libpthread.so.0" whats SDL? Whats libpthread? What do i do?
    EDIT: I did some research and I dont think its sdl i tried to reinstall it anyway and no luck and Libpthread seems knod of important. Im pretty sure that this is the problem
    #0 0xb72264f0 in pthread_mutex_lock () from /lib/libpthread.so.0
    Last edited by generic_ (2009-01-10 13:29:50)

  • Help with game menu code

    Sorry if I look like a novice cause I am, I'm doing project in college can't get code to work
    C:\WTK22\apps\SpaceAsteroids3MIDlet\src\AboutScreen.java:22: cannot resolve symbol
    symbol : method MainMenuScreenShow ()
    location: class SpaceAsteroids3MIDlet
         midlet.MainMenuScreenShow();
    suppose you need source code
    import javax.microedition.lcdui.*;
    public class AboutScreen extends Form implements CommandListener
    private SpaceAsteroids3MIDlet midlet;
    private Command backCommand = new Command("Back", Command.BACK, 1);
    public AboutScreen (SpaceAsteroids3MIDlet midlet)
    super("About");
    this.midlet = midlet;
    StringItem stringItem = new StringItem(null,"Space Invaders\nVersion 1.0.0\nby Pauric Murphy");
    append(stringItem);
    addCommand(backCommand);
    setCommandListener(this);
    public void commandAction(Command c, Displayable d)
    if (c == backCommand)
         midlet.MainMenuScreenShow();
         return;
    here is the error it says on this page

    MIDlet file here too
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    public class SpaceAsteroids3MIDlet extends MIDlet
    protected Display display;
    private Image introLogo;
    private boolean isIntro = true;
    MainMenuScreen mainMenuScreen;
    public SpaceAsteroids3MIDlet()
    public void startApp()
    display = Display.getDisplay(this);
    mainMenuScreen = new MainMenuScreen(this);
    if(isIntro)
         isIntro = false;
         try
         introLogo = Image.createImage("/intro.png");
         new IntroScreen(display, mainMenuScreen, introLogo,5000);
         } catch(Exception ex)
         mainMenuScreenShow(null);
    } else
         mainMenuScreenShow(null);
    public Display getDisplay()
    return display;
    public void pauseApp()
    public void destroyApp(boolean unconditional)
    System.gc();
    notifyDestroyed();
    private Image createImage(String filename)
    Image image = null;
    try
         image = Image.createImage(filename);
    } catch (Exception e)
    return image;
    public void mainMenuScreenShow(Alert alert)
    if (alert==null)
         display.setCurrent(mainMenuScreen);
    else
         display.setCurrent(alert,mainMenuScreen);
    public void mainMenuScreenQuit()
    destroyApp(true);
    }

  • I need help with shooting in my flash game for University

    Hi there
    Ive tried to make my tank in my game shoot, all the code that is there works but when i push space to shoot which is my shooting key it does not shoot I really need help with this and I would appriciate anyone that could help
    listed below should be the correct code
    //checking if the space bar is pressed and shooting is allowed
    if(evt.keyCode == 32 && shootAllow){
        //making it so the user can't shoot for a bit
        shootAllow = false;
        //declaring a variable to be a new Bullet
        var newBullet:Bullet = new Bullet();
        //changing the bullet's coordinates
        newBullet.y = tank_mc.y + tank_mc.width/2 - newBullet.width/2;
        newBullet.x = tank_mc.x;
        //then we add the bullet to stage
        addChild(newBullet);
    listed below is my entire code
    import flash.display.MovieClip;
        //declare varibles to create mines
    //how much time before allowed to shoot again
    var cTime:int = 0;
    //the time it has to reach in order to be allowed to shoot (in frames)
    var cLimit:int = 12;
    //whether or not the user is allowed to shoot
    var shootAllow:Boolean = true;
    var minesInGame:uint;
    var mineMaker:Timer;
    var cursor:MovieClip;
    var index:int=0;
    var tankMine_mc:MovieClip;
    var antiTankmine_mc:MovieClip;
    var maxHP:int = 100;
    var currentHP:int = maxHP;
    var percentHP:Number = currentHP / maxHP;
    function initialiseMine():void
        minesInGame = 15;
        //create a timer fires every second
        mineMaker = new Timer(6000, minesInGame);
        //tell timer to listen for Timer event
        mineMaker.addEventListener(TimerEvent.TIMER, createMine);
        //start the timer
        mineMaker.start();
    function createMine(event:TimerEvent):void
    //var tankMine_mc:MovieClip;
    //create a new instance of tankMine
    tankMine_mc = new Mine();
    //set the x and y axis
    tankMine_mc.y = 513;
    tankMine_mc.x = 1080;
    // adds mines to stage
    addChild(tankMine_mc);
    tankMine_mc.addEventListener(Event.ENTER_FRAME, moveHorizontal);
    function moveHorizontal(evt:Event):void{
        evt.target.x -= Math.random()*5;
        if (evt.target.x >= stage.stageWidth)
            evt.target.removeEventListener(Event.ENTER_FRAME, moveHorizontal);
            removeChild(DisplayObject(evt.target));
    initialiseMine();
        //declare varibles to create mines
    var atmInGame:uint;
    var atmMaker:Timer;
    function initialiseAtm():void
        atmInGame = 15;
        //create a timer fires every second
        atmMaker = new Timer(8000, minesInGame);
        //tell timer to listen for Timer event
        atmMaker.addEventListener(TimerEvent.TIMER, createAtm);
        //start the timer
        atmMaker.start();
    function createAtm(event:TimerEvent):void
    //var antiTankmine_mc
    //create a new instance of tankMine
    antiTankmine_mc = new Atm();
    //set the x and y axis
    antiTankmine_mc.y = 473;
    antiTankmine_mc.x = 1080;
    // adds mines to stage
    addChild(antiTankmine_mc);
    antiTankmine_mc.addEventListener(Event.ENTER_FRAME, moveHorizontal);
    function moveHorizontal_2(evt:Event):void{
        evt.target.x -= Math.random()*10;
        if (evt.target.x >= stage.stageWidth)
            evt.target.removeEventListener(Event.ENTER_FRAME, moveHorizontal);
            removeChild(DisplayObject(evt.target));
    initialiseAtm();
    function moveForward():void{
        bg_mc.x -=10;
    function moveBackward():void{
        bg_mc.x +=10;
    var tank_mc:Tank;
    // create a new Tank and put it into the variable
    // tank_mc
    tank_mc= new Tank;
    // set the location ( x and y) of tank_mc
    tank_mc.x=0;
    tank_mc.y=375;
    // show the tank_mc on the stage.
    addChild(tank_mc);
    stage.addEventListener(KeyboardEvent.KEY_DOWN, onMovementKeys);
    //creates the movement
    function onMovementKeys(evt:KeyboardEvent):void
        //makes the tank move by 10 pixels right
        if (evt.keyCode==Keyboard.D)
        tank_mc.x+=5;
    //makes the tank move by 10 pixels left
    if (evt.keyCode==Keyboard.A)
    tank_mc.x-=5
    //checking if the space bar is pressed and shooting is allowed
    if(evt.keyCode == 32 && shootAllow){
        //making it so the user can't shoot for a bit
        shootAllow = false;
        //declaring a variable to be a new Bullet
        var newBullet:Bullet = new Bullet();
        //changing the bullet's coordinates
        newBullet.y = tank_mc.y + tank_mc.width/2 - newBullet.width/2;
        newBullet.x = tank_mc.x;
        //then we add the bullet to stage
        addChild(newBullet);
    if (tank_mc.hitTestObject(antiTankmine_mc))
            //tank_mc.gotoAndPlay("hit");
            currentHP -= 10;
            // remove anti tank mine
            removeChild(antiTankmine_mc);
    if (tank_mc.hitTestObject(tankMine_mc))
            //tank_mc.gotoAndPlay("hit");
            currentHP -= 10;
            // remove anti tank mine
            removeChild(tankMine_mc);
        //var maxHP:int = 100;
    //var currentHP:int = maxHP;
    //var percentHP:Number = currentHP / maxHP;
        //Incrementing the cTime
    //checking if cTime has reached the limit yet
    if(cTime < cLimit){
        cTime ++;
    } else {
        //if it has, then allow the user to shoot
        shootAllow = true;
        //and reset cTime
        cTime = 0;
    function updateHealthBar():void
        percentHP = currentHP / maxHP;
        healthBar.barColor.scaleX = percentHP;
        if(currentHP <= 0)
            currentHP = 0;
            trace("Game Over");
        updateHealthBar();

    USe the trace function to analyze what happens and what fails to happen in the code you showed.  trace the conditional values to see if they are set up to allow a shot when you press the key

  • Need help with a simple basketball game.

    Hi im new here and I need help with making this simple basketball game.
    Im trying to recreate this game from this video. Im not sure if he is using as2 or as3
    Or if anyone could help me make a game like this or direct me to a link on how to do it It would be greatly appreciated.

    If you couldn't tell whether it is AS2 or AS3, it is doubtful you can turn it from AS2 into AS3, at least not until you learn both languages.  There is no tool made that does it for you.

  • Need help with ending a game

    i'm making a game at the moment.......
    i need help with a way to check all the hashmaps of enimies in a class called room......i need to check if they all == 0...when they all equal zero the game ends......
    i know i can check the size of a hash map with size().....but i want to check if all the hashmaps within all the rooms == 0.

    First of all stop cross posting. These values in the HashMap, they are a "Collection" of values, so what is wrong with reply two and putting all these collections of values into a super collection? A collection of collections? You can have a HashMap of HashMaps. One HashMap that holds all your maps and then you can use a for loop to check if they are empty. A map is probably a bad choice for this operation as you don't need a key and an array will be much faster.
    HashMap [] allMaps = {new HashMap(),new HashMap()};

  • Help with action script number guessing game

    can someone help me in flash cs6 to make a simple guessing game, i just need help with the coding. making a guessing game from 1-100
    The constructor is coded to assign a random number for
    the user to guess
    • In the section of code indicated by the comments
    (within the handler function doGuess()), write condition
    statements that guide the user to guessing the number
    using text written to the output
    • Trace out the users' guess, plus a message
    • Messages for the user depending how close they are from the
    guess, condition each of the following:
    • Guesses correctly, +/-1 from the guess, +/-10 from the guess,
    +/-20 from the guess, +/-40 from the guess, all other guesses

    close, it's actually an in class practice lab. After doing this we have to do another one that needs to be submitted. I just need help with the coding for this because i dont know how to start at all. let alone the actual lab.

Maybe you are looking for