Chad LaVigne

Greenhorn
+ Follow
since Jan 17, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chad LaVigne

It sounds like your class doesn't reside in a directory that matches the package statement. In other words, if your class delcares

package com.example.model;

then the source file needs to be in a com/example/model directory when you compile it and at deployment the compiled class needs to be placed in a com/example/model directory under the WEB-INF/classes directory of your deployed app. For example, if tomcat is the web container you're using it would be something like:

opt/tomcat/webapps/Beer-v1/WEB-INF/classes/com/example/model

Hope that helps.

Chad
I just took the SCWCD mock exam on JavaRanch and got the following question:



I answered that a listener would be created as specified by the com.javaranch.LogListener class. The mock exam results said the correct answer is that the webapp will not be loaded due to a parse exception of the DD because the ordering of the DD is listener then servlet. This contradicts the examples from the Head First Servlets & JSP book which shows the listeners being defined after the servlet definitions. Also, I've created listeners that are defined after the servlets in web.xml and everything works in Tomcat 5.0.28. Which way is correct and which way does the real test expect me to answer?

Thanks,
Chad
I'm an e-commerce developer that likes to do some game programming on the side and currently I'm working on a 2D side-scroller. Does anyone know where I can get information to help me set up some good design heuristics for a game in that genre? I'm particulariy curious about what the best way is to do the collision detection between foreground sprites and background tiles. Any help would be greatly appreciated.
Thanks,
Chad
23 years ago
Thanks for fixing the loop, it really threw me when it didn't show up. Actually, I do have to erase the tail, I just left out that code, along with some other stuff in an effort to keep the posting a little smaller. Thanks for all of the help.
23 years ago
Recently I was working on a small game in which I had to move a vector of points continuously in one direction until the object needed to change directions. (it was a snake game similar to that found on a Nokia cell phone if that helps your visual) In order to accomplish the animation I moved the x and y coordinates of each point in the vector accordingly in the paint method, and then called repaint recursively until the game was over.
So the idea goes something like this:
public void paint(Graphics g)
{
snake.move(direction);
snake.copyInto(snakeArray);
// the above line moves the points in the vector so that
// they will be repainted correctly by the following loop
for (int i = 0; i < snakeArray.length; i++)
{
g.fillRect(snakeArray[i].x, snakeArray[i].y, 5, 5);
}
// make a call to Thread.sleep() to slow down the movement
// make a check for game over
repaint();
}
I have the JPanel listening for the key presses and changing the direction of the snake. Unfortunately there is a slight lag in the movement of my snake so that the control is a little behind the key presses of the user. How can I improve the efficiency of my code so that the control of the snake is more responsive?
Thanks,
Chad
[This message has been edited by Jim Yingst (edited January 17, 2001).]
23 years ago