Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

java game - alien breed(!?) - (applet or .class?)

Options
  • 09-05-2001 1:32am
    #1
    Registered Users Posts: 2,281 ✭✭✭


    i am begining to make a game (java is the language we are learning in 1st year in college, so i have little choice but to do it in java).

    i am planning to make it very like alien breed on the amiga, only the entire map will be visible at once. (plan view of the action)

    i am hoping to have transparencies (if java can do it easily) for distant/non line of site enemies, and have real line of sight/fov for the enemies. (i like the idea of coding ai)

    i plan to have mouse controls the same as quake + cs, except the up/down movment of the mouse will be ignored)

    i would appreiciate some reaction to my plans :)

    {finallyy} should i code it as an applet or a .class file to make it executable? (is there a way of having a an exe java program?)

    - Dead Bank Clerk -
    "Build a man a fire, and he'll
    be warm for a day. Set a man on
    fire, and he'll be warm for the
    rest of his life."


Comments

  • Closed Accounts Posts: 1,322 ✭✭✭phobos


    DBC,

    That sounds like a pretty wicked game for a first year, but it is not impossible. I remember Alien Breed on the Amiga, and I am just finished a year of Java programming myself (College also).

    I wrote a small game in java a few months back, and I learned a trick or two.

    You mentioned that you wanted to use transparencies in your game. To achieve this it is all in the graphics. For a game like this (2 dimensions), all you are concerned about is using code to move images around. So what I would recommend you do is go in to something like Paint Shop Pro and design your in game graphics (characters, background etc) and make their backgrounds transparent (transparent GIFs). You see transparent GIFs have the transparency encoded in to them so you don't have to worry about writing Java code to make the transparent (this is important). Once you have your images created all you have to do is insert them in to your Java code, like this:

    Image gameImage = Toolkit.getDefaultToolkit.getImage(String pathToSomeImage);

    Then to draw them on the canvas of some GUI component such as a panel or Frame, override the paint method of the component, to make it look something like this:

    public void paint(Graphcs g){

    g.drawImage(gameImage, 0, 0, this);

    }

    That would draw the image on the top left of the drawing area.

    I don't know if you are passed all this, and perhaps I am just rambling on. But if you have any more questions give me a bell.

    :-phobos-)


  • Closed Accounts Posts: 1,322 ✭✭✭phobos


    O **** I nearly forgot,

    There is a way to make an executable in Java. It is done using a JIT (Just in Time) compiler. But the drawbacks of this is that it is compiled in to platform native code, so you don't have the freedom of platform independance anymore. BUGGER!

    Another thing, if you are making either an application or applet, you still end up with *.class files. It is how you deploy those class files is what makes the difference. Lets say for example you had a class that extended (or inherited) from Java.awt.Applet. That compiled class file would then be deployed to a web server as an applet.

    If you were to write an application and compile it to byte code (*.class files). You could then write a DOS batch file to "java" these *.class files to run them. To be honest even the largest Java applications I have seen use this method.

    Anyhoo I gotta go,

    ;-phobos-)


  • Moderators, Music Moderators Posts: 1,481 Mod ✭✭✭✭satchmo


    Nice one DBC, go for it. I'd make it an applet, so that when it's finished you can stick it on a webpage to show it off and other people (like us!) can play it.

    Phobos, I think you're a bit confused as to what a JIT compiler does. A JIT compiler is built into the JVM, and re-compiles the byte code into native machine code for execution. This speeds up execution, because any repeated methods that would have to be interpreted every time are only converted into machine code once, and then run. Netscape and IE's JVMs have JIT compilers built into them. But as far as I know, you can't use a JIT compiler to produce an executable (.exe) file, it's only for runtime. Now I might be wrong about this, but that's how I understand it.

    There are ways of compiling a java program into a standalone executable, but the only programs I've seen that can do this cost money, so I haven't been able to try it myself.

    And anyway like Phobos said, you lose platform independence, and I can't really see any reason for you needing to make it an executable.


  • Registered Users Posts: 2,281 ✭✭✭DeadBankClerk


    gah. coding started today.
    i have a circle moving around as i command it. well, with keypresses smile.gif im trying to implement a mouse listener now, to make mouse motion rotate the player. difficult :/ erk eek.gif

    time to get out my Lc maths book :0)

    -marc


  • Registered Users Posts: 2,281 ✭✭✭DeadBankClerk


    i want the whole area to be a new "graphics" object of maybe 1500 x 1500, and i want my apple to only draw a 500x500 area of this. does anyone know how?


  • Advertisement
Advertisement