Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (487)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Programming non-applet games 2D  (Read 3664 times)
0 Members and 1 Guest are viewing this topic.
Offline comanighttrain

Senior Newbie





« Posted 2006-01-23 01:30:54 »

Hey guys, Im trying to program an offline platform shooter, iv scoured the net for a few hours and cant find any tutorials or resources for game programming without the applet.

Iv tried to work it out myself by embedding the applet in a JFrame, but that didnt help because you need to repaint the whole lot or else you end up with trailing, plus im pretty sure its not the best way to program it.

Can anyone point me to tutorials or resources that deals with this subject? thanks, Dave
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #1 - Posted 2006-01-23 02:50:59 »

>Can anyone point me to tutorials or resources that deals with this subject?

Sure.

http://www.cokeandcode.com/tutorials

弾幕 ☆ @mahonnaiseblog
Offline comanighttrain

Senior Newbie





« Reply #2 - Posted 2006-01-23 21:17:48 »

suuweeet! thanks a lot man Cool
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline comanighttrain

Senior Newbie





« Reply #3 - Posted 2006-01-23 22:26:27 »

Hmm...this is odd, this tutorial wont compile because Game makes referance to AlienShip, and AlienShip makes a referance to game...
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #4 - Posted 2006-01-23 22:34:01 »

X:\foo\spaceinvaders.zip\spaceinvaders>javac org/newdawn/spaceinvaders/Game.java
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

X:\foo\spaceinvaders.zip\spaceinvaders>java org.newdawn.spaceinvaders.Game

Works just fine here.

弾幕 ☆ @mahonnaiseblog
Offline comanighttrain

Senior Newbie





« Reply #5 - Posted 2006-01-23 23:24:33 »

if i compile "game.java" in jcreator it says "cannot symbol class AlienEntity"

Javac is not recognised by my command line, grrr, this is what happens when i switch from linux to windows, im not good at configuring this.
Offline comanighttrain

Senior Newbie





« Reply #6 - Posted 2006-01-23 23:46:37 »

nope, just got javac working properly and same problem.
Offline swpalmer

JGO Coder




Where's the Kaboom?


« Reply #7 - Posted 2006-01-24 00:01:22 »

Your classpath or source file path is not properly configured.

Did you use the -sourcepath arg to javac?

Java uses a multipass compiler so there is no problem with circular references like Game->Ship and Ship->Game.

Offline comanighttrain

Senior Newbie





« Reply #8 - Posted 2006-01-24 00:09:19 »

no...i just used

javac Game.java

Sorry, i must be frustrating you guys by now, we always compiled from IDE's so im not used to the command line args.
Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #9 - Posted 2006-01-24 00:48:45 »

No problem, seems to be a common one, its probably to do with the package that Game is in.  You see in onyx's example he did this:

Quote
javac org/newdawn/spaceinvaders/Game.java

because you need to compile from the base of the package structure and because Game is in the package "org.newdawn.spaceinvaders".

Kev

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline comanighttrain

Senior Newbie





« Reply #10 - Posted 2006-01-24 01:07:12 »

 Cry

I have just tried that in cmd.exe, its still giving me 24 errors in the first game and 40 in spaceinvaders104.

Incase it is effecting it heres some details

package path : C:/JAVA/spaceinvaders/ (then /org and  /sprites)

current path == C:/JAVA/spaceinvaders/
command im using : >javac org/newdawn/spaceinvaders/Game.java

I was using javac at the base of the package, i was also using jcreator.

By the way, thanks for your help!
Also, nice site, its the only one iv been sent to thats not entirely applet based

Added
i got it to compile with this :
in the director of game.java
javac *.java
but now i cant get it to run , i try java game.class but it says undefined class game()

Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #11 - Posted 2006-01-24 13:34:09 »

Well, its "Game" and not "game".

Eventually your java installation is broken. My bro's install was b0rked once and it behaved very weird. So, maybe its a good idea to uninstall java and install it again. Set up the path stuff (<win>+<break> -> advanced (or something) -> environment variables... add the jdk's bin path to path... eg it could look like this: C:\Programme\GTK2-Runtime\lib;D:\java\jdk1.5.0_05\bin) and then try it again.

弾幕 ☆ @mahonnaiseblog
Offline tusaki

Junior Member


Medals: 1


In a mad world only the mad are sane.


« Reply #12 - Posted 2006-01-24 16:33:56 »

Erh. Why not install an editor like eclipse? I haven't  manually compiled a java program in years! And I shudder at what I had to go through back in those days... The difference is night and day.
Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #13 - Posted 2006-01-24 16:38:01 »

Its pretty good to get compilation to work at the command line as a start - always nice to begin with the basics and build up.

Kev

Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #14 - Posted 2006-01-24 17:04:28 »

This command line stuff is also the easiest way to reproduce.

X:\foo\spaceinvaders.zip\spaceinvaders>dir/b
org
sprites

X:\foo\spaceinvaders.zip\spaceinvaders>javac org/newdawn/spaceinvaders/Game.java
Note: org/newdawn/spaceinvaders/Game.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

X:\foo\spaceinvaders.zip\spaceinvaders>java org.newdawn.spaceinvaders.Game

C'mon... its easy.

弾幕 ☆ @mahonnaiseblog
Offline comanighttrain

Senior Newbie





« Reply #15 - Posted 2006-01-24 18:04:31 »

Im doing exactly as you said man...seriously.

My Path : > dir
C:\JAVA\spaceinvaders

>dir/b
org
sprites

> javac org/newdawn/spaceinvaders/Game.java

24 compile errors


I just reinstalled java SDK with the newest update and its making no difference.
Is it something iv screwed up or is my system actually screwed?

Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #16 - Posted 2006-01-24 18:38:47 »

Could you list the errors, it might help.

Kev

Offline comanighttrain

Senior Newbie





« Reply #17 - Posted 2006-01-24 19:19:58 »

All the errors  are

cannot find symbol
Class : Entity/ShotEntity/AlienEntity
Location : org.newdawn.spaceinvaders.Game

Heres the exact dump from the console :
C:\JAVA\spaceinvaders>dir/b
org
sprites

C:\JAVA\spaceinvaders>javac org/newdawn/spaceinvaders/Game.java
org/newdawn/spaceinvaders/Game.java:42: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
        private Entity ship;
                ^
org/newdawn/spaceinvaders/Game.java:170: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
        public void removeEntity(Entity entity) {
                                 ^
org/newdawn/spaceinvaders/Game.java:141: cannot find symbol
symbol  : class ShipEntity
location: class org.newdawn.spaceinvaders.Game
                ship = new ShipEntity(this,"sprites/ship.gif",370,550);
                           ^
org/newdawn/spaceinvaders/Game.java:148: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                                Entity alien = new AlienEntity(this,"sprites/ali
en.gif",100+(x*50),(50)+row*30);
                                ^
org/newdawn/spaceinvaders/Game.java:148: cannot find symbol
symbol  : class AlienEntity
location: class org.newdawn.spaceinvaders.Game
                                Entity alien = new AlienEntity(this,"sprites/ali
en.gif",100+(x*50),(50)+row*30);
                                                   ^
org/newdawn/spaceinvaders/Game.java:205: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                        Entity entity = (Entity) entities.get(i);
                        ^
org/newdawn/spaceinvaders/Game.java:205: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                        Entity entity = (Entity) entities.get(i);
                                         ^
org/newdawn/spaceinvaders/Game.java:207: cannot find symbol
symbol  : class AlienEntity
location: class org.newdawn.spaceinvaders.Game
                        if (entity instanceof AlienEntity) {
                                              ^
org/newdawn/spaceinvaders/Game.java:227: cannot find symbol
symbol  : class ShotEntity
location: class org.newdawn.spaceinvaders.Game
                ShotEntity shot = new ShotEntity(this,"sprites/shot.gif",ship.ge
tX()+10,ship.getY()-30);
                ^
org/newdawn/spaceinvaders/Game.java:227: cannot find symbol
symbol  : class ShotEntity
location: class org.newdawn.spaceinvaders.Game
                ShotEntity shot = new ShotEntity(this,"sprites/shot.gif",ship.ge
tX()+10,ship.getY()-30);
                                      ^
org/newdawn/spaceinvaders/Game.java:227: operator + cannot be applied to Entity.
getX,int
                ShotEntity shot = new ShotEntity(this,"sprites/shot.gif",ship.ge
tX()+10,ship.getY()-30);

  ^
org/newdawn/spaceinvaders/Game.java:262: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                                        Entity entity = (Entity) entities.get(i)
;
                                        ^
org/newdawn/spaceinvaders/Game.java:262: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                                        Entity entity = (Entity) entities.get(i)
;
                                                         ^
org/newdawn/spaceinvaders/Game.java:270: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                                Entity entity = (Entity) entities.get(i);
                                ^
org/newdawn/spaceinvaders/Game.java:270: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                                Entity entity = (Entity) entities.get(i);
                                                 ^
org/newdawn/spaceinvaders/Game.java:280: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                                        Entity me = (Entity) entities.get(p);
                                        ^
org/newdawn/spaceinvaders/Game.java:280: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                                        Entity me = (Entity) entities.get(p);
                                                     ^
org/newdawn/spaceinvaders/Game.java:281: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                                        Entity him = (Entity) entities.get(s);
                                        ^
org/newdawn/spaceinvaders/Game.java:281: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                                        Entity him = (Entity) entities.get(s);
                                                      ^
org/newdawn/spaceinvaders/Game.java:299: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                                        Entity entity = (Entity) entities.get(i)
;
                                        ^
org/newdawn/spaceinvaders/Game.java:299: cannot find symbol
symbol  : class Entity
location: class org.newdawn.spaceinvaders.Game
                                        Entity entity = (Entity) entities.get(i)
;
                                                         ^
Note: org/newdawn/spaceinvaders/Game.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
21 errors
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #18 - Posted 2006-01-24 20:19:18 »

Well, your java installation is broken, because the current directory isnt in the classpath (its in the classpath by default since 1.3 iirc).

Try "javac -cp . org/newdawn/spaceinvaders/Game.java" instead.

弾幕 ☆ @mahonnaiseblog
Offline comanighttrain

Senior Newbie





« Reply #19 - Posted 2006-01-24 20:26:04 »

ok...that worked...

i try to java the Game class file and i get

C:\JAVA\spaceinvaders>java org/newdawn/spaceinvaders/Game.class
Exception in thread "main" java.lang.NoClassDefFoundError: org/newdawn/spaceinva
ders/Game/class

How do i go about fixing my java installation?
Offline oNyx

JGO Coder


Medals: 2


pixels! :x


« Reply #20 - Posted 2006-01-24 20:35:50 »

Omit that ".class" bit at the end.

>How do i go about fixing my java installation?

Uninstalling all java stuff and reinstalling it should fix it.

弾幕 ☆ @mahonnaiseblog
Offline comanighttrain

Senior Newbie





« Reply #21 - Posted 2006-01-24 20:39:46 »

i have uninstalled and reinstalled it twice...no diff...maybe try redownloading it?
Offline tusaki

Junior Member


Medals: 1


In a mad world only the mad are sane.


« Reply #22 - Posted 2006-01-24 20:50:20 »

don't do this

1  
C:\JAVA\spaceinvaders>java org/newdawn/spaceinvaders/Game.class


but this

1  
C:\JAVA\spaceinvaders>java org.newdawn.spaceinvaders.Game
Offline jbanes

JGO Coder


Projects: 1


"Java Games? Incredible! Mr. Incredible, that is!"


« Reply #23 - Posted 2006-01-24 20:51:02 »

i have uninstalled and reinstalled it twice...no diff...maybe try redownloading it?

1. Right click on "My Computer".
2. Click on "Properties"
3. Select the "Advanced" tab
4. Click on "Environment Variables"
5. Select "Classpath" from the list and hit "Delete" (You may have to do this for both lists.)

Restart  any open command-line windows you have and you should be good to go.

Java Game Console Project
Last Journal Entry: 12/17/04
Offline comanighttrain

Senior Newbie





« Reply #24 - Posted 2006-01-25 00:02:36 »

i have uninstalled and reinstalled it twice...no diff...maybe try redownloading it?

1. Right click on "My Computer".
2. Click on "Properties"
3. Select the "Advanced" tab
4. Click on "Environment Variables"
5. Select "Classpath" from the list and hit "Delete" (You may have to do this for both lists.)

Restart  any open command-line windows you have and you should be good to go.

Dave <3 jbanes 4 ever

No seriously, thats done the trick, Thanks alot.

Thanks a lot to everyone for giving me your time and patience:), hopefully one day i can help someone out too!
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (16 views)
2014-08-28 18:26:30

CopyableCougar4 (25 views)
2014-08-22 19:31:30

atombrot (38 views)
2014-08-19 09:29:53

Tekkerue (34 views)
2014-08-16 06:45:27

Tekkerue (32 views)
2014-08-16 06:22:17

Tekkerue (20 views)
2014-08-16 06:20:21

Tekkerue (30 views)
2014-08-16 06:12:11

Rayexar (66 views)
2014-08-11 02:49:23

BurntPizza (43 views)
2014-08-09 21:09:32

BurntPizza (34 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!