How do I create a popup dialog box in irrlicht when I've reached a certain position?
Like in Resident Evil, when you reach an item and press X, a dialog box comes up.
Thanks!
Dialog boxes!
-
- Posts: 14
- Joined: Wed Jul 04, 2007 4:57 am
-
- Posts: 157
- Joined: Tue Mar 20, 2007 8:30 am
Write yourself a function to check if the players X, Y and Z coordinates are within a certain range (for example, the target position's X, Y and Z +- 10 units or something like that) and if the function returns true, use Irrlichts GUI stuff to make a message show up on screen. Hope that helps
Tell me what you cherish most. Give me the pleasure of taking it away.
Make a bounding box [core::aabbox3df] that describes the position that you want the 'trigger' to be at. In your main game loop, check to see if the player scene node absolute position is inside the box. If it is, set a flag that indicates the 'trigger' has been used, and then create your message box. Something like this...
Once you get that working, you can abstract it out a little bit. You could make a trigger interface that knows how to check that some condition is met, sets an internal 'triggered' flag and calls a function or does some other arbitrary thing. Then you can read these triggers from a configuration file and add them to a list of triggers. Every few ticks you can evaluate a few of the triggers...
Travis
Code: Select all
core::aabbox3df box(100, 100, 100, 110, 110, 110);
bool triggered = false;
while (device->run())
{
if (driver->beginScene(...))
{
smgr->drawAll();
driver->endScene();
}
if (!triggered && box.isPointInside( player->getAbsolutePosition() )
{
triggered = true;
// create dialog or whatever
}
}
Travis
-
- Posts: 14
- Joined: Wed Jul 04, 2007 4:57 am
have a look at tutorial #05.UserInterface, it shows you how to create windows and other gui stuff...
while(!asleep) sheep++;
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java