CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: Gnasher

Search: Search took 0.01 seconds.

  1. Re: Serializing objects - BufferedImage error! Help!

    I solved it by saving the location a different way. Just by making a getter and setter for the entity image location in my base entity class. Really simple now I know how to do it.

    Thanks for the...
  2. Re: Serializing objects - BufferedImage error! Help!

    Yeah your right, I declared it as static in the entity class. But when I remove the static from the method, I then can not use it in my save game class, it asks me to change it to static.


    ...
  3. Re: Serializing objects - BufferedImage error! Help!

    Ok, thanks Keang, that works good.

    One problem though, which I didnt know until I loaded the objects back in to the game. I am sending the imageLocation back to the entities class by including it...
  4. Re: Serializing objects - BufferedImage error! Help!

    You are correct it doesn't overwrite, there all in there. I've made real progress now. So far, it saves the array size, and all game objects in array list. It also loads all object data back into the...
  5. Re: Serializing objects - BufferedImage error! Help!

    Thanks. One other question as well. Ive got it saving entities to file by basically having a for loop that goes through the array list of entities and saving each one. My question is - With each...
  6. Re: Serializing objects - BufferedImage error! Help!

    Ok, thanks. That makes sense. However, when you say this:



    // save the filename for the image
    stream.writeObject(myFileName);


    I think this is a problem, as the objects in the game can be...
  7. Re: Serializing objects - BufferedImage error! Help!

    Thanks for your response Keang,

    However, I am still very confused about how to go about doing it.

    Could you possibly provide an example of how I serialize the objects with the filename, instead...
  8. Re: Serializing objects - BufferedImage error! Help!

    Thanks, Keang.

    Yes, you are correct, I have the images stored on file, so I could serialize the file name and re-load it when I de-serialize. How would I go about doing this when I am serializing...
  9. Serializing objects - BufferedImage error! Help!

    Hi,

    Im attempting to serialize objects in my game as it requires that I save the state of an object to later be loaded back into the game. After researching I have found out that BufferedImages...
  10. Re: Detect a mouse click on specific entity in an arrayList

    VerCar is the name of the new entity being created to represent a vertical car in the game. I was testing to see is the clicked object was the same as VerCar so I could then change the speed of it,...
  11. Re: Detect a mouse click on specific entity in an arrayList

    Ok. again, thanks for helping. Very useful.

    Im a little confused, however. My apologies if I get things wrong here, but im very new to java. Is this better? I'm adding this to each method

    ...
  12. Re: Detect a mouse click on specific entity in an arrayList

    Ok, im having a few problems now. Ive added a mouse listener class like this:


    private class mouseInputHandler implements MouseListener {

    @Override
    public void mouseClicked(MouseEvent e)...
  13. Re: Detect a mouse click on specific entity in an arrayList

    Thanks.

    Could you please explain how I would go about adding a mouse listener to each component?

    At the moment I create each car in a separate method (one for each lane of the roads), I create...
  14. Re: Detect a mouse click on specific entity in an arrayList

    Sorry, the game class extends Canvas.
  15. Re: Detect a mouse click on specific entity in an arrayList

    Oh sorry. Im using AWT to draw the images.
  16. Re: Detect a mouse click on specific entity in an arrayList

    Thanks for the help both.

    So far I have a base entity class, that is used for collisions and movement. Then, I have a car entity class that extends the base entity. In the base entity class I...
  17. Detect a mouse click on specific entity in an arrayList

    Hi,

    Im a beginner in Java and I'm creating a simple game. I have an arrayList of entities (cars in my case), I need to be able to detect a mouse click on an individual object (car) in the array. I...
Results 1 to 17 of 17





Click Here to Expand Forum to Full Width

Featured