Wednesday, September 1, 2010

Programming, please play nice.

OMGSH I finally got Step one of this Spaceship Game I have to make for programming fundamentals!

And now I actually want to do it and learn more because I wanna see things happen :D

haha it took 6 hours (it's not completely ready though, apparently one of the lines were wrong and i probs repeated a lot of things) to come up with this:

import java.util.Scanner; // Needed for Scanner class


public class SpaceshipGame
{
public static void main(String[] args)
{
String enemy1; //Enemy #1
String enemy2; //Enemy #2
String enemy3; //Enemy #3
String postion; // To hold initial x position
String velocity; // To hold initial velocity

Scanner keyboard = new Scanner(System.in);

//Create a Scanner object to read input
keyboard = new Scanner (System.in);

//Enemy1:
//Get the initial x position
System.out.print("Enemy #1");
enemy1 = keyboard.nextLine();
System.out.print("-Initial x position:");
String position = keyboard.nextLine();

//Get the velocity
System.out.print("-Initial velocity:");
velocity = keyboard.nextLine ();

//Enemy2:
//Get the initial x position
System.out.print("Enemy #2");
enemy2 = keyboard.nextLine();
System.out.print("-Initial x position:");
position = keyboard.nextLine();

//Get the velocity
System.out.print("-Initial velocity:");
velocity = keyboard.nextLine ();

//Enemy3:
//Get the initial x position
System.out.print("Enemy #3");
enemy3 = keyboard.nextLine();
System.out.print("-Initial x position:");
position = keyboard.nextLine();

//Get the velocity
System.out.print("-Initial velocity:");
velocity = keyboard.nextLine ();

//Display Welcome message?

}


}

And Miguel nearly found my blog today. So if he did. Hi :)

0 comments:

Post a Comment