Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (497)
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  
  GUI Dialouges  (Read 1404 times)
0 Members and 1 Guest are viewing this topic.
Offline Mads

JGO Ninja


Medals: 24
Projects: 3


One for all!


« Posted 2011-06-26 10:45:09 »

Hello!

You may've seen my WIP (If not, http://javadaemon.com/pictures/pokemon_engine.png).
I'm at a point where I'd really much like chatting with NPC's. This is hard though, because both NPC's needs to be able to chat, aswell as signs, and other objects that has text written on them in-game.
I'm planning on not making the player talk at all.

Here's how I want the dialouges to be: When the player interracts with something a box comes up with text it in. The box can upon input be refreshed to that the player can view the next line of text. I also want actions available like different directions of the dialouge depending on simple input like yes/no, and items given to the player upon reaching a point in a dialouge (a line).

I'm using a design pattern where data objects are not responsable for drawing themselves, instead I have a different object (screen) that draws all the things to the screen. My problem is, how do I attack this?
I'm sure I want some kind of dialouge object that both NPCs and Tiles can posses, and I might want a different object, in the screen, that draws the currenty active dialouge.

Thing is I have never done anything like that before, and I'm very unsure how I craft the system, because I obviously need to be able to modify the player from the dialouges, and I also need to be able to get input from the player (the screen has access to both the player, and the input).

Offline evilfrenchguy

Junior Member


Medals: 3



« Reply #1 - Posted 2011-07-07 23:24:12 »

I would have a DialogBox class. In the class, have an Array of Strings, where each element is another sentence or w/e, and a nextLine() method to move the dialog forward. Each NPC would be their own class with all of them inheriting an abstract talk() method. Inside talk(), call the dialog box's nextLine() method. You can program certain NPCs to give an item at a certain point in the conversation by tinkering with their specific talk method.

Just off the top of my head, so it might not be perfect.
Offline Salonika

Junior Newbie




while(alive) { code; play; }


« Reply #2 - Posted 2011-07-09 11:49:47 »

It so happens that i am trying to design a more general user interface api for my game that the input will be this of pokemon like games. A and B buttons and arrow buttons from a keyboard. My idea is to use a class to model all kind of ui elements i.e Component that will be able to update its state based on input and redraw it self. And a second class called Manager  that would hold a list of all the "alive" Components and its task will be to collect the input, send it to all the elements so that they can update their state and finally call their draw methods. Based on this model i plan to design all the ui elements i will need.

If you are interested in the idea why not work together? Let me know  Wink
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Skarion

Senior Member


Medals: 2
Projects: 1



« Reply #3 - Posted 2011-08-16 12:19:55 »

Depends if you want it to show up as in a regular RPG in the bottom (then I'd use a general borderlayout and then just show a jpanel at south when needed which populated from model), though if you want it to pop up next to the tile/player which fire said dialogue I'd use JPopupMenu which pops up when fired. Can easily be modified the way you wish it to be and should be populated from the model.

If you consider either of those suggestions sounds interesting you can just post a reply and I'll see if I can post a quick mock-up code of it.
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.

xsi3rr4x (12 views)
2014-04-15 18:08:23

BurntPizza (11 views)
2014-04-15 03:46:01

UprightPath (24 views)
2014-04-14 17:39:50

UprightPath (10 views)
2014-04-14 17:35:47

Porlus (27 views)
2014-04-14 15:48:38

tom_mai78101 (49 views)
2014-04-10 04:04:31

BurntPizza (108 views)
2014-04-08 23:06:04

tom_mai78101 (208 views)
2014-04-05 13:34:39

trollwarrior1 (176 views)
2014-04-04 12:06:45

CJLetsGame (182 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
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!