Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


bloodisblue

Member Since 30 Jun 2011
Offline Last Active Jun 23 2012 10:24 AM

#4938195 Multiplayer, Multi-platform 2D Space Shooter - Best Language?

Posted by bloodisblue on 07 May 2012 - 03:25 PM

First off I would read the FAQ in the Multiplayer section, it should help out a bit do not skip over #0 it is very relevant in this case-- http://www.gamedev.net/index.php?app=forums&module=forums&section=rules&f=15

Also the only thing I've heard of that can work on most of those platforms is Unity -- http://unity3d.com/unity/ I haven't personally tried it out that much however I have heard very good things about it so I'd say learn how to use that rather than the languages you need to know.


#4868416 Closed Thread

Posted by bloodisblue on 02 October 2011 - 05:06 PM

I don't really have any good tutorials or anything for you, except a while ago I was trying to create my own level editor and ended up creating a little thing which allowed me to read / write from a text file
public Level(int levelXInBlocks, int levelYInBlocks, int levelNumber){
		levelComposition = new Block[levelXInBlocks][levelYInBlocks];
		System.out.println(levelComposition);
		levelX = levelXInBlocks;
		levelY = levelYInBlocks;
		this.levelNumber = levelNumber;
		setLevel(levelNumber);
	}
	
	public void setLevel(int levelNumber){
		String[] eachLine = new String[128];
		try{
			FileReader fr = new FileReader("level" + levelNumber + ".txt");
			BufferedReader br = new BufferedReader(fr);
			String record = new String();
			int lineOn = 0;
			System.out.println("Loading level " + levelNumber);
			while((record = br.readLine()) != null){
				eachLine[lineOn] = record;
				lineOn += 1;
			}
		} catch(IOException e){
			System.out.println("No file found <img src='http://public.gamedev.net/public/style_emoticons/default/tongue.gif' class='bbc_emoticon' alt=':P' />");
		}
		generateBlocks(eachLine);
	}
	
	/*
	  o = air = 0
	  b = brick = 1
	  i = ice = 2
	 */
	public void generateBlocks(String[] levelNotation){
		for(int i = 0; i < levelY; i ++){
			System.out.println(levelNotation[i]);
			String tempS = levelNotation[i].toLowerCase();
			char[] c = tempS.toCharArray();
			for(int blockCounter = 0; blockCounter < c.length; blockCounter++){
				char tempC = c[blockCounter];
				if(tempC == 'o'){
					levelComposition[blockCounter][i] = new Block(0);
				} else if(tempC == 'b'){
					levelComposition[blockCounter][i] = new Block(1);
				} else if(tempC == 'p'){
					levelComposition[blockCounter][i] = new Block(0);
					p = new Player((blockCounter * 25),(i*25));
				} else if(tempC == 'i'){
					levelComposition[blockCounter][i] = new Block(2);
				} else if(tempC == 'f'){
					levelComposition[blockCounter][i] = new Block(3);
				} else if(tempC == '<'){
					levelComposition[blockCounter][i] = new Block(4);
				}
			}
		
		}
	}


It only really applies to tile based maps, but it is pretty simple to read / write levels in a text document. The way I created the levels was by simply going into the text document and adding more "b"s or "i"s to place blocks. More recently I tried creating a game which I had a level editor and I placed objects in the levels which were written into a text file with all attributes which could be read with a text parser. It seemed like it would work correctly (I never found out an error which prevented it from running).

Personally I've found GUIs to be really hard to build so you might want to stay away from them if you could help it. Or if anybody has a good way to create GUIs that would help you and me :D
+Good luck on future projects!


#4842622 Tips or Tricks for learning about programming?

Posted by bloodisblue on 30 July 2011 - 02:13 PM

Well I'd probably say that the easiest way to learn about overall programming is to just go and try something. Typically you run into problems while coding because you can't figure out how to do something or such and these are the things that make programming fun. You have to try to figure out a way YOU know how to solve the problem and then solve it. After figuring out a problem you can typically use that solution on something else and your experiences will continue to build and build and you can solve any problem that comes your way. There isn't really a shortcut to this process because the trial and error is what makes it stick in your brain and simply copy and pasting something really won't help in the long run.


#4839182 [JAVA]Explosion animation problem

Posted by bloodisblue on 22 July 2011 - 07:34 PM

This is what i did.. And doesn't work at all.. Not showing any of the sprites.

	public void collisionResponse(Entity exe){
		health = health - 50;
		if(health <= 0){
			isDead = true;
        	 }

      if(isDead){
            	currentTime = System.currentTimeMillis();
            	amountOfTimePassedSinceDeath  = ( (currentTime - timeOfDeath)); 

            	if(amountOfTimePassedSinceDeath > 2500)
            		deathAnimationDone = true;
            	else if(amountOfTimePassedSinceDeath > 2000)
                	setGraphic(explosion5);    	
            	else if(amountOfTimePassedSinceDeath > 1500) 	
                	setGraphic(explosion4);
            	else if(amountOfTimePassedSinceDeath > 1000) 	
                	setGraphic(explosion3); 
            	else if(amountOfTimePassedSinceDeath > 500)  
            		setGraphic(explosion2); 
            	else
            		setGraphic(explosion);

			}


            
			if(deathAnimationDone){
				this.destroy();
			}
	}


You misplaced the this.destroy();, it will never reach it where you had it. Also the brackets were placed kind of weirdly so I fixed that. I have the feeling that the problem may lie in the update method more so then this method because everything you have written is correct. Make sure that when the thing dies you make sure to set timeOfDeath = System.currentTimeMillis(); otherwise you wouldn't get anything.


PARTNERS