Page 3 of 3 FirstFirst 123
Results 41 to 45 of 45
Like Tree3Likes

Thread: My game isn't working

  1. #41
    sancho is offline Member
    Join Date
    Apr 2016
    Posts
    25
    Rep Power
    0

    Default Re: My game isn't working

    In the eclipse works fine, but as a runnable Jar file the game stopped working at the score 149. I don't know why.

  2. #42
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: My game isn't working

    You are going to have to write some debugging (println statements) then and execute the jar file from the command line so you can see what's happening.
    We can't help with that.
    You need to use println in the places you think it's going wrong to narrow down exactly what's going on.
    sancho likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  3. #43
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,994
    Rep Power
    32

    Default Re: My game isn't working

    game stopped working at the score 149. I don't know why.
    What does "stops at the score 149" mean?
    Does that mean the game works correctly for score 0 and score 1 and score 2 etc up to score 148?


    Time to do some debugging to see why the game stops.
    What is different about the what the game is doing when the score goes past 148?
    If you don't understand my response, don't ignore it, ask a question.

  4. #44
    sancho is offline Member
    Join Date
    Apr 2016
    Posts
    25
    Rep Power
    0

    Default Re: My game isn't working

    Does that mean the game works correctly for score 0 and score 1 and score 2 etc up to score 148?
    Yes.

    I'll use the Debug to find out the problem, i don't know how to use but youtube probably has a tutorial.
    Thanks for the excellent support guys i appreciate it!

  5. #45
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: My game isn't working

    Taking your example from earlier, this is the sort of thing I would do, if this is the area throwing issues:

    Java Code:
    import java.awt.Image;
    import java.awt.Rectangle;
    
    import javax.swing.ImageIcon;
    
    public class Enimes extends Caracteristica{
    	static int cont = 0;
    	public Enimes(int x, int y){
    		this.x = x;
    		this.y = y;
    
    		System.out.println("x = " + x + ", y = " + y + ", cont = " + cont);		
    
    		ImageIcon refEnemy;
    		if(cont++ % 3 == 0){
    			refEnemy = new ImageIcon(getClass().getResource("Asteroid.png"));
    		}
    		 
    		else if(cont++ % 2 == 0){   
    			refEnemy = new ImageIcon(getClass().getResource("asteroid2.png"));
    		}
    			
    		else if(cont++ % 4  == 0){   
    			refEnemy = new ImageIcon(getClass().getResource("asteroid2s.png"));
    			 
    		}
    		
    		else{
    			refEnemy = new ImageIcon(getClass().getResource("Rock_Asteroid.png"));
    		}
    		img = refEnemy.getImage();
    possibly also inside the if statements as markers.
    It all depends where the issue lies.

    You may end up with hundreds of lines of output...
    sancho likes this.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Page 3 of 3 FirstFirst 123

Similar Threads

  1. Tic Tac Toe game - winning logic not working.
    By Mikki in forum New To Java
    Replies: 21
    Last Post: 11-05-2012, 08:51 PM
  2. working on a pacman game need help
    By paris72 in forum Java Gaming
    Replies: 2
    Last Post: 06-04-2012, 10:04 AM
  3. Game using swings not working
    By humanbeing in forum Java Gaming
    Replies: 7
    Last Post: 10-06-2010, 03:04 PM
  4. Game Help.working on it for days,.
    By xSkittlesx in forum Java Applets
    Replies: 12
    Last Post: 05-31-2010, 03:24 PM
  5. Gueesing Game Almost done, but not working correctly
    By mbnumba6 in forum New To Java
    Replies: 5
    Last Post: 03-18-2009, 03:01 AM

Tags for this Thread

Posting Permissions

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