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: Having trouble compiling a executable Jar file in Eclipse

  1. #1
    Member Gravity Games's Avatar
    Join Date
    May 2012
    Posts
    152
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default Having trouble compiling a executable Jar file in Eclipse

    I'm having trouble creating an executable jar file in Eclipse. My program works fine in the Eclipse runtime environment. However, when I use Eclipse to compile the .jar file and try to open it, the window is filled with plain white. I followed all the directions Eclipse game me, so what could be the problem (yes, I let Eclipse generate a manifest file...)?
    Current Projects (and planned release dates):

    Chomp's Wacky Worlds [???] (PC, Android and Ouya)
    Kyle the Caiman [???] (PC, Android and Ouya)
    KTC: King Crocko's Mystic Maze [???] (PC, Android and Ouya)


  2. #2
    Member Gravity Games's Avatar
    Join Date
    May 2012
    Posts
    152
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default Re: Having trouble compiling a executable Jar file in Eclipse

    Found out what it was, those annoying warning "errors" that don't actually stop the game from running Eclipse. I managed to get most of them, but one class has "errors" I can't seem to fix.

    from Character.java
    ...
    public static int x,y,startx;
    	...
    	public Character(int x, int y){
    		this.x=x;
    		this.startx=400;
    		this.y=y;
    ...

    and the errors say that x, startx, and y need to be accessed in a static way. If I make these values non-static, I can't access them from other classes, which is something I need to do. How do I fix these?
    Current Projects (and planned release dates):

    Chomp's Wacky Worlds [???] (PC, Android and Ouya)
    Kyle the Caiman [???] (PC, Android and Ouya)
    KTC: King Crocko's Mystic Maze [???] (PC, Android and Ouya)

  3. #3
    Member Gravity Games's Avatar
    Join Date
    May 2012
    Posts
    152
    Thanks
    6
    Thanked 1 Time in 1 Post

    Default Re: Having trouble compiling a executable Jar file in Eclipse

    Still didn't work. For whatever reason, the JPanel I create refuses to call methods from other objects when compiled (for example, I can't do anotherobject.method(); ), and what I copy into the JPanel seems to work fine, but I quite obviously can't recode and hardcode everything through the JPanel. I already have another object reading level files and spawning objects.
    Last edited by Gravity Games; October 28th, 2012 at 07:38 PM.
    Current Projects (and planned release dates):

    Chomp's Wacky Worlds [???] (PC, Android and Ouya)
    Kyle the Caiman [???] (PC, Android and Ouya)
    KTC: King Crocko's Mystic Maze [???] (PC, Android and Ouya)

  4. #4
    Member Gravity Games's Avatar
    Join Date
    May 2012
    Posts
    152
    Thanks
    6
    Thanked 1 Time in 1 Post

    Exclamation Re: Having trouble compiling a executable Jar file in Eclipse

    Okay, I can not figure out why this is not working, so here's the source:

    Component.java
    package com.gravitygamesinteractive.kylethecaiman;
     
    import javax.swing.*;
    import java.awt.*;
     
    public class Component{
    	private static final long serialVersionUID=1L;
     
    	public static Dimension realsize;
    	public static Dimension size = new Dimension(800,600);
     
    	public static String name="Kyle the Caiman";
    	public static int sx=0,sy=0;
     
    	public static int dir;
    	public static boolean isMoving=false;
    	public static boolean isJumping=false;
     
    	public Component(){
     
    }
    //public static JFrame frame;
    public static void main(String args[]){
    	JFrame frame=new JFrame();
        frame.setSize(size);
    	frame.add(new Main());
    	//frame.pack();
     
    	realsize=new Dimension(frame.getWidth(),frame.getHeight());
     
    	frame.setTitle(name);
    	frame.setResizable(false);
    	frame.setLocationRelativeTo(null);
    	frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    	frame.setVisible(true);
    	frame.addKeyListener(new KeyListen());
    }
     
    }

    Main.java
    package com.gravitygamesinteractive.kylethecaiman;
     
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Image;
     
    import javax.swing.JPanel;
     
    public class Main extends JPanel implements Runnable{
    	private static final long serialVersionUID=1L;
    public static boolean isRunning=false;
     
    	public static Image screen;
     
    	public static Level level;
     
    	public Main(){
    		start();
    	}
    	public void start(){
    		level=new Level();
     
    		isRunning=true;
    		new Thread(this).start();
    	}
     
    	public void tick(){
    		level.tick();
    	}
     
    	public void paint(Graphics g){
    		super.paint(g);
    		level.paint(g);
    	}
     
    	public void run(){
    		//screen=createVolatileImage(Component.size.width,Component.size.height);
    		while(isRunning){
    			tick();
    			repaint();
     
    			try{
    				Thread.sleep(16);
    			}catch(Exception e){
     
    			}
    		}
    	}
     
    }

    Level.java
    package com.gravitygamesinteractive.kylethecaiman;
     
    import java.awt.*;
    import java.util.*;
    import java.io.File;
     
    public class Level {
    	public static ArrayList<Tile> tile=new ArrayList<Tile>();
    	public static ArrayList<Enemy> sprite=new ArrayList<Enemy>();
    	public static Character kyle;
     
    	private Scanner s;
    	private int objectId,spx,spy,spId;
    	public static int minx,maxx,maxy;
    	private String oidstr;
    	private String xstr;
    	private String ystr;
    	private String Idstr;
    	public static ArrayList<String> objarray= new ArrayList<String>();
    	public static ArrayList<String> xarray= new ArrayList<String>();
    	private ArrayList<String> yarray= new ArrayList<String>();
    	private ArrayList<String> Idarray=new ArrayList<String>();
    	public Level(){
    		stageFile();
    		setStage();
    		setScroll();
    	}
     
    	public void tick(){
    		kyle.tick();
    		for(int e=0;e<tile.size();e++){
    			if(tile.get(e).x>Component.sx-32&&tile.get(e).y>Component.sy-32&&tile.get(e).x<Component.sx+Component.size.width+32&&tile.get(e).y<Component.sy+Component.size.height+32){
    			tile.get(e).tick();
    			}
    		}
    		for(int e=0;e<sprite.size();e++){
    			if(sprite.get(e).x>Component.sx-100&&sprite.get(e).y>Component.sy-100&&sprite.get(e).x<Component.sx+Component.size.width+100&&sprite.get(e).y<Component.sy+Component.size.height+100){
    			sprite.get(e).tick();
    			}
    		}
    	}
     
    	public void paint(Graphics g){
    		g.setColor(new Color(153,217,234));
    		g.fillRect(0, 0, Component.size.width, Component.size.height);
    		kyle.paint(g);
    		for(int d=0;d<tile.size();d++){
    			if(tile.get(d).x>Component.sx-32&&tile.get(d).y>Component.sy-32&&tile.get(d).x<Component.sx+Component.size.width+32&&tile.get(d).y<Component.sy+Component.size.height+32){
    			tile.get(d).paint(g);
    			}
    	}
    		for(int t=0;t<sprite.size();t++){
    			if(sprite.get(t).x>Component.sx-32&&sprite.get(t).y>Component.sy-32&&sprite.get(t).x<Component.sx+Component.size.width+32&&sprite.get(t).y<Component.sy+Component.size.height+32){
    			sprite.get(t).paint(g);
    			}	
    	}
    	}
     
    	public void stageFile(){
    		try{
    			String stage = new String("assets/world1hub.txt");
    			s = new Scanner(new File(stage));
    			while(s.hasNextLine()){
    				objectId=s.nextInt();
    	            oidstr=Integer.toString(objectId);
    				objarray.add(oidstr);
    				spx=s.nextInt();
    				xstr=Integer.toString(spx);
    				xarray.add(xstr);
    				spy=s.nextInt();
    				ystr=Integer.toString(spy);
    				yarray.add(ystr);
    				spId=s.nextInt();
    				Idstr=Integer.toString(spId);
    				Idarray.add(Idstr);
    	}
    			s.close();
    	}catch(Exception e){
    		System.out.println("error");
    	}
     
    	}
     
    	public void setStage(){
    		for(int oa=0; oa<objarray.size(); oa++){
    			if(Integer.parseInt(objarray.get(oa))==0){
    				kyle=new Character(Integer.parseInt(xarray.get(oa)),Integer.parseInt(yarray.get(oa))+(45-Character.height));
    			}else if(Integer.parseInt(objarray.get(oa))>255){
    				if(Integer.parseInt(objarray.get(oa))==256)
    			sprite.add(new Aligator(Integer.parseInt(xarray.get(oa)),Integer.parseInt(yarray.get(oa)),35,53,Integer.parseInt(Idarray.get(oa)),256));
    			}
    			else{
    			tile.add(new Tile(Integer.parseInt(objarray.get(oa)),Integer.parseInt(xarray.get(oa)),Integer.parseInt(yarray.get(oa)),Integer.parseInt(Idarray.get(oa))));
     
    			}
    		}
    		//Stages.stage1.setStage();
    		//for (int a = 0; a < objarray.size(); a++) {
    		//new Tile(Integer.parseInt(xarray.get(a)),Integer.parseInt(yarray.get(a)));
    		//}
    	}
    	public void setScroll(){
    		for(int oa=0; oa<objarray.size(); oa++){
    			if(Integer.parseInt(xarray.get(oa))<minx){
    				minx=Integer.parseInt(xarray.get(oa));
    			}
    			if(Integer.parseInt(xarray.get(oa))>maxx){
    			maxx=Integer.parseInt(xarray.get(oa));
    		}
    		if(Integer.parseInt(yarray.get(oa))>maxy){
    			maxy=Integer.parseInt(yarray.get(oa));
    		}
    	}
    	}
    }

    Character.java
    package com.gravitygamesinteractive.kylethecaiman;
     
     
     
     
    import java.awt.*;
    import java.io.File;
    import java.util.Scanner;
    import javax.swing.ImageIcon;
     
     
     
     
     
     
     
     
    public class Character {
    	public int x,y,startx;
    	public static int getx,gety;
    	private static int tiley;
    	private Scanner charfile;
    	public static int health=3;
    	public static int maxhealth=3;
    	public static int width=16,height=45,minsp=3,maxsp=6,accelsp=15,ability=1;
    	public static int fallspeed = 5;
    	public static int moveSpeed = 3;
    	public static int jumpSpeed = 5;
    	public static int jdecCount = 1;
    	public static boolean invinciblehurt=false;
    	public static boolean invinciblepower=false;
    	public static int deathCount = 0;
    	public static int deathTime = 125;
    	public static int invincibleCount = 0;
    	public static int invincibleTime = 125;
    	public static int jumpSpeedcache = 5;
    	public static int jumpHeight=30, jumpCount=0;
    	public static int slopex, slopey, slopetemp;
     
    	public static Image kyle;
    	public static Image kali;
    	public static Image steve;
    	public static Image heart;
    	public static Image heartempty;
    	public static boolean isTouchingFloor;
    	public static boolean canMove;
    	public static boolean isJumping=false;
    	public static boolean allowFall=true;
    	public static boolean fallbypass=false;
     
    	public Character(int x, int y){
    		this.x=x;
    		this.startx=400;
    		this.y=y;
     
    			kyle = resources.ResourceLoader.getImage("Kyle.png");
    			heart = resources.ResourceLoader.getImage("Heart.png");
    			heartempty = resources.ResourceLoader.getImage("HeartEmpty.png");
    		 * *try{
    		 * *	readCharAttributes();
    		 * *}catch(Exception e){
    		 * *	
    		 * *}
     
     
     
     
    	}
     
    	public void tick(){
    		getx=x;
    		gety=y;
    		if(!isJumping && allowFall && !isCollidingWithFloor(new Point(x,(y+height-1)),new Point((x+16),(y+height-1)))){
    			allowFall=true;
    			if(fallspeed<5){
    			if(jdecCount>=2){
    				jdecCount=0;
    				fallspeed+=1;
    			}else{
    				y+=fallspeed;
    				if(Component.sy>0){
    					Component.sy+=fallspeed;
    				}
    				jdecCount+=1;
    			}
    			}else{
    			y+=fallspeed;
    		 * *
    		 * *}
    		if(Component.sy<(Level.maxy+16-Component.size.height)){
    			Component.sy+=(fallspeed);
    		}
    		}else{
    			fallspeed=1;
    				if(Component.isJumping){	
    					isJumping=true;
    					//System.out.println(true);
    					allowFall=true;
    				}else{
    				y=tiley-height;
    				allowFall=false;
    				jumpCount=0;
    				}
    			}
     
    		if(Component.isMoving){
    			if(Component.dir==moveSpeed){
    				canMove = isCollidingWithWall(new Point(x+width,y), new Point(x+width,y+height-5));
    			}else if(Component.dir==-moveSpeed){
    				canMove = isCollidingWithWall(new Point(x-2,y+2), new Point(x-2,y+height-5));
    			}
     
    			if(!canMove){
    			if(Component.dir>0 && x<Level.maxx){
    				x+=Component.dir;
    			}
    			if(Component.dir<0 && x>Level.minx){
    				x+=Component.dir;
    			}
    			if(Component.dir>0 && Component.sx<(Level.maxx+16-Component.size.width) && x>=(startx+Component.sx)){
    			Component.sx+=Component.dir;
    			}
    			if(Component.dir<0 && Component.sx>Level.minx && x<=(startx+Component.sx)){
    				Component.sx+=Component.dir;
    			}
    			if(!isJumping && !isCollidingWithFloor(new Point(x,(y+height)),new Point((x+16),(y+height)))){
    				//if(!fallbypass){
    				allowFall=true;
    				//}
    				}
    			}else{
    				x+=0;
    				Component.sx+=0;
    				Component.dir=0;
    				Component.isMoving=false;
    			}
    			if(isJumping){
    				if(jumpCount>=jumpHeight){
    					if(jumpSpeed==0){
    					isJumping=false;
    					Component.isJumping=false;
    					jumpCount=0;
    					allowFall=true;
    					jumpSpeed=5;
    					}else{
    						if(jdecCount>=2){
    							jdecCount=0;
    							jumpSpeed-=1;
    						}else{
    							y-=jumpSpeed;
    							if(Component.sy>0){
    								Component.sy-=jumpSpeed;
    							}
    							jdecCount+=1;
    						}
    					}
    				}else{
    					y-=jumpSpeed;
    					if(Component.sy>0){
    						Component.sy-=jumpSpeed;
    					}
    					jumpCount+=1;
    				}
    			}
    		}
    		if(invinciblehurt){
    			if(invincibleCount>=invincibleTime){
    				invincibleCount=0;
    				invinciblehurt=false;
    			}else{
    				invincibleCount+=1;
    			}
    		}
    		if(invinciblepower){
    			if(invincibleCount>=invincibleTime){
    				invincibleCount=0;
    				invinciblehurt=false;
    			}else{
    				invincibleCount+=1;
    			}
    		}
    		if(health<=0){
    			if(deathCount>=deathTime){
    				allowFall=true;
    				y+=3;
    			}else{
    				deathCount+=1;
    			}
    		}
    	}
     
    	public boolean isCollidingWithFloor(Point pt1, Point pt2){
    		if(deathCount>=deathTime){
    			isTouchingFloor=false;
    			return false;
    		}else{
    		for(int f=0;f<Level.tile.size();f++){
    			if(Level.tile.get(f).contains(pt1) || Level.tile.get(f).contains(pt2)){
    				if(Level.tile.get(f).id==1 || Level.tile.get(f).id==2 || Level.tile.get(f).id==6){
    				tiley=Level.tile.get(f).y;
    				isTouchingFloor=true;
    				return true;
    				}
    				if(Level.tile.get(f).id==8){
    					if(!invinciblehurt){
    					if(health>1){
    						tiley=Level.tile.get(f).y;
    					isTouchingFloor=true;
    					Component.isJumping=true;
    					KeyListen.downpressed=true;
    					isJumping=true;
    					jumpCount=0;
    					allowFall=true;
    					health-=1;
    					invinciblehurt=true;
    					return true;
    					}else{
    						tiley=Level.tile.get(f).y;
    						isTouchingFloor=true;
    						health-=1;
    						return true;
    					}
    					}else{
    						return true;
    					}
    					}
    				if(Level.tile.get(f).id==9){
    					if (Component.dir>=0){
    						y=slopetemp;
    						return false;
    						}
    						if (Component.dir<0){
    							//y=slopetemp;
    							return false;
    							}
    				}
     
     
    			}
     
    		}
    		isTouchingFloor=false;
    		return false;
    		}
    	}
     
    	public boolean isCollidingWithWall(Point pt1, Point pt2){
    		for(int g=0;g<Level.tile.size();g++){
    			if(Level.tile.get(g).contains(pt1) || Level.tile.get(g).contains(pt2)){
    				if(Level.tile.get(g).id==1 || Level.tile.get(g).id==3 || Level.tile.get(g).id==6 || Level.tile.get(g).id==7 || Level.tile.get(g).id==8){
    				return true;
    				}
    				if(Level.tile.get(g).id==9){
    					if (Component.dir>0){
    					slopex=Level.tile.get(g).x;
    					System.out.println(slopex);
    					//slopey=y;
    					System.out.println(x+16);
    					slopetemp=y-(x+16-slopex);
    					//System.out.println(slopetemp);
    					y=slopetemp;
    					return false;
    					}
    					if (Component.dir<0){
    						slopex=Level.tile.get(g).x;
    						//slopey=y;
    						//x-=Component.dir;
    						//slopetemp=y+(x-slopex);
    						System.out.println(slopetemp);
    						y+=Component.dir;
    						return false;
    						}
    				}
    			}
    		}
    		return false;
    	}
     
    	public void paint(Graphics g){
    		if(invincibleCount % 2 == 0){
    		g.drawImage(kyle,x-8-Component.sx,y-Component.sy,null);
    		}else{
     
    		}
    		if(health<=0){
    			g.drawImage(heartempty,2,2,null);
    			g.drawImage(heartempty,18,2,null);
    			g.drawImage(heartempty,34,2,null);
    		}
    		if(health==1){
    			g.drawImage(heart,2,2,null);
    			g.drawImage(heartempty,18,2,null);
    			g.drawImage(heartempty,34,2,null);
    		}
    		if(health==2){
    			g.drawImage(heart,2,2,null);
    			g.drawImage(heart,18,2,null);
    			g.drawImage(heartempty,34,2,null);
    		}
    		if(health==3){
    			g.drawImage(heart,2,2,null);
    			g.drawImage(heart,18,2,null);
    			g.drawImage(heart,34,2,null);
    		}
    	}
    	public void readCharAttributes(){
    		try{
    			String character = new String("assets/KyleAttributes.txt");
    			charfile = new Scanner(new File(character));
    			while(charfile.hasNextLine()){
    				width=charfile.nextInt();
    				height=charfile.nextInt();
    				minsp=charfile.nextInt();
    				maxsp=charfile.nextInt();
    				accelsp=charfile.nextInt();
    				jumpHeight=charfile.nextInt();
    				ability=charfile.nextInt();
    				System.out.println(width);
    				System.out.println(height);
    				System.out.println(minsp);
    				System.out.println(maxsp);
    				System.out.println(accelsp);
    				System.out.println(jumpHeight);
    				System.out.println(ability);
    	}
    			charfile.close();
    	}catch(Exception e){
    		System.out.println("error");
    	}
    	}
    }

    Tile.Java
    package com.gravitygamesinteractive.kylethecaiman;
     
    import java.awt.*;
    import java.awt.image.*;
    import javax.imageio.*;
    import java.io.*;
     
    public class Tile extends Rectangle{
    	private static final long serialVersionUID=1L;
    	public int id;
    	public int TileId;
     
    	public static int[] g1top={0,0};
    	public static Image tileset1groundlefttop;
    	public static Image tileset1groundtop;
    	public static Image tileset1groundrighttop;
    	public static Image tileset1groundleft;
    	public static Image tileset1ground;
    	public static Image tileset1groundright;
    	public static Image tileset1groundbotleft;
    	public static Image tileset1groundbot;
    	public static Image tileset1groundbotright;
    	public static Image tileset1grounddrytop;
    	public static Image tileset1groundsides;
    	public static Image tileset1trunkslim;
    	public static Image tileset1groundlintersectleft;
    	public static Image tileset1groundlintersect;
    	public static Image tileset1groundlintersectright;
    	public static Image tileset1groundrintersectleft;
    	public static Image tileset1groundrintersect;
    	public static Image tileset1groundrintersectright;
    	public static Image tileset1spike1;
    	public static Image tileset1spike2;
    	public static Image tileset1groundsteepslopel;
    	public Tile(int id,int x, int y, int TileId){
    		this.id=id;
    		this.x=x;
    		this.y=y;
    		this.TileId=TileId;
    		this.width=16;
    		this.height=16;
    			tileset1groundlefttop = resources.ResourceLoader.getImage("tileset1_1.png");
    			tileset1groundtop = resources.ResourceLoader.getImage("tileset1_2.png");
    			tileset1groundrighttop = resources.ResourceLoader.getImage("tileset1_3.png");
    		    tileset1groundleft = resources.ResourceLoader.getImage("tileset1_4.png");
    		    tileset1ground = resources.ResourceLoader.getImage("tileset1_5.png");
    		    tileset1groundright = resources.ResourceLoader.getImage("tileset1_6.png");
    		    tileset1groundbotleft = resources.ResourceLoader.getImage("tileset1_7.png");
    		    tileset1groundbot = resources.ResourceLoader.getImage("tileset1_8.png");
    		    tileset1groundbotright = resources.ResourceLoader.getImage("tileset1_9.png");
    		    tileset1grounddrytop = resources.ResourceLoader.getImage("tileset1_10.png");
    		    tileset1groundsides = resources.ResourceLoader.getImage("tileset1_11.png");
    		    tileset1trunkslim = resources.ResourceLoader.getImage("tileset1_12.png");
    		    tileset1groundlintersectleft = resources.ResourceLoader.getImage("tileset1_13.png");
    		    tileset1groundlintersect = resources.ResourceLoader.getImage("tileset1_14.png");
    		    tileset1groundlintersectright = resources.ResourceLoader.getImage("tileset1_15.png");
    		    tileset1groundrintersectleft = resources.ResourceLoader.getImage("tileset1_14.png");
    		    tileset1groundrintersect = resources.ResourceLoader.getImage("tileset1_14.png");
    		    tileset1groundrintersectright = resources.ResourceLoader.getImage("tileset1_14.png");
    		    tileset1spike1= resources.ResourceLoader.getImage("tileset1_19.png");
    		    tileset1spike2 = resources.ResourceLoader.getImage("tileset1_20.png");
    		    tileset1groundsteepslopel = resources.ResourceLoader.getImage("tileset1_21.png");
    	}
     
    public void tick(){
    	if(!Character.isJumping && !Character.isTouchingFloor){
    		//y=y-Character.fallspeed;
    		//this.y=y-Character.fallspeed;
    	}
    	if(Character.isJumping){
    		if(Character.jumpCount>=Character.jumpHeight){
    			//y=y-Character.fallspeed;
    			//this.y=y-Character.fallspeed;
    		}else{
    		//y=y+Character.fallspeed;
    		//this.y=y+Character.fallspeed;
    		}
    	}
    	//x=x-Component.dir;
    	//this.x=x-Component.dir;
    	//System.out.println(this.x);
    	//System.out.println(this.y);
    }
     
    	public void paint(Graphics g){
    		g.setColor(Color.red);
    		if (TileId==1){
    		g.drawImage(tileset1groundlefttop,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==2){
    			g.drawImage(tileset1groundtop,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==3){
    			g.drawImage(tileset1groundrighttop,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==4){
    			g.drawImage(tileset1groundleft,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==5){
    			g.drawImage(tileset1ground,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==6){
    			g.drawImage(tileset1groundright,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==7){
    			g.drawImage(tileset1groundbotleft,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==8){
    			g.drawImage(tileset1groundbot,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==9){
    			g.drawImage(tileset1groundbotright,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==10){
    			g.drawImage(tileset1grounddrytop,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==11){
    			g.drawImage(tileset1groundsides,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==12){
    			g.drawImage(tileset1trunkslim,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==13){
    			g.drawImage(tileset1groundlintersectleft,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==14){
    			g.drawImage(tileset1groundlintersect,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==15){
    			g.drawImage(tileset1groundlintersectright,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==16){
    			g.drawImage(tileset1groundrintersectleft,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==17){
    			g.drawImage(tileset1groundrintersect,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==18){
    			g.drawImage(tileset1groundrintersectright,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==19){
    			g.drawImage(tileset1spike1,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==20){
    			g.drawImage(tileset1spike2,x-Component.sx,y-Component.sy,null);
    		}
    		if (TileId==21){
    			g.drawImage(tileset1groundsteepslopel,x-Component.sx,y-Component.sy,null);
    		}
    	}
    }

    Enemy.java
    package com.gravitygamesinteractive.kylethecaiman;
     
    import java.awt.*;
     
    public class Enemy extends Rectangle{
    	private static final long serialVersionUID=1L;
    	public int movementSpeed;
    	public int dir;
    	public int fallSpeed;
    	public int jumpSpeed;
    	public int ide;
     
    	public Enemy(int x, int y, int width, int height, int ide){
    		setBounds(x,y,width,height);
     
    	}
    	public void tick(){
     
    	}
     
    	public void paint(Graphics g){
     
    	}
     
    }

    Aligator.java
    package com.gravitygamesinteractive.kylethecaiman;
     
    import java.awt.*;
    import java.io.File;
    import java.io.IOException;
     
    import javax.imageio.ImageIO;
     
    public class Aligator extends Enemy{
    	public int fallSpeed=5,movementSpeed=1,dir=0,ide=256;
    	private int jdecCount=0,tiley,exbit1,health=1;
    	private static final long serialVersionUID=1L;
    	public static Image gator;
    	public boolean isCollidingWithFloor,isCollidingWithWall,allowFall;
    	public Aligator(int x, int y, int width, int height, int exbit1, int ide){
    		super(x,y,35,53,256);
    		this.exbit1=exbit1;
    		this.ide=ide;
    		gator = resources.ResourceLoader.getImage("Gator.png");
    	    if(this.exbit1==0){
    			dir=0;
    		}else{
    			dir=1;
    		}
    	}
     
    public void tick(){
    	if(health>0){
    	super.tick();
    	if(!allowFall&&!isCollidingWithFloor(new Point(x,(y+height)),new Point((x+width),(y+height)))){
    		if(!isCollidingWithWall(new Point(x+width,y), new Point(x+width,y+height-1))&&!isCollidingWithWall(new Point(x,y), new Point(x,y+height-1))){
    			if(dir==0){
    				x-=movementSpeed;
    			}else{
    				x+=movementSpeed;
    			}
    			}else{
    				if(dir==0){
    					x-=movementSpeed;
    				}else{
    					x+=movementSpeed;
    				}
    			}
    	if(fallSpeed<5){
    		if(jdecCount>=2){
    			jdecCount=0;
    			fallSpeed+=1;
    		}else{
    			y+=fallSpeed;
    			if(Component.sy>0){
    				Component.sy+=fallSpeed;
    			}
    			jdecCount+=1;
    		}
    }else{
    	y+=fallSpeed;
    }
    }else{
    	fallSpeed=1;
    	y=tiley-height;
    	allowFall=false;
    	if(!isCollidingWithWall(new Point(x+width,y), new Point(x+width,y+height-1))&&!isCollidingWithWall(new Point(x,y), new Point(x,y+height-1))){
    	if(dir==0){
    		x-=movementSpeed;
    	}else{
    		x+=movementSpeed;
    	}
    	}else{
    		if(dir==0){
    			x-=movementSpeed;
    		}else{
    			x+=movementSpeed;
    		}
    	}
    }
    	if(Character.gety+Character.height<=y+19&&Character.gety+Character.height>=y&&Character.getx>=x&&Character.getx<=x+width){
    		//Character.tiley=Level.tile.get(z).y;
    		Character.isTouchingFloor=true;
    		Component.isJumping=true;
    		KeyListen.downpressed=true;
    		Character.isJumping=true;
    		Character.jumpCount=0;
    		allowFall=true;
    		health-=1;
    	}else if(Character.gety+Character.height>=y+19&&Character.gety+Character.height<=y+height&&Character.getx>=x&&Character.getx<=x+width){
    		if(!Character.invinciblehurt && !Character.invinciblepower){
    		Character.health-=1;
    		Character.invinciblehurt=true;
    		}else if(Character.invinciblepower){
    			health-=1;
    		}
    	}
    }
    }
     
     
    public void paint(Graphics g){
    	if(health>0){
    	super.paint(g);
    	g.setColor(Color.red);
    	g.drawRect(x-Component.sx, y-Component.sy, 16, 44);
    	g.drawImage(gator,x-Component.sx,y-Component.sy,null);
    	}
    }
     
    public boolean isCollidingWithFloor(Point pt1, Point pt2){
    	for(int f=0;f<Level.tile.size();f++){
    		if(Level.tile.get(f).contains(pt1) || Level.tile.get(f).contains(pt2)){
    			if(Level.tile.get(f).id==1 || Level.tile.get(f).id==2 || Level.tile.get(f).id==6){
    			tiley=Level.tile.get(f).y;
    			//isTouchingFloor=true;
    			return true;
    			}
    			if(Level.tile.get(f).id==8){
    				//if(health>1){
    					tiley=Level.tile.get(f).y;
    				//isTouchingFloor=true;
    				//Component.isJumping=true;
    				//KeyListen.downpressed=true;
    				//isJumping=true;
    				//jumpCount=0;
    				//allowFall=true;
    				health-=1;
    				return true;
    				//}else{
    					//tiley=Level.tile.get(f).y;
    					//isTouchingFloor=true;
    					//health-=1;
    					//return true;
    				//}
    				}
    			if(Level.tile.get(f).id==9){
    				if (Component.dir>=0){
    					//y=slopetemp;
    					return false;
    					}
    					if (Component.dir<0){
    						//y=slopetemp;
    						return false;
    						}
    			}
     
     
    		}
    	}
     
    	//isTouchingFloor=false;
    	return false;
    }
     
    public boolean isCollidingWithWall(Point pt1, Point pt2){
    	for(int g=0;g<Level.tile.size();g++){
    		if(Level.tile.get(g).contains(pt1) || Level.tile.get(g).contains(pt2)){
    			if(Level.tile.get(g).id==1 || Level.tile.get(g).id==3 || Level.tile.get(g).id==6 || Level.tile.get(g).id==7 || Level.tile.get(g).id==8){
    				if(dir==0){
    					dir=1;
    				}else{
    					dir=0;
    				}
    				return true;
    			}
    			if(Level.tile.get(g).id==9){
    				if (Component.dir>0){
    				//slopex=Level.tile.get(g).x;
    				//System.out.println(slopex);
    				//slopey=y;
    				//System.out.println(x+16);
    				//slopetemp=y-(x+16-slopex);
    				//System.out.println(slopetemp);
    				//y=slopetemp;
    					if(dir==0){
    						dir=1;
    					}else{
    						dir=0;
    					}
    				return true;
    				}
    				if (Component.dir<0){
    					//slopex=Level.tile.get(g).x;
    					//slopey=y;
    					//x-=Component.dir;
    					//slopetemp=y+(x-slopex);
    					//System.out.println(slopetemp);
    					//y+=Component.dir;
    					if(dir==0){
    						dir=1;
    					}else{
    						dir=0;
    					}
    					return true;
    					}
    			}
    		}
    	}
    	return false;
    }
    }

    Manifest.txt
    Manifest-Version: 1.0
    Main-Class: com.gravitygamesinteractive.kylethecaiman.Component

    ResourceLoader.java
    package resources;
    import java.awt.Image;
    import java.awt.Toolkit;
     
    public class ResourceLoader {
     
    	static ResourceLoader rl=new ResourceLoader();
     
    	public static Image getImage(String Filename){
    		return Toolkit.getDefaultToolkit().getImage(rl.getClass().getResource("images/"+Filename));
    	}
     
    }
    Please help me figure out why compiling this to a jar isn't working...
    Last edited by Gravity Games; October 28th, 2012 at 09:43 PM.
    Current Projects (and planned release dates):

    Chomp's Wacky Worlds [???] (PC, Android and Ouya)
    Kyle the Caiman [???] (PC, Android and Ouya)
    KTC: King Crocko's Mystic Maze [???] (PC, Android and Ouya)

Similar Threads

  1. This is a link to full executable jar file.
    By rajeshverma in forum Java Theory & Questions
    Replies: 26
    Last Post: June 30th, 2012, 04:17 AM
  2. [SOLVED] no sound from executable jar file
    By cl2606 in forum What's Wrong With My Code?
    Replies: 17
    Last Post: June 8th, 2011, 06:41 PM
  3. Jar Executable File Not Working
    By Kimimaru in forum Java Theory & Questions
    Replies: 6
    Last Post: October 15th, 2010, 09:32 PM
  4. Jar Executable File
    By The_Mexican in forum What's Wrong With My Code?
    Replies: 43
    Last Post: June 23rd, 2010, 03:53 PM
  5. [SOLVED] Executable .jar file isn’t launched after being double-clicked
    By voltaire in forum Java Theory & Questions
    Replies: 6
    Last Post: May 18th, 2010, 03:37 PM