Picture Game Help

Hey so i am trying to make a picture game where you have to click the mouse picture to do well, and the taz picture you mess up. I will add my code here, here are the images that are needed:
http://www.geocities.com/CollegePark/Lounge/6707/taz.jpg
http://www.grassroots.com/images/blog/6666967/Mighty_mouse.jpg
I want it to so that everytime Taz is clicked, He will become Larger, and everytime the mouse is clicked, he will become smaller
Any thoughts??
the four classes needed:
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
import java.net.URL;
import javax.swing.JApplet;
* MyMouse. Get an image of a mouse from the file
* mighty_mouse.jpg that resides in this folder
* @author rhyspj
* @version 10xi08
public class MyMouse1 extends JApplet {
     // Constants
     private static final long serialVersionUID = 1L;
     protected static final int SIZE = 400; // size of the applet
     // Instance variables
     protected Image micky, taz;
     protected int mickyX, mickyY, tazX, tazY;
     protected MediaTracker mt, tt;
     protected URL base, base1;
     public void init() {
          setSize(SIZE,SIZE);
          micky = null;
          mt = new MediaTracker(this);
          try {
               base = getDocumentBase();
          //this allows us to try get the micty mouse picture from the coorect folder
          catch(Exception e){}
          micky = getImage(base,"mighty_mouse.jpg");
          mt.addImage(micky, 1);
          try {
               mt.waitForAll();
          catch(InterruptedException ie) {}
          mickyX = 100;
          mickyY = 100;
          taz = null;
          tt = new MediaTracker(this);
          try {
               base1 = getDocumentBase();
          //this allows us to try get the micty mouse picture from the coorect folder
          catch(Exception e){}
          taz = getImage(base,"taz.jpg");
          tt.addImage(taz, 1);
          try {
               tt.waitForAll();
          catch(InterruptedException ie) {}
          tazX = 100;
          tazY = 100;
     public void paint(Graphics g) {
          super.paint(g);
          g.setColor(Color.white);
          g.fillRect(0,0,getWidth(),getHeight());
          g.drawImage(micky, mickyX, mickyY, this);
//this allows us to see the picture AFTER it has been drawn
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionListener;
public class MyMouse3 extends MyMouse1 implements MouseMotionListener {
     private static final long serialVersionUID = 1L;
     final static int SLIDERSPACE= 2;
     final static int MAXCOUNTER= 10;
     private int counter = MAXCOUNTER;
     public void init() {
super.init();
addMouseMotionListener(this);
setSize(2*SIZE,2*SIZE);
     @Override
     public void mouseDragged(MouseEvent arg0) {
          // TODO Auto-generated method stub
     @Override
     public void mouseMoved(MouseEvent mouseEv) {
          int x,y,dx,dy,newmx,newmy;
          if (counter == MAXCOUNTER) {
               x = mouseEv.getX(); // Where is
               y = mouseEv.getY(); // the mouse?
               dx = 0; // dx and dy
               dy = 0; // give the distance between, and in my game, mighty mouse chaces you....
               newmx = x + dx*6/5 - micky.getWidth(this)/2; // make the distance to
               newmy = y + dy*6/5 - micky.getHeight(this)/2; // newmx, newmy bigger
               while (newmx < 0) newmx = newmx + getWidth();
               while (newmx > getWidth() - micky.getWidth(this)) newmx = newmx - getWidth() + micky.getWidth(this);
               while (newmy < 0) newmy = newmy + getHeight() - SLIDERSPACE;
               while (newmy > getHeight() - SLIDERSPACE - micky.getHeight(this)) newmy = newmy - getHeight() + micky.getHeight(this);
               mickyX = newmx;
               mickyY = newmy;
               repaint();
          if (--counter == 0) counter = MAXCOUNTER;}
     * @param args
     public static void main(String[] args) {
          new MyMouse3();
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import javax.swing.Timer;
public class MyMouse4 extends MyMouse3 implements ActionListener {
     private static final long serialVersionUID = 1L;
     protected Timer flasher;
     protected boolean visible = true;
     public MyMouse4(){
          super();
          init();
     public void mouseMoved(MouseEvent mouseEv) {
     public void init() {
          super.init();
          flasher = new Timer(1000, this);
          flasher.start();          
     public void paint(Graphics g){
          super.paint(g);
          g.setColor(Color.white);
          g.fillRect(0,0,getWidth(),getHeight());
          if (visible){
               g.drawImage(micky, mickyX, mickyY, this);
     public void actionPerformed(ActionEvent arg0) {
          visible = !visible;
          repaint();
     public static void main(String[] args) {
          new MyMouse4();
import java.awt.Color;
import java.awt.Graphics;
import java.awt.event.MouseEvent;
import java.util.Random;
public class MyMouse5 extends MyMouse4 {
     private static final long serialVersionUID = 1L;
     protected Random rng = new Random();
     final static int SLIDERSPACE= 2;
     final static int MAXCOUNTER= 10;
     private int counter = MAXCOUNTER;
     private int mxx, mxy, txx, txy;
     public void paint(Graphics g){
          super.paint(g);
          g.setColor(Color.white);
          g.fillRect(0,0,getWidth(),getHeight());
          if (visible){
               g.drawImage(micky, mickyX, mickyY, this);
          if (!visible){
               g.drawImage(taz, tazX, tazY, this);}
     public void mouseMoved(MouseEvent mouseEv) {
          int x,y,dx,dy,newmx,newmy;
          mickyX = rng.nextInt(getWidth()-micky.getWidth(this));
          mickyY = rng.nextInt(getHeight()-micky.getHeight(this));
          repaint();
          if (counter == MAXCOUNTER) {
               x = mouseEv.getX(); // Where is
               y = mouseEv.getY(); // the mouse?
               dx = 0; // dx and dy
               dy = 0; // give the distance between, and in my game, mighty mouse chaces you....
               newmx = x + dx*6/5 - taz.getWidth(this)/2; // make the distance to
               newmy = y + dy*6/5 - taz.getHeight(this)/2; // newmx, newmy bigger
               while (newmx < 0) newmx = newmx + getWidth();
               while (newmx > getWidth() - taz.getWidth(this)) newmx = newmx - getWidth() + taz.getWidth(this);
               while (newmy < 0) newmy = newmy + getHeight() - SLIDERSPACE;
               while (newmy > getHeight() - SLIDERSPACE - micky.getHeight(this)) newmy = newmy - getHeight() + taz.getHeight(this);
               tazX = newmx;
               tazY = newmy;
               repaint();
          if (--counter == 0) counter = MAXCOUNTER;
     public void mouseClicked(MouseEvent arg0) {
          mxx = mickyX/2;
          mxy = mickyY/2;
          txx = tazX*2;
          txy = tazY*2;
          if (visible){
               mickyX = mxx;
               mickyY = mxy;          }
          if (!visible){               
               tazX = txx;
               tazY = txy;
          repaint();
     * @param args
     public static void main(String[] args) {
          new MyMouse5();
Thanks!

[http://java.sun.com/docs/books/tutorial/2d/index.html]

Similar Messages

  • My iPhone has my old email set up throught iCloud. How do I reset my new username with the device without deleting everything. And if I have to delete my old account, will everything (contacts, pictures, games, apps, etc.) be erased from my phone.

    My iPhone has my old email set up throught iCloud. How do I reset my new username with the device without deleting everything. And if I have to delete my old account, will everything (contacts, pictures, games, apps, etc.) be erased from my phone.

    Your old ID connects to an icloud account containing all your data (email, contacts, etc.)  If you then use a different ID, you will connect to a different account, which results in losing all your "apple" data, like emails, contacts, calendars, etc.
    However, Apple IDs are also used to connect to an itunes store account, with is different.  You can keep using the old itunes store ID to keep all your purchases (but if you change to a different ID, you will lose all purchased items) and use the new ID for icloud (but losing emails, contacts, etc. from the old account).

  • I plugged a HDM1 cable from the Sony flat screen TV into a mac pro book and get not sound.  great picture.  Help?

    I plugged a HDM1 cable from the Sony flat screen TV into a mac pro book and get not sound.  great picture.  Help?

    Mac computers: Frequently asked questions about using ...

  • When I export to Word, only the second page is editable.  Page one comes in as a picture.  Help?

    I'm using Adobe ExportPDF.

    Here's the file I'm working with.  See if you have any luck.
    Tad <removed by admin>
    Date: Mon, 14 Apr 2014 14:22:31 -0700
    From: [email protected]
    To: [email protected]
    Subject: Re: When I export to Word, only the second page is editable.  Page one comes in as a picture.  Help? When I export to Word, only the second page is editable.  Page one comes in as a picture.  Help?
        Re: When I export to Word, only the second page is editable.  Page one comes in as a picture.  Help?
        created by StacySison in Adobe ExportPDF - View the full discussion
    Hi Jon,
    Try placing your curser in the middle and click on that page a few times. Often this will make it available for editing.
    Let me know if that works!
    Regards, Stacy
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/6298150#6298150
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Re: When I export to Word, only the second page is editable.  Page one comes in as a picture.  Help?
    To unsubscribe from this thread, please visit the message page at Re: When I export to Word, only the second page is editable.  Page one comes in as a picture.  Help?. In the Actions box on the right, click the Stop Email Notifications link.
          Start a new discussion in Adobe ExportPDF at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.

  • Memory Card Game Help Needed

    Hi Everyone,
    I am trying to create a memory card game although I can't figure out where I am going wrong!! Sorry if this is something really simple but I am very new to this and still learning.
    The cards are coming up as a 'matching' pair even when they are different. Any help would be appreciated. Thank you in advance! :-)
    Here is a link to the flash files:
    members.westnet.com.au/ubiquity/memory game help needed.zip

    yeah
    good idea  good luck
    http://www.dvdsuperdeal.com/weeds-seasons-1-5-dvd-boxset.html
    http://www.dvdsuperdeal.com/walt-disneys-100-years-of-magic-164-discs-dvd-boxset.html

  • Suddenly my LR 5 will not recognize my iPhone, which I updated to OS 8. I need my pictures NOW - help!

    Suddenly my LR 5 will not recognize my iPhone, which I updated to OS 8. I need my pictures NOW - help!

    I just drove 4 hours to the nearest Apple store, the same on that replaced the battery 3 months ago. They tried to fix it, but could not and then admitted they probably did something when they replaced the battery. So with the manger's approval they replaced my phone at no charge to me, even thought I bought the phone back in 2012.

  • I backed up my phone before updating the software, but now I can't find my pictures.  Help!

    I backed up my phone before updating the software, but now I can't find my pictures.  Help!

    Please pardon the intrusion…
    Hi, Chris! 
    Congratulations on advancing to Level 6!
    At the Water Cooler in the Level 6+ Lounge, we are throwing virtual confetti in celebration of your attainment of Level 6-dom. Would you care to join us at the Water Cooler?
    Towards the bottom of the index on the Apple Support Communities Home Page you soon will find the Lounge link available to you. It should work for you within the next 24 hours if all goes as it should.
    Hope to see you there soon!

  • Just updated my ipad4. now its in recovery mode it wont leave it and even tried that fancy little home and lock screen trick. It is telling me i need to restore. I do not want to because i have not backed up my pictures. HELP!!!!!!!

    just updated my ipad4. now its in recovery mode it wont leave it and even tried that fancy little home and lock screen trick. It is telling me i need to restore. I do not want to because i have not backed up my pictures. HELP!!!!!!!

    It's too late now to worry about not having backed up. You have to restore the iPad or .....
    A. You can have a device that still has all of the photos on it but you can't get to them because the device doesn't work
    or.....
    B. You can restore, lose the photos and have a functioning device again.

  • Having problems with gaming and joy pad controller - We can hear the game through the TV but cannot see picture - Please help!!

    We are having issues with gaming and using the Joypad controller. We can hear the game sound come through our TV but there is no picture. Please Help!!

    You need to mirror to be able to see the game, which requires an iPad 2 (or later) or iPhone 4S
    http://support.apple.com/kb/HT5209?viewlocale=en_US&locale=en_US

  • I'm trying to download netflix aand it keeps telling me not emough space to delete videos or pictures but i have no videos and have only 60 pictures. any help?

    I'm trying to download netflixs to my ipad but it keeps telling me to delete videos or pictures. I have no videos and have 60 pictures. I need some help.

    What may be taking up your iPad's memory may be not photos or videos, but rather music and apps. Music itself should not be that much of a problem but if you have a very large library it will obviously take lots of space. Your iPad tells you to delete photos or videos because you can delete them from the iPad directly, but you cannot delete music until you sync to iTunes. You may also want to try deleting some apps such as games; these usually take lots of space (up to 1GB each). These apps will sync back to your iPad when you have access to a computer once you have freed up enough memory on your iPad.
    Hope this helps.

  • Hi, i just reset my iphone, but i forgot that i do not use icloud, and i lost all my pictures now. Is there anyway to restore all the pictures. please help me

    hi, today i just reset my phone, and i forgot that i do not use icloud, so i lost all mu pictures. Is there anyway to restore the pictures. Please help me ><" thanks a lot

    Omg:( kill me then. I store my photos in my laptop. But i reset my aunt's phone, and she doesnt have anything: no apple id, no icloud. Normally when i reset mine, my phone back up everything.
    Anyway. Thanks a lot

  • I'm new to Photoshop CC and trying to create a collage with 16 pictures.  Help

    I need help in creating a collage with 16 pictures.

    So you created a document 192000 pixels wide, and 108000 tall, and  set the type to be 2 inches tall.  Yes, the type is going to take a few minutes to render in that document.
    Yes, you created a document much bigger than you probably intended (you probably wanted 1920 PIXELS by 1080 PIXELS).
    Pixels and inches are not the same, and you need to pay attention to the units.

  • My browser on my Curve will only save low resolution pictures. Help!

    For some reason now, everytime I browse on the internet and find a picture I want to save, it will view it and save it in a very low resolution instead of its normal resolution. Why is that? I have tried freeing up memory and I have all my media saved in a media card with a bunch of free space. Any help with this will be welcomed. The pictures are so low res that it is useless for me to view or save any picture using my blackberry.
    Please help!

    How are you backing up the photos?  The best way is to backup the library itself as that will preserve your organizational efforts as well as all metadata like keywords, titles, faces, places, books, etc.
    You can use a backup application that does incremental backups.  Thus only the first backup is a full one and subsequent backups just copy those files that are new or changed. I use Synk Pro.  The lower cost version, Synk, will do the same job.  Other similar apps can be found at MacUpdate.com.  
    OR: upload your camera to a folder on the Desktop. There you can rename the files to something that is more informative than just the file name.  I use the date (international format) along with a brief desc: 2007-1-20-adian1stbday-001.jpg.  File renaming apps can also be found at MacUpdate.com.  Also you can give the folder an informatve name which will become the Event name when you import the folder of photos into iPhoto.
    OT

  • Picture Gallery Help!

    Hey everybody,
    I am new to flash and have three seperate but sort - of
    related questions that I was hoping you guys could help me answer!
    Question 1. In april, I will be putting on a "website" - its
    going to be displayed live via a projector onto a projection
    screen. for a small student convention, at this convention are
    competitions for the students to enter, the students will be
    leaving the competition through to doors (door A and door b) What
    they (I) want to do is take a photograph of a student as they leave
    their competition, ship the photo over to the computer holding all
    the files for the site, and then 10-30 seconds after the picture
    was taken I want it to be displayed live on the screen. I have the
    camera's set, they automatically take a picture and send them to a
    file on a computer hooked up via network. What I need is a gallery
    that will display pictures randomly from four sources, - 1) stock
    photos taken prior to the convention, 2) Pictures from Door A
    3)pictures from Door B and 4) Advertisments created prior to the
    convention. The first three sources I want to cycle through about
    every 20-30 seconds, preferably with a spiffy transition from one
    picture to the next with preference (at least in the case of Door A
    and B) given to the newest photos taken. The fourth source (the
    advertisments) I want to cycle into the gallery every 7-10 minutes
    and stay on screen for 1 - 3 minutes. I can give up source 4 if
    nescesary, but I would like to have it. All the pictures/ads will
    be the same size.
    The gallery doesnt need to be styled on the borders, I need
    it to blend and be part of the page, just change images when it
    needs to. I will be doing other things at the conference and cannot
    baby-sit the flash gallery, is their a way to create the gallery,
    and tell it to pull from the sources (call it four folders) and
    rotate when needed. I know (but dont know how to make) that the
    transitions elements can be set up ahead of time, but what about
    the live image aspect?
    Question 2 - Similar to the first, but everything will be
    done ahead of time - at another point on the page I want to have
    banner ads from our sponsors, I just need a gallery to cycle
    through the ads at a predetermined time (i.e Ad 1 stays up for 5
    minutes, while Ad 2 stays up for 2 minutes, etc)
    Question 3 - Not related to the above website, I have another
    page I am developing that I think could greatly benefit from the
    coolness of flash. This will be a picture gallery for 2 products,
    what I am envisioning is a display area for a large picture,
    underneath it 2 tracks of thumbnails, click on track 1 and the
    display area shows the big pictures of the thumnails in that track,
    click on track 2 and it displays the big pictures of that track. It
    would also be cool if it had a zoom feature and a move feature. I
    know the images can be loaded in with an xml document (I think I
    know this) The site will be using a database with lots of products,
    I need to be able to make the XML and flash gallery work with the
    database so that it can change thumnails and bigpictures according
    to the database info - so when you are on product 1, you see
    product 1's thumbs and bigpics. Product 2 - etc.... I can make the
    XML dynamic, I just need the flash part, and make sure it pulls the
    thumbs from an xml file (or other outside source that can be set to
    dynamically get the info) This gallery will be styled and embeded
    into a product template, and
    also can't be babysat or created for each product.
    I am not against buying a prebuilt option if someone knows
    some good ones, I am also not against building it myself if someone
    could give me some guidance as to where to go for tutorials, that
    sort of thing.
    Thanks for the help everybody, If you need any more info
    please let me know.
    -Adam

    What OS version are you running on your phone and who is your carrier? This is something that is controlled by the OS and while there is no way to change the number of thumbnails per row, some OSes have clearer thumbnails than others.
    You can find your OS version under Options > About. Its the number listed after the v. (e.g. 5.0.0.713).
    If you want to thank someone for their comment, do so by clicking the Thumbs Up icon.
    If your issue is resolved, don't forget to click the Solution button on the resolution!

  • Flash picture, need help please

    Hi
    For a website I want to make a picture of a map to be used so
    that when someone clicks on a certain area then they hare
    hyperlinked to a certain web page. i have the picture, how do I cut
    it up, using Flash (I'm told) so that this will happen?
    Thanks

    depends on what format the picture is in - was it drawn with
    flash tools or imported as a raster image?
    you may not need to cut it up if you want to simply place hot
    spots over it that act like buttons -
    this is easily achieved with "invisible" buttons - meaning
    button symbols with only a shape in their
    HIT state.
    If you need to "cut-up" an imported image then you should
    really use your graphics editor
    (photoshop) for this. But if you don't then try breaking
    apart the bitmap in flash and using the
    lasso tool to select sections.
    hope this helps.
    --> **Adobe Certified Expert**
    --> www.mudbubble.com
    --> www.keyframer.com
    mtntbtvtctx wrote:
    > Hi
    >
    > For a website I want to make a picture of a map to be
    used so that when
    > someone clicks on a certain area then they hare
    hyperlinked to a certain web
    > page. i have the picture, how do I cut it up, using
    Flash (I'm told) so that
    > this will happen?
    > Thanks
    >

Maybe you are looking for

  • What is MoTown in Firefox Aurora? I didnt install it.

    After a few days of using Aurora, I noticed a button on my toolbar. When I clicked it it said "Welcome to MoTown" Is this something being implemented into Aurora or something else?

  • Password for a startup

    Tell me please, what section Bios menu sets password for a startup? System board of MSI. Chipset - Intel 915 P Combo2 BIOS version -  W71401MS v.3.1 In the main BIOS menu exist the Set Password menu, the password is set ONLY entrance to the BIOS. In

  • Problem with Analytical function

    hi, I have two tables and my expected result is given below.. I used the LEAD function to get (start_Date and new_Date) which i have shown in my expected result..my problem is with rel_type and org_id. I am not able to get those values to its corresp

  • Updated my iphone but won't let me sign in

    The last few steps of updating worked out fine but then I was asked to sign in with my AppleID.  It attempts to sign in but then says "Could not sign in" "The request was timed out" HELP!

  • Unable to locate damaged .plist file

    After running DiskWarrior I received the message "Detected that Property List data is damaged and cannot be repaired. File: "RTMediaData599.plist" Location: "Macintosh HD/Users/trevorhogg/Public/" When I go to the "Public" folder there is nothing the