Wednesday, 22 May 2013

Some Random Updates That I See as Achievements In Moving Forward

So... this is how it looked yesterday and I had no clue why although it seems pretty obvious now. 
Since JCreator is still wonky on my laptop I will not touch any of my code (since it's working fine now) and just mention some stuff! Stuff. That's... pretty broad. But stuff is stuff which is stuff so it's valid stuff.

The reason for why the image wasn't appearing in the frame was because I had a lot of nonsense code to show the image (that code was mooched off of some website I don't even remember or know) and I didn't actually "put" the image into the game method which means it wasn't added to the gameFrame, which is why it wasn't showing up when it should have.
It kind of looks like this now after I removed the excess code:
roomImage = new ImageIcon(""+r+c+".png");
roomImageAfterItem = new ImageIcon(""+r+c+"after.png");
setIcon(roomImage);
The ""+r+c+".png" in the brackets gets the png file I named that certain row and col from the class folder. roomImage is the picture of the room with the item, and roomImageAfterItem is the picture of the room without the item in question. roomImageAfterItem was then made equal to roomImage after they click the item so that the after-image would be the picture that shows up after they click the item.

So... some other things that happened today has to do with getting the option pane to pop up to tell me that an item has been picked up! Since it has an "OK" button and not a "YES/NO" button, they will be kind of doomed if they pick up and eat something that is pretty dangerous...though I wonder at how I'm going to be able to tell them that. Hm. Ah. More if statements and messages. Mm.
Pretty silly mistake on my end... it wasn't working at first, and that was because I didn't add the MouseListener to it. I had the MouseMotionListener added, but I forgot that my if statement for picking up the item is part of the MouseListener method and not the MouseMotionListener.
Before I figured that, I --- AM I WRITING TOO MUCH HERE??-- made a tracing statement that says "MWAHAHA" if the item's actually being clicked. Turns out in the end after I added the MouseListener, both the item message and the tracing statement works. Yay.

Oh, and lastly, there was a null pointer exception error that popped up when I went to the instructions frame. My good quacking friend +Chilly C and my teacher found out that it was because the roomArray was initialized in the game method. It should have been initialized in the constructor method, because the if statements I had going on were trying to access rooms that weren't created yet when I clicked the instructions button...I wonder if I even made sense.

4 comments:

  1. QUAAAACK :)

    That's really quacking interesting.

    And no, I think my quacking like, quacking, like quacking rant was a much quacking longer quacking rant.

    QUAAACK! YOU MADE A LOT OF QUACKING SENSE!

    At least you did to me...

    ReplyDelete
    Replies
    1. Oh..and no quacking problem for solving your program ^_^ It was fun hehe.

      Delete
    2. Haha okay. Well, thanks again and I'm glad you had quacking fun solving it xD

      Delete
    3. It was a ton of quacking fun solving it ^___^

      QUAAAAAAAAAAAAAAAACK! :)

      Delete