Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (777)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
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  
  Question about oop  (Read 2567 times)
0 Members and 1 Guest are viewing this topic.
Offline gunder

Junior Newbie

kung fu grip

« Posted 2004-09-02 21:13:52 »

Hello everyone, I'm new to Java and need a little help.  Most of the programming I have done has been in QBasic and C, so OOP is a whole new beast for me.  I'm going to make a simple little text adventure just to get the basics of the language down but I'm not really sure how to split it up into seperate objects.  These are the seperate objects I've though of so far :

rooms (store the info for the rooms)
items (all the info for the items)
commands (go, get, look etc.)
monsters (stuff that bleeds)
npcs (people who want you to find lost puppys)

Am I going in the right direction or am I thinking of this all wrong?  Anyone have any suggestions to get me started off right?  Thanks!

Offline mhale

Senior Newbie

Take pity, I'm just a poor blob!

« Reply #1 - Posted 2004-09-03 01:10:09 »

Yes, as a rule of thumb, you organise objects by behaviour. Then when you come to code, you implement the behaviour by writing methods for the objects.

If you haven't looked at it already, check out the tutorial at
Offline DannyFromTower

Senior Newbie

Java games rock!

« Reply #2 - Posted 2004-09-07 00:04:15 »

And don't forget important objects like "thePlayer (the guy that's doing everything)"  Wink
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline K.I.L.E.R

Senior Devvie

Java games rock!

« Reply #3 - Posted 2004-09-13 02:49:26 »

Make sure you write a class for every object.

Door, DoorFrame, DoorHandle, DoorPaint, DoorSticker, DoorLight, DoorRoom, etc... :lol:

Maybe not but you get the point. Wink

Is there a name for a "redneck" programmer?

Unemployed. Wink
Offline kevglass

« JGO Spiffy Duke »

Medals: 319
Projects: 25
Exp: 22 years

Coder, Trainee Pixel Artist, Game Reviewer

« Reply #4 - Posted 2004-09-13 05:34:10 »

Don't forget to use packages...

door.Sticker ...



Offline Eliwood

Junior Devvie


« Reply #5 - Posted 2004-09-18 20:54:43 »

Although this may seem obvious, take half an hour (or more) to sit down and draw ON paper, your basic design. Drawing things on paper does wonders when it comes to identifying potential problems before you sit down and code.

Offline TMP72

Junior Newbie

« Reply #6 - Posted 2004-09-22 02:18:39 »

Don't forget about abstraction.  Break down your classes into subclasses.

Start with a monster class that contains variables and methods common to all monsters.  Then create more specific monster subclasses that can extend the functionalility of the more abstract monster class.

So you start with a monster class, then create specific classes like Rock Monster, Demon Monster, Vampire monster and so on.

Later on if you decide to add another monster to the game.  All you need to do is create a new class for that monster extending the original monster class and not destroying any functionality

This process can be used with all the classes you create.  

Pages: [1]
  ignore  |  Print  

hadezbladez (295 views)
2018-11-16 13:46:03

hadezbladez (164 views)
2018-11-16 13:41:33

hadezbladez (295 views)
2018-11-16 13:35:35

hadezbladez (75 views)
2018-11-16 13:32:03

EgonOlsen (2156 views)
2018-06-10 19:43:48

EgonOlsen (2183 views)
2018-06-10 19:43:44

EgonOlsen (1370 views)
2018-06-10 19:43:20

DesertCoockie (1988 views)
2018-05-13 18:23:11

nelsongames (1631 views)
2018-04-24 18:15:36

nelsongames (2280 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!