Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (406)
games submitted by our members
Games in WIP (290)
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 1261 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!
Try the Free Demo of Droid Assault
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
« League of Dukes »

JGO Kernel


Medals: 54
Projects: 20


Mentally unstable, best avoided.


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

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (60 views)
2013-05-17 21:29:12

alaslipknot (69 views)
2013-05-16 21:24:48

gouessej (99 views)
2013-05-16 00:53:38

gouessej (98 views)
2013-05-16 00:17:58

theagentd (107 views)
2013-05-15 15:01:13

theagentd (98 views)
2013-05-15 15:00:54

StreetDoggy (144 views)
2013-05-14 15:56:26

kutucuk (167 views)
2013-05-12 17:10:36

kutucuk (166 views)
2013-05-12 15:36:09

UnluckyDevil (175 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
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!
Page created in 0.123 seconds with 20 queries.