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.


>> REGISTER NOW TO START POSTING


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

Results 1 to 4 of 4

Thread: java game bullets hit player 1 but not player 2

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java game bullets hit player 1 but not player 2

    hey guys me again :/ i;ve almost finished the game now but i still have 1 problem, the bullets will hit player 1 and player 2 can win but player 1's bullets do not hit where the the hit area is and goes straight through player 2 any ideas y? if needed i will post the code


  2. #2
    Forum Squatter newbie's Avatar
    Join Date
    Nov 2010
    Location
    North Wales
    Posts
    661
    My Mood
    Stressed
    Thanks
    28
    Thanked 115 Times in 106 Posts
    Blog Entries
    1

    Default Re: java game bullets hit player 1 but not player 2

    Is player 2 hiding in a bunker?
    Please use [highlight=Java]//code goes here...[/highlight] tags when posting your code

  3. #3
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,166
    Thanks
    65
    Thanked 2,725 Times in 2,675 Posts

    Default Re: java game bullets hit player 1 but not player 2

    any ideas
    Your logic needs work. You have some bugs in your code.
    Try debugging the code by adding printlns to show the values of variables as they change and when they are compared to other variables. Look at what is printed out when the "bullet goes straight through player 2". Compare those values to the ones where player 1 is hit.

  4. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,424
    My Mood
    Hungover
    Thanks
    144
    Thanked 636 Times in 540 Posts

    Default Re: java game bullets hit player 1 but not player 2

    Quote Originally Posted by ajakking789 View Post
    if needed i will post the code
    If you want help, you'll have to post an SSCCE that demonstrates the problem. The smaller you make it, the better. We really don't have a ton of time to wade through game logic.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. java game, both players move for player 2 but not player 1
    By ajakking789 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: August 21st, 2011, 12:52 PM
  2. 2 Player Poker Game Troubles
    By Kaltonse in forum What's Wrong With My Code?
    Replies: 2
    Last Post: December 21st, 2010, 01:20 PM
  3. [SOLVED] Platform game player doesn't respond to keyboard
    By jesamjasam in forum What's Wrong With My Code?
    Replies: 4
    Last Post: December 12th, 2010, 09:44 AM
  4. Java Mp3 player.
    By alex901 in forum Object Oriented Programming
    Replies: 4
    Last Post: November 18th, 2010, 09:12 AM
  5. [ASK] JMF Class Player
    By bocahTuaNakalzz in forum Java SE APIs
    Replies: 2
    Last Post: December 8th, 2009, 03:40 AM