Change Contents of the Bubble
View this PageEdit this PageUploads to this PageHistory of this PageHomeRecent ChangesSearchHelp Guide

Questions on HW6-Sp2005

Big Project! Creating your own linked lists, then rendering them to sounds and to images – an animation with sounds!

Questions about it all?



I had some great questions about how HW6 works, and I want to put the answer up here. Mark Guzdial
FrameSequence frames = new FrameSequence("D:/temp/");
Picture bg = null;
current = sound1;

bg = new Picture(500,500);
// Render the frame and play the sound
root.drawFromMeOn(bg);
frames.addFrame(bg); // Now I can see it
current.mySound.blockingPlay(); // Now I can hear it

// Next frame
current = current.getNext(); // Point to next sound
// REMOVEDge the data structure...

bg = new Picture(500,500);
// Render the frame and play the sound
root.drawFromMeOn(bg);
frames.addFrame(bg); // Now I can see it
current.mySound.blockingPlay(); // Now I can hear it

// Next frame
current = current.getNext(); // Point to next sound
// REMOVEDge the data structure...



Do note that I gave you all kinds of bluescreened objects in MediaSources. I hope that some more interesting characters beyond doggies/wolves, trees, and houses show up in your movies! Mark Guzdial


Can we use gifs that already have a transparent bg?

I'm not completely sure that the Picture class understands about the transparency in GIFs. Test it by creating a picture in the Interactions Pane, then compose it into a background picture, and see if the transparency gets interpreted correctly. Mark Guzdial

Today in class when you typed 'WolfAttackMovie wam = new WolfAttackMovie' into the interaction section, was wam somewhere in your code? I understand the setUp() and renderAnimation() part, just not where wam came from.

wam was the name of the variable. I made it refer to a new WolfAttackMovie instance. Mark Guzdial


Are we supposed to make a class with a main method... So when you run it, it renders the animation/sound and plays it... or do you just want us to leave it so the TA has to type out "AnimationRunner ar = new AnimationRunner()" in the interactions window?

The latter – assume that the TA's will use your animation the way I was using the WolfAttackMovie today: Creating an instance, and calling methods on that instance. Mark Guzdial



Are you having a problem with completely blank frames?

Here's how to test it: Run the WolfAttackMovie as we did in class. Do you get anything in your frames? If you don't, you're not alone. Somewhere in the files we posted is a bug. It's really nefarious. Working with Corali today, we created a background picture (worked), we created a tree (worked!), we composed the tree onto the background – the background remained blank, and when we repainted the tree, it was now blank! We tried recompiling everything, and still had the problem. Three students showed me some form of this problem today at office hours!

If you're not having the problem – HOORAY! Just keep truckin'.
If you are having this problem...
  1. Go to the Syllabus page and grab a copy of the mark-java-source.zip file there.
  2. Uncompress it.
  3. Pull the mark-java-source directory out, and put it NEXT to your java-source directory! Because of the way WinZip compresses, there will be a directory named mark-java-source INSIDE your mark-java-source directory. Pull the inner one out, and put it next to your java-source directory.
  4. Now, remove java-source from your DrJava Preferences, and put in a reference to mark-java-source instead.
  5. Open WolfAttackMovie.java from mark-java-source and change the FrameSequence temporary directory and the mediapath to work for your disk.
  6. Now try WolfAttackMovie wam = new WolfAttackMovie(); wam.setUp(); wam.renderScene(); If you now see a picture appear where you didn't before, you got it!

You'll want to copy your AnimationRunner class into mark-java-source and work from there. I don't know what happened, but it was darn weird! Mark Guzdial


^ Thanks that fixed it.

How can we test our first frame to see what it looks like? Can we make a public static void main? Or should we create a separate class for that? Not to turn it, but to check to make sure it's working and the picture is what we want it to look like.
Absolutely – you can do a public static void main if you want, or do a renderScene like in WolfAttackMovie. Mark Guzdial

Which functions should be in which classes? The wolf attack movie only uses one class... are we supposed to format our "movies" ;) after it? Are we allowed to use those all of those new Branch classes, or do we need to write our own? Thanks!
You only need one class, and three methods described in the homework. You can use ANY of the classes we've done in class. If you want to modify any of them, you can, just include them. Mark Guzdial

I only get one picture - the very first frame - when I execute the wolf attack movie as above. The java-source directory has been switched to Mr. Guzdial's. What could I do to fix it?
Right – the above examples only show you a single frame. If you see it, you're golden. Mark Guzdial

so is all we actually create part of the animationrunner class? or do you put bits and pieces in...which classes?
You need an AnimationRunner class, and then, as it says on Homeworks-Spring 2005:
You will also need to create a class (maybe AnimationRunner?). Your TA will create an instance of this class (AnimationRunner ar = new AnimationRunner()).


i keep having a problem with the turtle class, it gives me this error when i try to run setUp()
java.lang.UnsupportedClassVersionError: Turtle (Unsupported major.minor version 49.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at edu.rice.cs.util.classloader.StickyClassLoader._loadWithSecondary(StickyClassLoader.java:254)
at edu.rice.cs.util.classloader.StickyClassLoader.loadClass(StickyClassLoader.java:219)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at AnimationRunner.setUp(AnimationRunner.java:6)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)

i did upload the latest mediasources files, and tried to recompile all the turtle classes for no reason (btw got an error in TurtleWorld class too about it not being abstract, even though i'm sure it's not related). but nothing seems to be working
According to this error, you just have to recompile Turtle. Mark Guzdial

I have nearly replicated the WolfAttackMovie, with my own movements and pictures. The WolfAttackMovie works fine, but mine does not. The problem with mine is I get a null pointer exception as soon as I try to make the MoveBranch move, it can be a constant number, or with a variable, I still get the null pointer exception. So the only thing that is shown is the first frame my setUp(). I have gone back over it several times, and everything should be working, and it is similiar enough to yours for me to make sure of that, however it isn't. Any idea on why?
It should tell you the line, if not the variable, that is null that it didn't expect to be null. Check that line. I'll be on AIM and in my office much of today. Mark Guzdial

Is it okay if we keep it simple, one sound, a rendered scene, and a couple objects moving around? By one sound, I mean the same sound for every frame.
That's the minimal to get full credit, yes. Mark Guzdial

So... how do we see the rest of the Wolf Attack Movie instead of the first frame all by its lonesome?
At this point, I do expect that you can read the code, or look over the PPT slides where we did the movie. renderAnimation(). Mark Guzdial

If anyone is still stuck, you can come to my office hours tomorrow at noon (at the college of computing commons area), I'll have my laptop so if you bring your files somehow we can look at it. #4
And I'll have my normal 1-2:30 pm office hours Friday. Mark Guzdial

Mark, about the turtle-wrong version file - i did recompile the turtle class, but i was getting the error on running my setup anyway. (and yes, all the files i have in my java source directory are right out of the latest zip you posted, plus my animation runner class. I've been stuck with this error for a few days now, please help
Ohhh – I'll bet that you have two java-source directories in your classpaths in Preferences. It's getting confused between the two versions. Remove the old one, leave the new one, then recompile. If still having trouble, see Sebastian or me tomorrow. Mark Guzdial

our animation has to be a tree, right? it can't be a loop?

The data structure that describes the scene can be a tree or a list. You can use a loop to manipulate that data structure to create an animation – I do that in WolfAttackMovie. Does that make sense? Mark Guzdial


i'm having a hard time attaching the sound. is 'current' defined somewhere? and is your 'sound1' the first sound you made? since it's in the setUp method, it won't compile...or am i totally misunderstanding the whole thing?

You need to define current in your class, as an instance variable, if you plan to use it in more than one method. Anything you declare in a method is local ONLY to that method. When you start playing the animation, you should set current equal to the root of your sound list, if it's called "sound1" or "soundroot" or "whatever". Does that make sense? Mark Guzdial




Links to this Page