That's what we're are trying to do in our code. As of right now there is no code that would attach these together except for what we are trying in the moveRectangle method which is obviously wrong...
Type: Posts; User: Edmacelroy
That's what we're are trying to do in our code. As of right now there is no code that would attach these together except for what we are trying in the moveRectangle method which is obviously wrong...
So basically this is the snake game. We want the head to create another body part that attaches to it after it eats the piece of food. We are having troubles with this, we can get the the body part...
Ah thank you much
Hi everyone,
I will try the getting help somewhere else instead. Thanks anyway don't know how to delete
Yup needed to use the intersects() method. Thank you that solved the issue
OK, finally got both the rectangles to show up. Now the problem is with my if statement in the snake frame. It seems when I try to match up the two Food_X + Food_Y coordinates to the Box_X and Box_Y...
No never used a debugger for java. I'm going in tonight for some help to see if the SI can help me figure it out. I'm just not understanding why it's not showing up if the other rectangle shows up...
Isn't the paintComponent() of the food item being called when I return food in the getRectangle method and than call the getRectangle Method in public snakeFood() as seen here in this code
food...
Ah yes that is a great idea, in fact an SI showed me this trick with my keypressed listener and I forgot about it. I will give that a shot and let you know what I figure out.
--- Update ---
Ok...
Yeah I think you're right about the infinite recursion and think it was probably put in on accident and I removed it. I put in the super.paintComponent(g) and that didn't seem to work. I understand...
I'm having trouble getting the program to randomly display the food. Right now I'm just trying to get a rectangle box to randomly display in some x,y coordinates and the program is doing this and...
Nice, only took me like three days and almost gave up. Finally got it working. Huge Thank you to KevinWorkman for helping me out most of the way and Norm that was it just had to do exactly what you...
Ok so I declared the boolean variables in the RectangleFrame3 class so they can be accessed through that entire class. I tested it and they seem to work somewhat. So I can now get it to automatically...
I'm still not getting it.. Do i just have to declare the boolean variables in both the key listener and timer listener classes. I guess the examples I'm just not following because I'm working with...
Yes exactly, I want the user to press down the key and when release the rectangle should automatically keep moving in the direction of the arrow key the user pressed and released.
In your Timer...
Ok here is what I did so far. I guess now that I've created the boolean values, I'm confused now how to determine the keys pressed in the timer event.
With this code my rectangle moves the...
Hi everyone,
I'm creating a snake game and I need some help getting the rectangle to move automatically when a arrow key is pressed by a user. I got it right now that it will move the amount in...
Yeah I've read about 11 chapters in my Big Java book and Chapter 10 was all about this. I just don't understand what is going wrong when applying this class to the array and why it won't find that...
It's supposed to be an inner class within the main method here is the code for it
class ClickListener implements ActionListener
{
public void actionPerformed(ActionEvent event) ...
Thanks for the quick response, I thought that would be the case just wasn't sure. So loop through each JButton in the array and add the ActionListener to them. This is what I did and I'm getting...
Here is my code. It's for a tic tac toe program and i'm trying to get my Listener to work so it knows what to display but it's throwing me an error.
Code first here it is:
import...
How do I continually update the GUI exactly ?? That is exactly what I'm trying to do.
My issue is I can't get the current time to start counting by seconds for example 22:17:51 - 22:17:52 - 22:17:53. Any help will be greatly appreciated and here is my code so far. I can get the time...
This code seems to work well
Now I really just have to study this code because I did so much wrong. I can't thank you enough for all of your help and taking the time to walk me through this so...
ok, here is what i have got done so far. I tried to get the name of the highest calorie item to display but still get the last item displayed. Everything else seems to be working, still struggling a...