Kaspar Dahlqvist

Ranch Hand
+ Follow
since Jun 18, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Kaspar Dahlqvist

Well, darn there, sheriff..!

Since you're a 100% right on how I currently load my images, a good guess would be that your tested solution works just as well! I'll give it a try.

Thanks a bunch!

Sincerely, Kaspar
20 years ago
Hi!

This is probably a neverending, inexhaustable subject...

I'm trying to jar my game, and all is well until I try to run it. It runs like a charm when doing "java -jar Arkanoid.jar", but it seems my classes can't reach my images, contained in folder Images, and I can't double click on the jar file to start the game.

My game folder looks like:

arkanoid
|
-all classes
-subfolder Images, contains all images.
-subfolder src, contains all src.

in the arkanoid/ folder, I do the following:

jar cmf MANIFEST.MF Arkanoid.jar *.class Images src

MANIFEST.MF contains one row of text:

Main-Class: GameBoardMultBall[enter]

When I do this, I see that all images are compressed and put into the jar file, but why doesn't it work?

/Kaspar
20 years ago
Eeeh...

For the second time, even though unsuccessful the first time, I tried using a MediaTracker. This time it worked like a charm (like I thought it would)...

The flickering gone, I can't help loving the explosions and, consequently, my graphics designer on the other side of the table... Those exps are GRREEEAAAAT!!!

Thanks for all help!

/Kaspar
20 years ago
The Bat object is created at Game Init, ie before the game starts. So, as far as I get it, the images should have well enough time to be loaded before the explosion takes place. Somehow, though, this does not happen...

I will look into your proposal about the DirectX way. My eyes recently fell on the BufferedImage class. Maybe I could use that somehow to buffer the images... Well... We'll see!

Thank you!

/Kaspar
20 years ago
Right now I'm trying to fill the image array in the constructor, and this is called at initialisation. This doesn't help though. The first explosion is always flickering. Would using a mediatracker help, or does anybody know of some better way?

/K
20 years ago
Hi!

Does anybody know how you precache images in memory?

In my game I create an array of pictures for an explosion, but the first time this explosion takes place it flickers A LOT... Not any other time, though.

I do like this, and when the explosion takes place I just loop through this array, switching the image to be painted.



/Kaspar
20 years ago
Hi there!

It's been a while since I last visited Big Moose, but things doesn't seem to have changed much...

I currently work as a teacher in elementary programming (java, of course), and to motivate my students I am in the process of developing a basic game. My aim is to base part of my education around this game and make them recode, understand and analyse part and pieces of it (and make them realise that it is quite hard to make as simple a game as this, and MUCH harder to make a 3D shoot'em up...).

Before I do this, I would be happy to get as much input as possible from all of you out there! I know that the game violates about all of the OO rules, for example. And I am almost as certain that it can be modified to perform much faster, be more stable and work much better!

This way we can all learn something, I reckon? Does anybody think it's a good idea?

If so, I will jar the files together and post them ASAP. Does anybody know of a place to upload the jarfile so I can share it with you? Or can I post it here directly?

Sincerely,

Kaspar
20 years ago
Howdy!
Method void method(String s) is currently too ambiguous for the compiler... Right now your method receives a reference to a String called str, and what you do with
str = str;
is to tell Java that you want str to reference the String that str points to. But, hey, it already does...
In your code you create two objects from the class Test026, and each has a instance variable called str. To initialize these to values other than null, you need to use the references to those objects. In other words, in an appropriate place, do the following:
t.str = str;
this.str = str;

Getting the hang of riding, yet?
/Kaspar
I most regrettably didn't...
This is one of the most informative threads I've ever participated in!
Howdy!
An instance initializer is processed JUST BEFORE the constructor, as you create an instance of a class.
So doing

is roughly equivalent with

The instance initializer is mostly used in anonymous classes, where you can't have constructors (since the anonymous class does not have a name). There the instance initializer is the only way to pre-initialize instance members.
Hope this helps!
/Kaspar
22 years ago

Thanks, Mike!!!
Actually, I had browsed this awesome tutorial of yours before, but missed a crucial point. The service should be defined in a separate package. Trivial when you think of it, but then again, most things are when you know them...
Thanks again!
/Kaspar
22 years ago
Two days ago, when I first set out to do my first RMI example, I had perfectly blondish hair. Yesterday I started to get some grey hair and as of this hour I AM COMPLETELY BALD....!!!
I might be off track here, and my hopes are that someone will correct me and make me realise my stupidity... I have three files in one package (dev):

My problem is this: if I have this in package dev, it works like a charm! But RMI is about to have a service on one computer and a client program on another, so I figure that it should be possible to split these files up in some way so that the client and the server are separated. I JUST CAN'T MAKE IT WORK!!! I have tried:
Putting DataInterface and Server (plus Server_Stub and Server_Skel) in one package Serv.
Putting Datainterface and Client in another package Clie.
This makes Client go mad, since the object received is of type Server_Stub, and Server_Stub implements Serv.DataInterface...

If someone could take the time to enlighten me, I would be glad...
Thanks!
/Kaspar
22 years ago
Howdy!
I felt exactly the same way while studying for the exam. The more you learn, the more you run into troubles you never thought existed...
But I would say that this is a sign of growth. You might not be ready yet, but it is only a matter of time before you are. Dive into the books, write lots of codelets and ask lots of questions here and there, and you'll be fine!
But this is just me; I like to see things positively...!
/Kaspar
Hello!
Well, as far as I know, overriding only applies to objects. This rules out all static methods, as these are class methods and not instance methods.
Concerning choice e), I think it is possible to argue that this choice is not "non-overridable", but only not possible to override due to the access modifier private.
But this is only a hunch. I really think this is a bad question, if it isn't equipped with a vivid explanation and justification of the right answers.
Hope this helps!
/Kaspar
This is one way!


//Kaspar
22 years ago