Jump to content

  • Log In with Google      Sign In   
  • Create Account


Black Sun

Member Since 24 Aug 2011
Offline Last Active Dec 05 2011 03:43 PM

Topics I've Started

Any Good Java3D tutorials anywhere?

19 November 2011 - 04:45 AM

Hey guys. Ive been programming in java with Java3D API. its really good!
Ive managed to make terrain, show.obj,player movement, lights and object movement.

I was wandering if anyone knew of any good java3D tutorials anywhere? ive read the api tutorial but it isnt really my kind of style.

DirectX Visual C# installation. Please Help!? :)

15 November 2011 - 12:52 PM

Hey guys. I need help in installing DirectX for Visual C#.
I have the sdk installed into vista but it wont work in Visual. I have the include folder but all the files are .h files and they dont work with visual c# for some reason. Help?

Help Again with wire coding (java)

26 October 2011 - 03:08 PM

Sorry guys need some help again.

Im writing a "sequel" to a game ive made called Extron.

Ive written the first classes of code. At the moment im running into a obstacle, Wire. -_-
Basically, I need help coding the wire of the game. I want the wire to be based on a boolean powered. I want it to be very fast and responsive but i have literally no idea how to code this.
I have an idea of how it would work but i have no idea how to code it.

The complete code of the game so far (the game is using slick2d):

package Main;

import org.newdawn.slick.*;
import Main.Components.*;

public class Main extends BasicGame {

	static int width = 1280;
	static int height = 800;
	int tilesize = 5;
	int xtiles = (width/tilesize);
	int ytiles = (height/tilesize);
	int Keyset = 0;
	Tile[][] tile;
	
	public Main() {
		super("CompTron");
		
	}
	public void render(GameContainer arg0, Graphics g) throws SlickException {
		switch(Keyset){
		case 0:
			g.setColor(Color.white);
			g.drawString("Wire", 10, 10);
			break;
		
    	case 1:
		g.setColor(Color.white);
		g.drawString("BaseComponent", 10, 10);
		break;
		} 

		for(int x = 0; x < xtiles; x++){
			for(int y = 0; y < ytiles; y++){
				if(tile[x][y].type != Type.base ){
					tile[x][y].Draw(g);
				}
			}
		}
	}
	public void init(GameContainer arg0) throws SlickException {
	tile = new Tile[xtiles][ytiles];
	for(int i = 0, x = 0;i < xtiles; i++, x += tilesize){
		for(int b = 0, y = 0; b < ytiles; b++, y += tilesize){
			tile[i][b] = new Tile(x,y);
		}
	}
		
	}
	public void update(GameContainer gc, int arg1) throws SlickException {
		
		for(int i = 0; i  < xtiles; i++){
			for(int b = 0; b  < ytiles; b++){
				if(tile[i][b].type != Type.base){
				try{
				
				tile[i][b].Interact(tile[i][b - 1], tile[i][b + 1], tile[i - 1][b], tile[i + 1][b]);
				}catch(Exception e){}
				}
			}
		}
		
		
		
		
		
		Input in = gc.getInput();
		if(in.isKeyDown(in.KEY_ESCAPE)){
			System.exit(0);
		}
		if(in.isKeyDown(in.KEY_1)){
			Keyset = 0;
		}
		if(in.isKeyDown(in.KEY_2)){
			Keyset = 1;
		}
		if(in.isMouseButtonDown(in.MOUSE_LEFT_BUTTON)){
			
			for(int i = 0;i < xtiles; i++){
				for(int b = 0; b < ytiles; b++){
					if(tile[i][b].occupied == false){
					if(tile[i][b].x > in.getMouseX() - 5){
						if(tile[i][b].x < in.getMouseX()){
						  if(tile[i][b].y > in.getMouseY() - 5){
							if(tile[i][b].y < in.getMouseY()){
								
								
								
								switch(Keyset){
								
								case 0:
						       	tile[i][b] = new Wire(tile[i][b].getX(), tile[i][b].getY());
						       	break;
								case 1:
 						       	tile[i][b] = new BaseComponent(tile[i][b].getX(), tile[i][b].getY());
 						       	break;
							
								}
							}
						   }
						  }
						}
						 }
					
				}
			}
		}
		
		if(in.isMouseButtonDown(in.MOUSE_RIGHT_BUTTON)){
			for(int i = 0;i < xtiles; i++){
				for(int b = 0; b < ytiles; b++){
					if(tile[i][b].x > in.getMouseX() - 5){
						if(tile[i][b].x < in.getMouseX()){
						  if(tile[i][b].y > in.getMouseY() - 5){
							if(tile[i][b].y < in.getMouseY()){
								
						       	tile[i][b].setType(Type.base);
						       	tile[i][b].setOccupied(false);
							}
						   }
						  }
						 }
					
				}
			}
		}
	}
		
	
	public static void main(String[] args) 
			throws SlickException
	{
     	AppGameContainer app = 
			new AppGameContainer(new Main());
 
     	app.setDisplayMode(width,height, true);
     	app.setShowFPS(false);
     	app.start();
	}

}
package Main;

import org.newdawn.slick.Graphics;


public class Tile {
int x;
int y;
int xsize;
String license = "";
int ysize;
Type type = Type.base;
boolean occupied = false;
boolean powered = false;
int source;
	public Tile(int x, int y){
		this.x = x;
		this.y = y;
		xsize = 5;
		ysize = 5;
	}

	public void Draw(Graphics g){}
	public void Interact(Tile up,Tile down, Tile left, Tile right){}
	public void Init(){}
	public int getX(){
		return x;
	}
	public int getY(){
		return y;
	}
	public int getXsize(){
		return xsize;
	}
	public int getYsize(){
		return ysize;
	}
	public void setX(int x){
		this.x = x;
	}
	public void setY(int y){
		this.y = y;
	}
	public void setXsize(int xsize){
		this.xsize = xsize;
	}
	public void setYsize(int ysize){
		this.ysize = ysize;
	}
	public void setType(Type type){
		this.type = type;
	}
	public void setOccupied(boolean occupied){
		this.occupied = occupied;
	}
	public void Update(){}
	public void setLicense(String license){
		this.license = license;
	}
	public String getLicense(){
		return license;
	}
	public boolean getPowered(){
		return powered;
	}
	public void setPowered(boolean powered){
		this.powered = powered;
	}
	public int getSource(){
		return source;
	}
	public void setSource(int source){
		this.source = source;
	}
	


}
package Main;

public enum Type {

	base, tile
	
}
package Main.Components;



import org.newdawn.slick.*;
import Main.*;

public class BaseComponent extends Component{


	public BaseComponent(int x, int y) {
		super(x, y);
		setType(Type.tile);
		setLicense("BaseComponent");
	}


	public void Draw(Graphics g) {
		g.setColor(Color.gray);
		g.fillRect(getX(), getY(), getXsize(), getYsize());
		
	}


	public void Update() {
		
		
	}

	public void Interact(Tile up,Tile down, Tile left, Tile right) {
		
		
	}



	public void Init() {
		
		
	}


	

	

}
package Main.Components;



import Main.*;

public abstract class Component extends Tile {

public Component(int x, int y) {
		super(x, y);
	
	}
Tile[] in = new Tile[100];
Tile[] out = new Tile[100];

public void setIn(Tile input, int inputnum){
	in[inputnum] = input;
	
}
public void setOut(Tile output, int outputnum){
	out[outputnum] = output;
}




}
package Main.Components;



import org.newdawn.slick.*;
import Main.Tile;
import Main.Type;

public class Wire extends Tile {
	
	
	
	public Wire(int x, int y){
		super(x,y);
		setType(Type.tile);
		Init();
    	setOccupied(true);
    	setLicense("Wire");
		
	}
	


	public void Interact(Tile up,Tile down, Tile left, Tile right) {
		if(up.getLicense() == "BaseComponent" || down.getLicense() == "BaseComponent" || left.getLicense() == "BaseComponent" || right.getLicense() == "BaseComponent" ){
			this.setPowered(true);
			this.setSource(1);
			if(up.getLicense() == "Wire"){
				up.setSource(1);
			}
			if(down.getLicense() == "Wire"){
				down.setSource(1);
			}
			if(left.getLicense() == "Wire"){
				left.setSource(1);
				}
			if(right.getLicense() == "Wire"){
				right.setSource(1);
			}
		}else{setSource(0);}
		if(this.getLicense() == "Wire" && this.getSource() > 0){
			if(up.getPowered() == true){
				this.setPowered(true);
			}
			if(down.getPowered() == true){
				this.setPowered(true);
			}
			if(left.getPowered() == true){
				this.setPowered(true);
			}
			if(right.getPowered() == true){
				this.setPowered(true);
			}
		}
		if(up.getLicense() == "Wire"){
			
		}
		if(down.getLicense() == "Wire"){}
		if(left.getLicense() == "Wire"){}
		if(right.getLicense() == "Wire"){}
		
		
	}


	
	public void Init() {
		
		
	}
	
	public void Update() {
		// TODO Auto-generated method stub
		
	}

	public void Draw(Graphics g) {
		if(getPowered() == true){
		g.setColor(Color.red);
		g.fillRect(getX(), getY(), getXsize(), getYsize() );
		}else{
			g.setColor(new Color(100,0,0));
			g.fillRect(getX(), getY(), getXsize(), getYsize() );
		}
	}



	



}


The reason i have a component class is because i want some components to have multiple inputs.

Thanks in advance!

Help With A Game Re-development Problem? (java)

25 October 2011 - 02:51 PM

Hey guys BlackSun again!

I have developed a game called EXTRON its basically a game in which you have electronic components (that i made up) but it has a flaw :/ The way wire works.
Its tile based so it has 4 tiles next to it. This is how I want the wire to work:

if a power source is hooked up to a wire then it is powered if not then it is off.

how it works now:

if top.power > 0 then this.power += top.power/4
then for left, right and bottom.

this is a very bad way i know.
I would much rather like it to be not based on power integers but based on booleans.
When i tried using a boolean it stayed on when the power source was not there.
If you have any answers than please tell me for i am slightly desperate.
If i did not mke anything clear here then please ask me.

Also:
if you want to download the game and see how it works then visit my blog neutronbombstudios.tumblr.co.uk(.com)
if you know any programs that already have this and source code then please tell me :)

Thanks in advance

EXTRON 2.0: 3D(in theory) electronic logic component simulator.

10 October 2011 - 01:19 PM

Hello this is a game ive been making called extron.

A little intro:
Extron is an electronic logic simulatior with a small variety of logic gates and enough space to potentially build a small cpu.
It has layers with sendable power if you need more space than the initial space on the 1st layer.
I recommend this game to people who like electronics and thoes who like redstone in minecraft because this is inspired by redstone :)

Intstructions in the readme file.

Video for proof (older version) : http://www.youtube.c...h?v=NNSdG7SxHec

Links:

Game:
http://www.mediafire.com/?19yppdgwg89u99f

Blog:
http://www.neutronbo...ios.tumblr.com/

PARTNERS