在我的游戏中有几个我写的课,包括房间,灯,胸部,java,播放器,键和 Map . 这些都已经过测试并且是正确的,所以现在我正在写我的冒险课程,这是该计划的驱动程序 . 我需要将球员的位置设置为[0] [0],我无法弄清楚如何 . 这是我目前在我的房间和冒险课上所拥有的 .

public class Adventure {

Scanner in = new Scanner(System.in);

private Room room;

public Adventure() {

Player player = new Player();

Map map = new Map();

player.setX(0);

player.setY(0);

int x = 0;

int y = 0;

map.getRoom(x, y).getDescription();

}

}

public class Room {

private String description;

private boolean north;

private boolean south;

private boolean east;

private boolean west;

private boolean isDark;

private Lamp theLamp;

private Key theKey;

private Chest theChest;

/**

* Returns the text description of this room

*/

public String getDescription() {

return description;

}

/**

* Returns true if the player can go north from this room

*/

public boolean canGoNorth() {

return north;

}

/**

* Returns true if the player can go south from this room

*/

public boolean canGoSouth() {

return south;

}

/**

* Returns true if the player can go east from this room

*/

public boolean canGoEast() {

return east;

}

/**

* Returns true if the player can go west from this room

*/

public boolean canGoWest() {

return west;

}

/**

* Returns the lamp object in this room.

* If no lamp is present, returns null

*/

public Lamp getLamp() {

return theLamp;

}

/**

* Sets the lamp variable in this room to null

*/

public void clearLamp() {

theLamp = null;

}

/**

* Returns the key object in this room.

* If no key is present, returns null

*/

public Key getKey() {

return theKey;

}

/**

* Sets the key variable in this room to null

*/

public void clearKey() {

theKey = null;

}

/**

* Returns the chest object in this room.

* If no chest is present, returns null

*/

public Chest getChest() {

return theChest;

}

/**

* Returns true if there is no light in this room,

* veeeeeeeery dangerous!

*/

public boolean isDark() {

return isDark;

}

/**

* Hey wassup dawg? I'ma constructor. I make the objects round these parts,

* sometimes without even trying, knowwhatimssayin?

* Yall don't haveta worry 'bout me for this'ere game, but look me up in

* Chapter 6 sometime. Kay?

*

*/

public Room(String description, boolean north, boolean south, boolean east,

boolean west, boolean isDark, Lamp theLamp, Key theKey,

Chest theChest) {

super();

this.description = description;

this.north = north;

this.south = south;

this.east = east;

this.west = west;

this.isDark = isDark;

this.theLamp = theLamp;

this.theKey = theKey;

this.theChest = theChest;

}

}

我必须将房间位置设置为0,0,以便打印出 Map 类中的描述 .

java冒险游戏_冒险类的基于文本的冒险游戏相关推荐

  1. Java写文字冒险类游戏_用木兰语言编写文字冒险游戏(十三、四章),又一个特性发现...

    继续改写 Python 文字冒险游戏,第十三章的主要添加了玩家在每格的行动限制: func 选择命令(位置, 玩家) { 行动 = nil while !行动 { 可选行动 = 取可选行动(位置, 玩 ...

  2. 微信第三方扫描登录 java源代码_微信开放平台基于网站应用授权登录源码(java)...

    1. 第三方发起微信授权登录请求,微信用户允许授权第三方应用后,微信会拉起应用或重定向到第三方网站,并且带上授权临时票据code参数: 2. 通过code参数加上AppID和AppSecret等,通过 ...

  3. java 单例基类_PHP基于单例模式实现的数据库操作基类

    本文实例讲述了PHP基于单例模式实现的数据库操作基类.分享给大家供大家参考,具体如下: 配置文件: $db = array( 'host'=>'localhost', 'user'=>'r ...

  4. java 图形处理_课内资源 - 基于Java实现的几何图形处理系统

    1 综述 针对<计算机图形学>课程开发的几何图形处理系统实现的功能包括:在UI界面中通过鼠标点击拖拽等方式可视化地输入二维图形的功能:编辑最近输入的二维图形的功能:裁剪直线的功能,支持的图 ...

  5. java毕业论文_【毕业论文】基于java的博客网站设计与开发毕业论文(word文档)

    <[毕业论文]基于java的博客网站设计与开发毕业论文.doc>由会员分享,可免费在线阅读全文,更多与<[毕业论文]基于java的博客网站设计与开发毕业论文(word文档)>相 ...

  6. Java项目----家庭记账软件(基于文本界面)

    一.涉及要点: ①变量的定义 ②基本数据类的使用 ③循环语句 ④分支语句 ⑤方法声明.调用和返回值的接收 ⑥简单屏幕输出格式控制 二.需求说明 ①能够记录家庭的收入.支出,并能够打印收支明细表 ②采用 ...

  7. java 遗传算法_遗传算法(Genetic Algorithm)——基于Java实现

    一.遗传算法原理介绍 遗传算法(Genetic Algorithm)是模拟达尔文生物进化论的自然选择和遗传学机理的生物进化过程的计算模型,是一种通过模拟自然进化过程搜索最优解的方法.遗传算法是从代表问 ...

  8. java 保留字_定义类的保留字是什么?接口的保留字是什么?(JAVA)

    Shape.java package com.examples.demo1.shape;public interface Shape {float area(); //计算几何图形的面积float g ...

  9. python 文字冒险游戏_用木兰语言重写 Python 文字冒险游戏(九到十一章)

    续前文,继续到第十一章,期间根据须要对些许木兰语言功能进行了重现,并发布了木兰版本 0.0.15.1 .游戏例程代码已经开源在 gitee,第十一章运行效果以下,欢迎提 issue.javascrip ...

最新文章

  1. JAVA用最简单的方法来构建一个高可用的服务端,提升系统可用性
  2. 【Android 插件化】Hook 插件化框架 ( 合并 “插件包“ 与 “宿主“ 中的 Element[] dexElements | 设置合并后的 Element[] 数组 )
  3. Excel工作表密码保护的破解
  4. 解析/etc/inittab 文件(转)
  5. 在过程中要正式批准可交付成果_邛海—螺髻山风景名胜区邛海西岸详细规划》获国家林草局批准执行...
  6. 一招解决IDEA启动慢的困扰
  7. 算法基础--基本排序算法总结·
  8. OpenCV视频生成报错 Incorrect library version loaded Could not open codec ‘libopenh264‘: Unspecified error
  9. 高通利用DMCA通知迫使GitHub关闭100+代码库
  10. 贪吃蛇代码--c语言版 visual c++6.0打开
  11. objectc foundation class hierachy
  12. 华为人才选拔的管理实践
  13. 解决电脑usb接口无法识别u盘,键盘,鼠标的问题。
  14. 阿里云大数据组件的基本介绍
  15. SpringBoot word文件转pdf
  16. 宝石与石头(简单难度)
  17. SPSS学习笔记之——OR值与RR值
  18. Xilinx XDMA 上位机应用程序控制逻辑
  19. 解决【v-show 有时失效】问题
  20. 利用CSV 引擎加载数据

热门文章

  1. outlook 2013 如何设置gmail邮箱
  2. CSS 兼容性(陆续更新)
  3. 社保基金持有26股数量超1000万股
  4. Rhythmbox音乐播放器常见问题
  5. Android Studio显示“Hardcoded String XXX,should use @string resource”的解决方法2-2
  6. 【博弈论】耶鲁大学公开课--博弈论Problem Set 2--Solution
  7. 访问mysql的urn地址,URL,URI 和URN 之间的区别
  8. mac安装EasyConnect、mac使用EasyConnect,mac安装EasyConnectPlugin失败
  9. 细说Python设计模式之模板方法模式(封装算法)
  10. frameset、frame、iframe