Search:

Type: Posts; User: godlynom

Page 1 of 2 1 2

Search: Search took 0.17 seconds.

  1. Replies
    12
    Views
    445

    Re: setting image to panel

    so now that I am using the computer at home with eclipse, I see the error "Can't read input file" should i try making a folder for the image or something else, cuz just putting in the image did not...
  2. Replies
    12
    Views
    445

    Re: setting image to panel

    sorry was not near computer for while, and no it did not :/ still have the white frame screen
  3. Replies
    12
    Views
    445

    Re: setting image to panel

    image = ImageIO.read(new File("ges.jpg"));
    JLabel picLabel = new JLabel(new ImageIcon(image));
    this adds the image to the label, oh, should i do a
    add(picLabel); after that?
  4. Replies
    12
    Views
    445

    Re: setting image to panel

    ah okay, will do that, thanks for that tip, and i am adding the Label when in the Frame class I say
    BackgroundPanel panel = new BackgroundPanel();
    frame.add(panel);
    should I make a panel inside...
  5. Replies
    12
    Views
    445

    Re: setting image to panel

    no, just the program wanted a try and catch
  6. Replies
    12
    Views
    445

    setting image to panel

    Hello all, I am making a 2D Scroller game, and I know how to accomplish it, however, having trouble setting an image to the background, no amount of videos or tutorials is helping. The image does not...
  7. Replies
    21
    Views
    850

    [SOLVED] Re: more help with snake game

    I have figured it out, the snake game is up and running, everything works, all the collides and all, now to customize it how i want, thanks so much for your help both times Norm and anyone else who...
  8. Replies
    21
    Views
    850

    [SOLVED] Re: more help with snake game

    yea, i tested it out, the problem is in my follow method, what i do is i set the x and y of the bodyparts to the x and y of the snake, so now i need to make it so that it appears behind the snake,...
  9. Replies
    21
    Views
    850

    [SOLVED] Re: more help with snake game

    I think it is this code

    if(go)
    {
    int i=0;
    for(SnakeBody s: snake)
    {
    if(snake.indexOf(s)>=1)
    {
    temp1=s;
  10. Replies
    21
    Views
    850

    [SOLVED] Re: more help with snake game

    they are drawn separately, with different x's and y's, but then the next time they move they all become the original snake's x and y and then are drawn upon each other, so it is all the bodyparts in...
  11. Replies
    21
    Views
    850

    [SOLVED] Re: more help with snake game

    okay, yea, my assumption was correct, they do draw, but then their x and y are changed to that of the original snake, thus merging back into one snake
  12. Replies
    21
    Views
    850

    [SOLVED] Re: more help with snake game

    no, they still disappear, are the coordinates getting changed to the first snake's, or is the SnakeBody not being actually drawn, it says it is, trying to figure this out now
  13. Replies
    21
    Views
    850

    [SOLVED] Re: more help with snake game

    well i put the debugger here
    for(SnakeBody s: snake)
    {
    s.draw(g);
    System.out.println(s);
    }
    and each time i got a food it created a new SnakeBody, and then also was drawing them...
  14. Replies
    21
    Views
    850

    [SOLVED] Re: more help with snake game

    well i debugged the paintComponent, and whenever i collide with a food, a new SnakeBody is created and read every single tick, however, it is not being drawn
  15. Replies
    21
    Views
    850

    [SOLVED] Re: more help with snake game

    as an update, i worked on my class and now the snake body parts get created and drawn, but only for a second, so you see the body part and then it disappears, any help?
    Snake class:

    import...
  16. Replies
    21
    Views
    850

    [SOLVED] Re: more help with snake game

    So if I were to make many snake objects, would i just create an:


    ArrayList <SnakeBody> snake = new ArrayList <SnakeBody>();

    and then call them one by one in a for loop based on that?
    ...
  17. Replies
    21
    Views
    850

    [SOLVED] Re: more help with snake game

    The food class did not copy all over, here is the code again


    import java.awt.*;

    public class Food
    {
    double x = 0, y = 0;
    private double myX; // x and y coordinates of center
    ...
  18. Replies
    21
    Views
    850

    [SOLVED] more help with snake game

    Hello all, this is godlynom again, thanks to those who helped me last time. Everything is working, now I just need the body parts to be added after I collide with the food. Essentially everytime you...
  19. Replies
    20
    Views
    890

    [SOLVED] Re: Help with the Snake in a Snake Game

    yea sorry, was at soccer practice
  20. Replies
    20
    Views
    890

    [SOLVED] Re: Help with the Snake in a Snake Game

    ugh dang small problems....thank you so much for your time, have now got it working and everything, thanks so much
  21. Replies
    20
    Views
    890

    [SOLVED] Re: Help with the Snake in a Snake Game

    well a fix to my response, now the coordinates of x and y change when keys are pressed, (questions 1 and 3) and the draw method is called also, but the shapes themselves are not drawing, it is not...
  22. Replies
    20
    Views
    890

    [SOLVED] Re: Help with the Snake in a Snake Game

    The timer printed out the values of the x and y coordinates, following the timer specified at the top, but it does not change the x or y coordinates

    I did :

    System.out.println(x + " " + y);
    ...
  23. Replies
    20
    Views
    890

    [SOLVED] Re: Help with the Snake in a Snake Game

    that was a dumb question, the KeyListener should be in the Snake class, still trying to figure out what is not working, it should be working, mep
  24. Replies
    20
    Views
    890

    [SOLVED] Re: Help with the Snake in a Snake Game

    I am having trouble with the debugging, it is not helping me. If i want to control the SnakeBody object, should i put the KeyListener in the SnakeBody class, or the Snake class?
  25. Replies
    20
    Views
    890

    [SOLVED] Re: Help with the Snake in a Snake Game

    yea, one of the end brackets did not copy over for some reason in the SnakeBody class, and it is not really a problem, I just cannot control the SnakeBody object that is created, like I need to. The...
Results 1 to 25 of 28
Page 1 of 2 1 2