• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Game help needed

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have the following information about a game which I have to extend for a tutorial question at Uni. Its for a console based game, where you move the character from square to square. I have to extend it. Looking at the information below about the IOracle interface for the game how would I go about writing a piece of code to search the tile (ie use the metthod required)?
Please note I don't want anyone to write all the code(but you can if you want), just to show me how it would be done.
Thanks
----------------------------------------------------------------------------------
public interface IOracle
The IOracle interface exposes the methods for obtaining pertinent information about the underlying Game World data model. The ITile documentation discusses the role of the tile within the Game World API and how this interface ITile provides its pertinent methods for exposing details of tiles. In addition, the ITileSearchResult documentation provides details of what is returned from the searching methods:
searchTileAt(int, int, int)
searchTileAt(Point, int)
searchAdjacentTo(int, int, int)
searchAdjacentTo(Point, int)

Obtaining An Interface To The Current Game World Oracle
An IOracle interface to the underlying OracleImpl object is obtained through the static method
OracleImpl.obtainOracle(boolean)
by passing boolean false to this method as the rebuildWorld argument. If no OracleImpl object has been previously instantiated, then the
OracleImpl.obtainOracle(boolean) method will act as a factory and instantiate a new OracleImpl object, returning an IOracle interface to this object. Use of the parameterless method OracleImpl.obtainOracle() acts in the same way as calling the parameterised version of the method with the rebuildWorld argument set as boolean false.
Passing boolean true as the rebuildWorld argument to OracleImpl.obtainOracle(boolean) will force the instantiation of a new OracleImpl object, discarding the existing one.
There are two distinct ways to interrogate the Game World through the IOracle interface. Firstly, pertinent details of the Game World tiles can be obtained through the getTileAt(int, int), getTileAt(Point), getAdjacentTo(int, int), getAdjacentTo(Point), getLineOfSight(int, int, int) and getLineOfSight(Point, int). All these methods require either an (x, y) coordinate passed as separate integer arguments or passed as a Point object. In addition, the line of sight methods require an integer visonRange argument. This visonRange argument specifies the maximum distance to see from the coordinate passed in the first arguments as a radius.
When a single ITile or ITileSearchResult interface is returned by one of the above methods, then this interface is for the ITile or ITileSearchResult interface at the coordinates passed as arguments into the methods. Methods that return a single ITile or ITileSearchResult interface are:-
� getTileAt(int, int) and getTileAt(Point)
� searchTileAt(int, int, int) and searchTileAt(Point, int)
 
Let's go to the waterfront with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic