Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

102 Neutral

About BlackSunStudios

  • Rank
  1. BlackSunStudios

    Generating downhill ski slopes for a 2d game

    I would help you if i had more points in "Science" and "Repair" ;)
  2. 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.
  3. 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?
  4. 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 = 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.type != Type.base){ try{ tile.Interact(tile[b - 1], tile[b + 1], tile[i - 1], tile[i + 1]); }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.occupied == false){ if(tile.x > in.getMouseX() - 5){ if(tile.x < in.getMouseX()){ if(tile.y > in.getMouseY() - 5){ if(tile.y < in.getMouseY()){ switch(Keyset){ case 0: tile = new Wire(tile.getX(), tile.getY()); break; case 1: tile = new BaseComponent(tile.getX(), tile.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.x > in.getMouseX() - 5){ if(tile.x < in.getMouseX()){ if(tile.y > in.getMouseY() - 5){ if(tile.y < in.getMouseY()){ tile.setType(Type.base); tile.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(; 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!
  5. BlackSunStudios

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

    Thanks! The bit about the neighbour wires was about someone else who posted an answer.
  6. BlackSunStudios

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

    But when a wire above is powered and the power source is turned off then the wire will still be powered if there are 2 or more wires connected to it :/
  7. 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 if you know any programs that already have this and source code then please tell me Thanks in advance
  8. BlackSunStudios

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

    aha good idea im goind to put componets of 3*3 size. I'll see how the game looks without the grid or with it less visible and if it looks good ill do it ;) [/quote] I think the grid is needed if you want to place the components in a specific way, though if you make it a lot less visible, you could add a horizontal and a vertical line crossing at where the cursor is, to help place components to the right places. It would be annoying tho if you dont need it so it could be an option or appear when you press a key... [/quote] hmm yeah. Ive dont a lot of updating today so i probably wont do that till thursday or something. Ive made it so you can use 3*3 blocks, made saving ,loading and ive put a binary adder in also. I'll probably get round to uploading it tonight.
  9. BlackSunStudios

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

    aha good idea im goind to put componets of 3*3 size. I'll see how the game looks without the grid or with it less visible and if it looks good ill do it ;)
  10. 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) : Links: Game: Blog:
  11. BlackSunStudios

    Elements - PowderGame Clone - Java

    Hey guys im here to introduce [size="7"]ELEMENTS! Elements is a client version of the popular web game PowderGame(dust). I decided to make it so i could just learn Slick and do something fun in the proccess. Things that Elements has but PowderGame Doesnt: Elements has a heat feature which can change a particles state eg: water into steam, oil into gas, ice into water. Heat passes through particles as they touch. Elements is FULLSCREEN (slickversion) Elements has a Heat, Cool feature. Elements is OFFLINE. things that PowderGame has that Elements Doesnt: PowderGame has more Particle Types. PowderGame has a map sharing feature. PowderGame has a better and faster way of doing collision etc. There are two versions of Elements 1. Slick2D version: the slick2d version is fullscreen, has better writing graphics and has the DRAG feature. the slick2d version is slower(considerably) and you have to use the right mouse button to use heat/cool. 2 JavaAWT/SWING version: Faster, Non- fullscreen, smaller size file(12kb). I would recomend the AWT version but if you want a fullscreen i would go for SLICK2D version Links: Slick2D Version: AWT/SWING Version: mediafire links are on my blog : Thanks for your time.
  12. BlackSunStudios

    Hey guys need a favor here( Slick2d, lwjgl jar packing)

    OMG thank you so much !!! :D
  13. Hey guys. I have a game which i am very proud of. I want to send it to people so they can see it and i want to freely redistribute it also. The problem i have here is.... How do i make a .jar that uses lwjgl.jar and slick.jar... i have a folder called lib which i put the jars and natives that i use in (apart from the actual game jar) how do i run the game via .jar that uses external jars? ive tried fatjar and i get errors about the main class even though ive put the main class. I really apreciate this because if i get this to work im going to make a web portfolio and put my game on.. info about the game: it uses import org.newdawn.slick2d.*; its a clone of powder game but in my version when you heat things they change into different things. Thanks in advance
  14. BlackSunStudios

    SOLVED:Circle Cellular automata mating bug

    FIXED: sorry ive fixed it now changed the active thingy to fertile instead. Works fine sorry
  15. Hey guys im trying to make a cellular automation with circles that move across the screen but ive come up with a nasty bug. Heres the Source code (im using slick 2d) import java.util.Random; import org.newdawn.slick.*; public class MainClass extends BasicGame{ Cell[] cell; int cellList = 1; int maxCells = 9999999; public void render(GameContainer arg0, Graphics g) throws SlickException { if(cellList > 1){ for(int i = 1; i < cellList; i++){ cell.Render(g); } } } public void init(GameContainer gc) throws SlickException { cell = new Cell[maxCells]; } public void update(GameContainer gc, int delta) throws SlickException { Input input = gc.getInput(); if(input.isKeyDown(input.KEY_ESCAPE)){ System.exit(0); } if(input.isKeyDown(input.KEY_SPACE)){ Random a = new Random(); int b = a.nextInt(1280); Random d = new Random(); int c = a.nextInt(800); cell[cellList] = new Cell(b,c,10,1,1,1000,Color.white); cellList++; } if(cellList > 1){ for(int i = 1; i < cellList; i++){ if( == true){ cell.AgeCheck(); cell.Move(); for(int b = 1; b < cellList;b++){ if(i==b){ break; } if(cell.Collision(cell) == true){ cell.speedx =- cell.speedx; cell.speedy =- cell.speedy; cell.speedx =- cell.speedx; cell.speedy =- cell.speedy; if(cell.Gender != cell.Gender){ try{ cell[cellList] = new Cell(cell.x - cell.radius,cell.y ,cell.radius,cell.speedx,cell.speedy,cell.lifespan,cell.color); cellList++; cell.Destroy(); }catch(ArrayIndexOutOfBoundsException e){System.out.println("Out of bounds");} } else{ cell.Destroy(); } } } } } } } public MainClass(){ super("Cellz"); } public static void main(String[] args) throws SlickException{ AppGameContainer game = new AppGameContainer(new MainClass()); game.setDisplayMode(1280, 800, true); game.start(); } } import java.util.Random; import org.newdawn.slick.*; public class Cell { float x,y,radius,speedx,speedy,life,lifespan; Color color; boolean active; int collidetimes = 0; boolean Gender; public void Render(Graphics g){ g.setColor(color); g.fillOval(x, y, radius, radius); } public void AgeCheck(){ life++; if(life > lifespan){ Destroy(); } } public void Destroy(){ if(active == true){ x = 0; y = 0; radius = 0; speedx = 0; speedy = 0; life = 0; lifespan = 0; color = null; active = false; System.out.println("Destroy"); } } public void Move(){ x += speedx; y += speedy; if(x > 1280){ speedx =- speedx; } if(x < 0 ){ speedx =- speedx; } if(y > 800){ speedy =- speedy; } if(y < 0){ speedy =- speedy; } } public boolean Collision(Cell c){ float xd = x - c.x; float yd = y - c.y; float sumRadius = radius + c.radius; float sqrRadius = sumRadius + sumRadius; float distSqr = (xd * xd) + (yd * yd); if (distSqr <= sqrRadius) { collidetimes ++; return true; }else {return false; } } public Cell(float x, float y, float radius, float speedx,float speedy, float lifespan, Color color){ this.x = x; this.y = y; this.radius = radius; this.speedx = speedx; this.speedy = speedy; = 0; this.lifespan = lifespan; this.color = color; active = true; Random gender = new Random(); int a = gender.nextInt(2); if(a == 0){ Gender = false; }else{Gender = true;} } } So what i want to happen is when two cells that hit eachother that are a different gender a new cell is made. At the start its all well apart from when 3 cells die. when a cell dies its position is moved to 0 and all variables are set to false and such. the program only checks collision if a cell is active(boolean) and when a cell dies its active boolean is set to false. The program freezes and stops responding. I made it so when a new cell is born its x and y coordinates are printed on the screen: 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 That times by alot! now i know what the problem is( the dead cells are mating eww) but i dont know how to fix it. i tried to fix it by making it so it checks collision only if active but its still bugging out. Thanks in advance
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!