Author Topic: Java - help the noob!  (Read 440 times)

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Java - help the noob!
« on: February 12, 2012, 07:57:03 AM »
I'm going to learn Java (don't confuse with JavaScript). Can you drop me some tutorials (the one I googled are really ugly)? Just something that opens a screeen, draws a bitmap and displays some text. I have Eclipse installed.

Offline hiigara

  • Level 12
  • *
  • Posts: 85
  • Reputation: +0/-0
    • View Profile
Re: Java - help the noob!
« Reply #1 on: February 12, 2012, 05:10:35 PM »
Why are you choosing java? Are you going to use standalone java or applet?

Offline jack13580

  • Level 7
  • *
  • Posts: 35
  • Reputation: +0/-0
    • View Profile
Re: Java - help the noob!
« Reply #2 on: February 12, 2012, 08:23:41 PM »
ok here are a ton of good tutorials which teach all the basics http://www.youtube.com/playlist?list=PLFE2CE09D83EE3E28&feature=plcp and also on the same channel theres a ton of videos teaching the more advanced stuff and he also has a long playlist teaching how java can be used to make games

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Java - help the noob!
« Reply #3 on: February 13, 2012, 04:40:49 AM »
Why are you choosing java? Are you going to use standalone java or applet?
I'm a bit tired of C/C++ :) And Java has nice properties (can be turned into BBG, 3DMMORPG, flash like singleplayer online game, standalone downloadable game, util. It is easily "compiled" as PC/LinuxMac/various mobiles versions, require the fewest paid components, programs and licences). It's nice that with it I can change my mind later and switch to a completely different type of game category while reusing most code (which is not possible with C/C++ or PHP).

BTW, I have dumped Eclipse and installed NetBeans, now I managed to make it work (and the IDE launch faster) :D

Offline gnoh

  • Game Owner
  • Level 15
  • *
  • Posts: 127
  • Reputation: +2/-0
    • View Profile
Re: Java - help the noob!
« Reply #4 on: February 13, 2012, 04:54:35 AM »
Take a look at: http://code.google.com/p/playn/

I'd change back to eclipse if I were you,  it has many more plugins which may or may not make your life easier.

It's also worth noting that you wont just be stuck with just java and since you're learning a new language and programming paradigm anyway it might be worth skipping java and looking to scala.


Offline hiigara

  • Level 12
  • *
  • Posts: 85
  • Reputation: +0/-0
    • View Profile
Re: Java - help the noob!
« Reply #5 on: February 13, 2012, 05:33:41 AM »
Why are you choosing java? Are you going to use standalone java or applet?
I'm a bit tired of C/C++ :) And Java has nice properties (can be turned into BBG, 3DMMORPG, flash like singleplayer online game, standalone downloadable game, util. It is easily "compiled" as PC/LinuxMac/various mobiles versions, require the fewest paid components, programs and licences). It's nice that with it I can change my mind later and switch to a completely different type of game category while reusing most code (which is not possible with C/C++ or PHP).

BTW, I have dumped Eclipse and installed NetBeans, now I managed to make it work (and the IDE launch faster) :D
Fair enough. I personally decided to specialize in C++ and never touched java, so I cannot help.
Yes it's hard and boring getting things done with C++. For my standalone game I am using python for GUI and C++ for server. C++ on the server side is not so painful. And python is so much fun.
« Last Edit: February 13, 2012, 05:38:27 AM by hiigara »

Offline Barrikor

  • Level 21
  • *
  • Posts: 248
  • Reputation: +3/-0
    • View Profile
Re: Java - help the noob!
« Reply #6 on: February 14, 2012, 11:06:51 PM »
I've tried to get into using Java a couple times. I want to be able to like the language but it has a lot of issues that grate on me...
Projects: Pith Framework (at 0.5), CactusGUI (at 0.3)

Offline gnoh

  • Game Owner
  • Level 15
  • *
  • Posts: 127
  • Reputation: +2/-0
    • View Profile
Re: Java - help the noob!
« Reply #7 on: February 15, 2012, 04:51:48 AM »
Could you expand on the issues that grate you,   it could help Chris with a decision and I'm interested in seeing it like you do coming from a different background.

Offline Barrikor

  • Level 21
  • *
  • Posts: 248
  • Reputation: +3/-0
    • View Profile
Re: Java - help the noob!
« Reply #8 on: February 15, 2012, 06:26:38 PM »
- Converting between ints, doubles, and strings... Should be easy to cast anything to any other datatype, but instead you end up with an entire fruit salad full of different ways you have to do it esp when some of your primitives have to be objects to work with the functions you need to use.

- Swing, you're either stuck writing a ton of boiler-plate or else if you use something like Netbeans you can have it auto-generated for you which creates it's own problems if you need to change the part that gets generated.

- Get/Set hell

- It's repetitive, Double pi = new Double("3.14");

- Also I hate equals, if( "string".equals(otherString) )
Projects: Pith Framework (at 0.5), CactusGUI (at 0.3)

Offline jack13580

  • Level 7
  • *
  • Posts: 35
  • Reputation: +0/-0
    • View Profile
Re: Java - help the noob!
« Reply #9 on: February 15, 2012, 11:31:33 PM »
im going to post some sample code from a project im working on just to show you how much you can get done if you try plus watch and read a ton of tutorials

from lines 361 to line 437

Code: [Select]
public void mousePressed(MouseEvent e){

//----menu option code----\\


//---first option code---\\

//single player
if (main_menu && hovered && menu_option1) {
menu_option1 = false;
hovered = false;
started_opt1 = true;
if(started_opt2){
hovered = false;
started_opt2 = false;
menu_option2 = false;
}
}

//close single player
if (main_menu && hovered && menu_opt1_close && started_opt1) {
hovered = false;
started_opt1 = false;
}


//---seconed option code---\\

//multiplayer
if (main_menu && hovered && menu_option2) {
hovered = false;
started_opt2 = true;
menu_option2 = false;
if(started_opt1){
hovered = false;
started_opt1 = false;
menu_option1 = false;
}
}

//multiplayer_start
if (main_menu && hovered && multiplayer_start) {
hovered = false;
multiplayer_started = true;
multiplayer_start = false;
main_menu = false;
started_opt2 = false;
}

//close multiplayer
if (main_menu && hovered && menu_opt2_close && started_opt2) {
hovered = false;
started_opt2 = false;
menu_opt2_close = false;
}


//---third option code---\\

//close application
if (main_menu && hovered && menu_option3) {
menu_option3 = false;
hovered = false;
if(started_opt1){
hovered = false;
started_opt1 = false;
menu_option1 = false;
}
if(started_opt2){
hovered = false;
started_opt2 = false;
menu_option2 = false;
}
stop();
}
//----end of menu option code----\\

after line 437 i just got tired of putting comments but this is a sample of my project ths code pretty much makes the main menu work

im doing my project without the use of JFrame and its a full screen application

heres another part that is also neaded to make the main menu work
Code: [Select]
public void mouseMoved(MouseEvent e){

//code to make hovering for main menu work
if (main_menu) {

//----menu option code----\\

if(!started_opt1 || !started_opt2){
if (mx >= width / 2 - 293 && mx <= width / 2 - 187 && my >= 235 && my <= 255) {//single player
menu_option1 = true;
hovered = true;
}else if (mx >= width / 2 - 293 && mx <= width / 2 - 187 && my >= 265 && my <= 285) {//multiplayer
menu_option2 = true;
hovered = true;
}else if(mx >= width / 2 - 293 && mx <= width / 2 - 187 && my >= 295 && my <= 315){//close
menu_option3 = true;
hovered = true;
}
else {
menu_option1 = false;
menu_option2 = false;
menu_option3 = false;
hovered = false;
}
}

if(started_opt1 || started_opt2){
if (mx >= width / 2 - 95 && mx <= width / 2 + 5 && my >= 235 && my <= 255 && started_opt1) {//close single player
menu_opt1_close = true;
hovered = true;
}else if (mx >= width / 2 - 293 && mx <= width / 2 - 187 && my >= 235 && my <= 255) {//highlight singleplayer button
menu_option1 = true;
hovered = true;
}else if (mx >= width / 2 - 95 && mx <= width / 2 + 5 && my >= 235 && my <= 255 && started_opt2) {//close multiplayer
menu_opt2_close = true;
hovered = true;
}else if (mx >= width / 2 - 293 && mx <= width / 2 - 187 && my >= 265 && my <= 285) {//highlight multiplayer button
menu_option2 = true;
hovered = true;
}else if(mx >= width / 2 - 293 && mx <= width / 2 - 187 && my >= 295 && my <= 315){//highlight close button
menu_option3 = true;
hovered = true;
}else if(mx >= width / 2 - 95 && mx <= width / 2 + 5 && my >= 285 && my <= 305 && started_opt2){
multiplayer_start = true;
hovered = true;
}
else {
menu_option1 = false;
menu_option2 = false;
menu_option3 = false;
multiplayer_start = false;
menu_opt1_close = false;
menu_opt2_close = false;
hovered = false;
}
}
}

//-------end of menu option code-------\\
« Last Edit: February 15, 2012, 11:34:19 PM by jack13580 »

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,217
  • Reputation: +28/-1
    • View Profile
Re: Java - help the noob!
« Reply #10 on: February 29, 2012, 02:57:13 PM »
Before I could try PlayN I found an alternative to it :D
http://www.haxenme.org/ (compile to windows, linux, mac, iOS, Android, Flash, HTML5)

nme test "Actuate Example.nmml" flash
nme test "Actuate Example.nmml" ios -simulator
nme test "Actuate Example.nmml" webos
nme test "Actuate Example.nmml" android
nme test "Actuate Example.nmml" windows
nme test "Actuate Example.nmml" mac
nme test "Actuate Example.nmml" linux
nme test "Actuate Example.nmml" html5

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal