Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: code to move an object in grid

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Thanked 0 Times in 0 Posts

    Question code to move an object in grid

    Can anyone help me out with some code that displays the random movement of an object such as Move 1: (0,1) Move 2: (10,99)?

    I need these methods in the class

    void initialize( int xPos, int yPos)
        void moveLeft()
        void moveRight()
        void moveUp()
        void moveDown()
        int getXPosition()
        int getYPosition()


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,460 Times in 2,411 Posts

    Default Re: code to move an object in grid

    What have you tried? Be sure to wrap any posted code in code tags.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Chess Game. Code to move pieces.
    By Vas87thRD in forum What's Wrong With My Code?
    Replies: 1
    Last Post: February 12th, 2014, 03:41 AM
  2. Replies: 2
    Last Post: June 4th, 2013, 08:09 PM
  3. Move an object
    By jan4185 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: February 7th, 2013, 02:43 PM
  4. Object Speed problem! (move();)
    By Optimizer in forum What's Wrong With My Code?
    Replies: 9
    Last Post: January 13th, 2013, 06:24 PM
  5. Making a method to move blocks in a grid
    By geforce in forum What's Wrong With My Code?
    Replies: 60
    Last Post: May 22nd, 2012, 07:00 AM