Results 1 to 5 of 5
Like Tree2Likes
  • 2 Post By Norm

Thread: i'm totally new in java..help me to [build snake game using java]

  1. #1
    nabil is offline Member
    Join Date
    Jan 2012
    Posts
    17
    Rep Power
    0

    Default i'm totally new in java..help me to [build snake game using java]

    hello guys..i'm new in java..
    i got final project to do and my lecturer asked me to build a snake game using java..

    my question is:

    Can somebody help me in creating a menu for that snake game which contain selection like "play","credits" and "exit"..

    and can somebody teach me how to link from one class to the other class such as "snake.java" class to connect with "board.java" class??


    please guys,i'll appreciate u guys help..

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,449
    Rep Power
    25

    Default Re: i'm totally new in java..help me to [build snake game using java]

    Post your code and the problems you are having with it.

    how to link from one class to the other class
    This can be done by passing a reference in a constructor.
    In one class:
    OtherClass ocRef = new OtherClass(this); // pass a reference to this class to the constructor of other class

    Now OtherClass has a reference to this class and can call its methods.
    Fubarable and Eranga like this.

  3. #3
    nabil is offline Member
    Join Date
    Jan 2012
    Posts
    17
    Rep Power
    0

    Default Re: i'm totally new in java..help me to [build snake game using java]

    thanks a lot norm..how long have you been in this java world??i just starting to learn JAVA 8 months ago and now my lecturer asked me to build a java game..

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,449
    Rep Power
    25

    Default Re: i'm totally new in java..help me to [build snake game using java]

    Building a game is a good way to get started.

  5. #5
    quad64bit's Avatar
    quad64bit is offline Moderator
    Join Date
    Jul 2009
    Location
    VA
    Posts
    1,323
    Rep Power
    7

    Default Re: i'm totally new in java..help me to [build snake game using java]

    Games were the first things that really got me interested in programming. My first was a text based adventure game! Good times :D Snake is a great first game, it can be implemented simply using girds/tiles or shapes/images. The input is simple, and the logic isn't complicated. Map out the features you would like to use first, and consider how they would work during gameplay. Then start small with your implementation - get a window on the screen, get an image to appear, get a buttonListener to work for user input. Once all of those things work, then you can use what you learned to start building the actual game. Things like pulldown menus should be one of your last considerations, as they are simple and not vital to basic gameplay.

    When you do get that far, here is the official JMenu tutorial: How to Use Menus (The Java™ Tutorials > Creating a GUI With JFC/Swing > Using Swing Components)

Similar Threads

  1. Snake Game in Java
    By Shyamz1 in forum New To Java
    Replies: 4
    Last Post: 02-10-2011, 02:49 PM
  2. Snake game in java
    By freaky in forum New To Java
    Replies: 5
    Last Post: 04-20-2010, 06:34 PM
  3. Java Applet Help - Making "Snake" Game
    By Alphimeda in forum Java Applets
    Replies: 15
    Last Post: 04-04-2010, 05:39 PM
  4. Snake Game
    By mustachMan in forum New To Java
    Replies: 2
    Last Post: 12-10-2009, 10:35 PM
  5. Snake game movement
    By BeerMonkey in forum New To Java
    Replies: 9
    Last Post: 11-27-2008, 12:48 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •