Search:

Type: Posts; User: 123099

Search: Search took 0.15 seconds.

  1. Replies
    1
    Views
    2,399

    [Help] Snake algorithm

    I've been making a snake game, and everything works, tho the algorythm of the snake movement isnt that good, but its fine.
    Now, I also have an apple on the screen, and the problem is i can't figure...
  2. Re: [Request]Explanation about sending and recieving data

    I tried using the PrintWriter and the BufferedReader but it just waits for me to input something, but thats not what I want.
    I want it to send data automatically without me having to input anything....
  3. Re: [Request]Explanation about sending and recieving data

    The problem is that I can't fully understand how the communication between the socket and the serversocket works.
    What I understood is that for example the server waits for me to write something and...
  4. Re: [Request]Explanation about sending and recieving data

    I've read this article before posting but I didn't understand how the communication is working, because how i see it, it scans input from the keyboard and sends it to the server
    but I need that...
  5. Replies
    4
    Views
    1,728

    Re: Socket not working well

    you might want to try this:


    for(int port=1;port<=65535;port++){
    try{
    Socket s = new Socket("127.0.0.1",port);
    } catch(IOException e){
    System.out.println("port " + port + " is being...
  6. [Request]Explanation about sending and recieving data

    Hey all,
    I am making a multiplayer game and I need to always send the place and state of the character from the client to the server and from the server to the client.
    The question is, how to do...
  7. Replies
    8
    Views
    1,434

    Re: Program won't work on all operation systems

    I haven't programmed using gui a long time so I was making this project to remember coding tricks and the best ways to make some things.
    and yes the 30 is the decoration height which i included in...
  8. Replies
    8
    Views
    1,434

    Re: Program won't work on all operation systems

    I have both windows xp and windows 7.
    Once I've put the JPanel then it didnt include the decoration in the windows height and width as with the JFrame.
    I've written all my code including the...
  9. Replies
    8
    Views
    1,434

    Re: Program won't work on all operation systems

    Because I've already written the code using the Jframe's width and height, once I tried what you suggested it made border problems, and some bugs.
    I do agree that it does make the painting better,...
  10. Replies
    8
    Views
    1,434

    Re: Program won't work on all operation systems

    So instead of extending JFrame in the Main class I should extend JPanel?
    Or am I supposed to create a new class that extends JPanel?
    and how am I supposed to call the paintComponent method? or is...
  11. Replies
    8
    Views
    1,434

    Program won't work on all operation systems

    hey there,
    some of you might have seen my latest post in which i've asked for hep with my pong project.
    Well I've finished it and its working all right, but the problem is that its running corectly...
  12. Replies
    21
    Views
    2,489

    Re: Help with KeyListener and graphics

    Thank you all for your help.
    I've finally finished my project.
    Thanks a lot for all your help!
  13. Replies
    21
    Views
    2,489

    Re: Help with KeyListener and graphics

    The problem was this line:


    if(ball.getX() - (ball.getDiameter()/2)<p1.getX() + p1.getWidth() || ball.getX() + (ball.getDiameter()/2)> p1.getX()){

    The expression was always true because i...
  14. Replies
    21
    Views
    2,489

    Re: Help with KeyListener and graphics

    From the debugging I found the problem.
    It always draws the ball at x - 0, y-1 and it never changes although the other functions are executed till the end.
    The problem was that I've sent to the...
  15. Replies
    21
    Views
    2,489

    Re: Help with KeyListener and graphics

    I'm always doing this, and when I did this all the ball methods execute normally till the end, but it just wont show on the screen.
    And the results after modifying the code again were that the ball...
  16. Replies
    21
    Views
    2,489

    Re: Help with KeyListener and graphics

    Oh right, I was using it before I have modified the code.
    Ill check it and I'll post the results.
  17. Replies
    21
    Views
    2,489

    Re: Help with KeyListener and graphics

    But the problem is, that I'm also using the drawMe function inside the class itself, thus I'll need to send a Graphics object within the class itself also each time I'm using the drawMe() function....
  18. Replies
    21
    Views
    2,489

    Re: Help with KeyListener and graphics

    Here is the code.
    But I have a problem, the ball won't draw, although it moves.
    Main Class:


    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    ...
  19. Replies
    21
    Views
    2,489

    Re: Help with KeyListener and graphics

    never mind solved this bu sending the main object to the racket class through the racket's constructor.
    But if you have a better way to solve this please share.
  20. Replies
    21
    Views
    2,489

    Re: Help with KeyListener and graphics

    ok thanks, but now I have another problem.
    How can I use the reapint method through the Racket class without causing a recursion?
    The problem is that I need to create a new Main object and then use...
  21. Replies
    21
    Views
    2,489

    Re: Help with KeyListener and graphics

    I've changed the code as you said, but the rackets still refuse to move
    this is the new codes(not a lot of difference)
    Main:


    /*
    * To change this template, choose Tools | Templates
    * and...
  22. Replies
    21
    Views
    2,489

    Re: Help with KeyListener and graphics

    Main:


    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    package pongnew;
  23. Replies
    21
    Views
    2,489

    Help with KeyListener and graphics

    I'm making a small pong game, in which there are 2 rackets - 1 of them is moved y the up and down arrows by the user.
    Now, the problem is that when I'm pressing the up and down keys the racket won't...
Results 1 to 23 of 23