Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
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 1508 times)
0 Members and 1 Guest are viewing this topic.
Offline gunder

Junior Newbie




kung fu grip


« Posted 2004-09-02 23: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!

-gunder
Offline mhale

Senior Newbie




Take pity, I'm just a poor blob!


« Reply #1 - Posted 2004-09-03 03: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 http://java.sun.com/docs/books/tutorial/index.html
Offline DannyFromTower

Senior Newbie




Java games rock!


« Reply #2 - Posted 2004-09-07 02: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 Member




Java games rock!


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

Make sure you write a class for every object.

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

Maybe not but you get the point. Wink

Vorax:
Is there a name for a "redneck" programmer?

Jeff:
Unemployed. Wink
Offline kevglass

JGO Kernel


Medals: 122
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


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

Don't forget to use packages...

Door
door.Frame
door.Handle
door.Paint
door.Sticker ...

Wink

Kev

Offline Eliwood

Junior Member




Stencyl


« Reply #5 - Posted 2004-09-18 22: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 04: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.  

TMP72
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.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (26 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (13 views)
2014-07-29 10:59:34

E.R. Fleming (34 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (44 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

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

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

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
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!