宝可梦&伏魔录 小游戏_Java_控制端:小总结

文章目录

  • 宝可梦&伏魔录 小游戏_Java_控制端:小总结
  • 前言
  • 一、简述
  • 二、宝可梦项目
    • 1.设计思想
    • 2.宝可梦项目总结
      • 1. 前期开发设计
      • 2. 编程设计
      • 3. 测试
  • 三、伏魔录小游戏项目
    • 1、编程思想
    • 2、所悟知识
  • 四、最终总结

前言

此文档主要是作为Java初学者的第一次小项目,虽然项目还不够完善,但是想在这里做一下总结。也顺便梳理以下最近的学习,对自己整个的学习自我认知一下。
可能现在作者水平有限,但是确实初学者当下比较真实的想法与认知,期望各位创客能多加以指点。


一、简述

宝可梦项目是在还不是特别了解面向对象思想的时候,编写的项目。
但是,在此次项目之后,又通过面向对象的思想学习编写了伏魔录小游戏。
本文主要是通过开发两次项目的总结与经验做对比。比对出相应的问题与应该改进的地方。

二、宝可梦项目

1.设计思想

玩家首先获得一个宝可梦,有一定自身的属性和金钱;之后通过去不同地图从而进行商品的交易和打怪升级(其中也包含捕捉新的宝可梦等基本技能)。
总而言之,就是一个类似于宝可梦的超简化版小游戏 (控制台输入输出)。


尽管宝可梦版本还有很多不完善的地方,但是基本的功能运行是没有问题的。
整个项目的代码较为冗余,因此,只选择了Player类中的主要方法来展示,如下代码。

//遭遇野怪public void encounter(String monster) {int l = 0;if (monster.equals("boss")) {pokemons = boss;System.out.println("你嚣张的向道馆馆主发起了挑战。你大叫一声:呔! 你敢应战么?");System.out.println("道馆馆主抬起眼眸,轻蔑的瞟了你一眼:GO first!");System.out.println("你巴拉巴拉精灵袋:");showAll();//打印精灵System.out.println("————— @  ————");System.out.println(" || @@@@@ ||");System.out.println(" || @@@@@ ||");System.out.println(" ||_______||");System.out.println("你从袋子里选出来了一个小精灵:");int chioce = scanner.nextInt() - 1;show(chioce);//展示选择的宝可梦System.out.println("就是你了,宝可梦!||");pokemons.show();while (l == 0) {l = interfaces(monster, chioce);}} else if (monster.equals("monster")) {pokemons = createmonster();//调用System.out.println("野怪突然闪现,吓你一跳!");System.out.println("哎嘿?前面那是什么?难道是..." + pokemons.pokemonName + "?!!");System.out.println("这下可太好了,这种小怪小力的,用来训练最好了!@_@,去吧!宝可梦!");int chioce = scanner.nextInt() - 1;while (chioce < 0 || chioce > 3 || this.pokemon[chioce].pokemonName == null) {System.out.println("【NPC】你有吗?不,你没有!");chioce = scanner.nextInt() - 1;}while (!this.pokemon[chioce].pokemonStatus) {System.out.println("【NPC】你的宝可梦真实太菜了!竟然打不过?!你还有其他的宝可梦么?有就快上!别怂!");chioce = scanner.nextInt() - 1;}show(chioce);//我拥有的宝可梦pokemons.show();//小怪 宝可梦while (l == 0) {l = interfaces(monster, chioce);}}}public int interfaces(String monster, int chioces) {System.out.println("+--------------+");System.out.println("|1.战斗  2.物品|");System.out.println("|3.捕获  4.逃跑|");System.out.println("+--------------+");System.out.print("请选择你要进行的操作:");int choice = scanner.nextInt();while (choice > 4 || choice < 1) {System.out.println("不会吧,这么简单的操作都不会?重来重来!");choice = scanner.nextInt();}switch (choice) {//战斗case 1:return battle(chioces);//物品case 2:openpackage(monster);break;//捕获case 3:switch (capture()) {//捕获失败直接结束case -1:return -1;//精灵球不足或放弃捕捉case 0:interfaces(monster, choice);break;//捕捉成功case 1:for (int i = 0; i < 4; i++) {if (this.pokemon[i] == null) {this.pokemon[i] = pokemons;break;} else if (i == 3) {System.out.println("你这瘦弱的身板只能携带四只,你要放弃你原有的宝可梦吗?(y/n)");String z = scanner.next();if (z.equals("y")) {//放弃System.out.println("好吧,你这个喜新厌旧的家伙");System.out.println("你要放弃哪一只?");System.out.println("1." + pokemon[0].pokemonName);System.out.println("2." + pokemon[1].pokemonName);System.out.println("3." + pokemon[2].pokemonName);System.out.println("4." + pokemon[3].pokemonName);int v = scanner.nextInt() - 1;pokemon[v] = pokemons;} else {//不放弃System.out.println("看来你还是喜欢原来的,好吧那就这样吧");}}}return 2;}break;//逃跑case 4:System.out.println("你个s货,竟然跑了!");return -1;}return 0;}//战斗public int battle(int chioces) {int attack = 0;if (pokemons.pokemonStatus && pokemon[chioces].pokemonStatus) {System.out.println("+——宝可梦技能——+");System.out.println("+-------------------------------+");System.out.println("1." + this.pokemon[chioces].attackSkill1 + "  2." + this.pokemon[chioces].attackSkill2);System.out.println("3." + this.pokemon[chioces].attackSkill3 + "  4." + this.pokemon[chioces].specSkill);System.out.println("+-------------------------------+");System.out.print("【Select】选择你要进行的操作:");int choice1 = scanner.nextInt();switch (choice1) {case 1:System.out.println("你使用了" + this.pokemon[chioces].attackSkill1);attack = this.pokemon[chioces].attackSkill1Value + this.pokemon[chioces].pokemonAttack - pokemons.pokemonDefend;if (attack > 0) {pokemons.pokemonhp -= attack;}this.pokemon[chioces].attackSkill1Value++;break;case 2:System.out.println("你使用了" + this.pokemon[chioces].attackSkill2);attack = this.pokemon[chioces].attackSkill2Value + this.pokemon[chioces].pokemonAttack - pokemons.pokemonDefend;if (attack > 0) {pokemons.pokemonhp -= attack;}this.pokemon[chioces].attackSkill2Value++;break;case 3:System.out.println("你使用了" + this.pokemon[chioces].attackSkill3);attack = this.pokemon[chioces].attackSkill3Value + this.pokemon[chioces].pokemonAttack - pokemons.pokemonDefend;if (attack > 0) {pokemons.pokemonhp -= attack;}this.pokemon[chioces].attackSkill3Value++;break;case 4:System.out.println("你使用了" + this.pokemon[chioces].specSkill);attack = this.pokemon[chioces].specSkillValue + this.pokemon[chioces].pokemonAttack - pokemons.pokemonDefend;if (attack > 0) {pokemons.pokemonhp -= attack;}this.pokemon[chioces].attackSkill1Value++;break;}//敌对生物随机技能int monsterSkill = 0;switch (random.nextInt(4)) {case 0:monsterSkill = pokemons.attackSkill1Value;break;case 1:monsterSkill = pokemons.attackSkill2Value;break;case 2:monsterSkill = pokemons.attackSkill3Value;break;case 3:monsterSkill = pokemons.specSkillValue;break;}int a = monsterSkill + pokemons.pokemonAttack - this.pokemon[chioces].pokemonDefend;if (a > 0) {this.pokemon[chioces].pokemonhp -= a;}System.out.println("【Tips】您目前的生命值还有:" + this.pokemon[chioces].pokemonhp);if (this.pokemon[chioces].pokemonhp <= 0) {this.pokemon[chioces].pokemonStatus = false;} else if (pokemons.pokemonhp <= 0) {pokemons.pokemonStatus = false;}}if (pokemons.pokemonStatus == false) {pokemons.pokemonStatus = true;pokemons.pokemonhp = pokemons.pokemonHp;System.out.println("你打到了对手");this.money += 100;return 1;} else if (pokemon[chioces].pokemonStatus == false) {System.out.println("【NPC】虽然你还有可以出战的宝可梦,但你已经输了,真可惜,我的勇士!你还需要历练吖!!!");return -1;}return 0;}//打开物品public void openpackage(String monster) {//非战斗状态无法使用System.out.println("1.精灵球.......x" + this.pokeBall);System.out.println("2.疗伤药.......x" + this.medicine);//战斗状态无法使用System.out.println("3.返回");System.out.print("【Tips】请选择你要进行的操作:");int choice = scanner.nextInt();while (choice > 3 || choice < 1) {System.out.println("【Tips】输入错误");choice = scanner.nextInt();}switch (choice) {//精灵球case 1:System.out.println("【Tips】当前页面无法操作");break;//疗伤药case 2:if (this.medicine > 0) {System.out.println("【NPC】选择你要治疗的宝可梦");showAll();//打印精灵int a = scanner.nextInt() - 1;if (this.pokemon[a] != null) {System.out.println("【NPC】你治疗了你的宝可梦");this.medicine--;this.pokemon[a].pokemonhp += 20;} else {System.out.println("【NPC】你没有这只宝可梦,就想使用它?!你怕是在做梦。");}} else {System.out.println("【NPC】你的药品不足吖!");}break;//返回case 3:encounter(monster);}}//捕获宝可梦public int capture() {if (pokeBall > 0) {this.pokeBall--;for (int i = 0; i < 5; i++) {//                int a = 1;if ((int) Math.random() * 5 == 1) {System.out.println("【NPC】运气不错,被你捉到了@");return 1;} else {System.out.println("【NPC】你这手气有点黑");return 0;}}System.out.println("【NPC】我可以确认你是非洲来的,遇到好捕捉的精灵你都捉不到...我的勇士,你不行吖");return -1;} else {System.out.println("【NPC】不是吧不是吧,这就用完啦?随身带着几十个精灵球这不是常识吗?");return 0;}}//随机生成野怪public Pokemon createmonster() {int a = random.nextInt(9);switch (a) {case 0:Hitokage hitokage = new Hitokage();pokemons = hitokage;break;case 1:Zenigame zenigame = new Zenigame();pokemons = zenigame;break;case 2:Fushigidane fushigidane = new Fushigidane();pokemons = fushigidane;break;case 3:Butterfree butterfree = new Butterfree();pokemons = butterfree;break;case 4:Dagutorio dagutorio = new Dagutorio();pokemons = dagutorio;break;case 5:Fudin fudin = new Fudin();pokemons = fudin;break;case 6:Isitsubute isitsubute = new Isitsubute();pokemons = isitsubute;break;case 7:Pikachuu pikachuu = new Pikachuu();pokemons = pikachuu;break;case 8:Rokon rokon = new Rokon();pokemons = rokon;break;}return pokemons;}

2.宝可梦项目总结

代码如下(示例):

本次项目的开发问题与总结 需要分为以下几点:

1. 前期开发设计

整个项目的策划与前期设计是很重要的。
首先,有关宝可梦项目的整个设计在前期主要是有一个大概的流程,某些对象和属性。虽然小组内也有一定的规范与参考文档,但可能是因为第一次做,因此,后续很大的问题就出现了。(例如,开法过程中的规范不统一,合并很有难度;开发过程功能想到就加,增大了开发的难度等等。)
所以,前期小组合作开发的规范性、功能等文档,一定要定好。若有修改需要标明。总之,文档是很有必要的。

2. 编程设计

本次编程设计主要是面向过程的思想。
由于小组对于整个面向对象的思想均不太熟悉,造成在面向对象后的思想中穿插着面向过程的思想。所以整个看下来逻辑会稍微有点乱。
所以,面向对象的设计思想是需要多实践、多练、多体会的。项目成员的分工也是有不妥的地方。
因此,小组明确的分工与相应的合作还是需要再体会以及磨练一下。

3. 测试

整个测试的过程主要是由测试人员完成。
但是测试的过程中发现很多代码不够可读。也有一些已知的BUG需要进行修复。

三、伏魔录小游戏项目

此项目主要是包含简单的功能的实现。最终的目的不是为了写出一个完整的小游戏。主要是通过运用面向对象的思想学习并编写一个小游戏。
此项目的分析可能更多的是在宝可梦项目的基础上,侧重于面向对象的思想的学习。

1、编程思想

首先,项目的小组分工比较重要。项目成员清晰、明确的分工会让整个项目的开发周期达到最优。
其次,开发前期的设计很重要。主要包括:需求设计、可行性分析、功能模块是否符合逻辑、规整文档、项目工程与接口等的定义规范等等。

之后,目前对于初学者,最重要的可能就是代码的编写了。可能对于开发熟练的人员,这个不成问题。但是对于初学者来说,一是开发的思想意识还不足以达到相应要求。二是对于整个java的运用还不够熟练。可能很多人说练练就可以了。确实是这样的,但是从不熟练到熟练的过程不是仅仅依靠练习,我目前觉得初学者需要练习+反思+练习+总结。
最后,测试也是一项很重要的工作。(本次主要参与的测试不足以令我悟出新的感悟,在此,就不多说了。)
下次,一定会好好参与一下测试工作。

2、所悟知识

(1)开发中,首先先创建一些需要的对象的类。该类需要什么属性、方法(方法的具体逻辑可以先不实现、做好注释,后续需要再填充)等。(其中很重要的就是要做好注释!)。
(2) 什么时候可以进行封装,什么时候不需要封装。根据设计的类,该封装的属性使用get、set方法进行获取及设置相应的私有属性的值。
(3) 设计时需要判断哪些类是需要被继承的。一般来说,子类无拓展功能,尽量不使用继承的方式。 还有需要注意的一点是:子类不能缩小父类方法的访问权限。如果父类是private的话, 子类是不可以直接使用的,必须通过get方法去获取。
(4) 可能目前比较难编写的是一个类中包含有其他类的对象。目前笔者对于这个了解的还不算清晰,因此,先不在这里写一些总结。
(5) 多态的运用。就例如伏魔录这个小项目。可能中途会遇到很多不同身份的NPC。这时,写一个父类NPC,包含有say()的方法,但是say()的语句不一样时,此时在子类中的方法传入的参数声明的对象的类型可以声明为父类NPC的类型,传入的对象为子类的特定NPC。如下代码。

//玩家类
public void visit(Npc villiagerA) {villiagerA.say();}
//村民类
public class Villiager extends Npc {public void say(){System.out.println("你好,我是村民");}
}

多态就是同一个接口,使用不同的实例而执行不同操作。
例如:
(1)多态成员变量:编译运行看左边

  Npc villiager=new Villiager();System.out.println(villiager.name);//只能取到父类中的值

(2)多态成员方法:编译看左边,运行看右边

Npc villiager=new Villiager();
System.out.println(villiager.say());
//villiager的门面类型是NPC,但实际类型是Villiager,所以调用的是重写后的方法。

四、最终总结

其实,整个来说。这次的总结比较零散。有一种学到了很多,但是记录下来又是另一回事。
所以,在总结这方面,还是需要多写多练。最主要的还是记录一下本次小项目完成后的整个感受以及一些比较触动我的收获。
如果有创客希望看一下项目的代码,共同学习进步。可以私信我留言吖~
最后贴一小部分,我认为比较好的代码。

package com.dell.Professions;/*技能类*/
public class Skill {//    技能名称private String skillName;//    技能伤害private int skillDamage;//    耗蓝量private int manaCost;//学习成本private int goldCost;public Skill(String skillName,int skillDamage, int manaCost,int goldCost){this.skillName = skillName;this.skillDamage = skillDamage;this.manaCost = manaCost;this.goldCost = goldCost;}public Skill(String skillName,int skillDamage, int manaCost){this.skillName = skillName;this.skillDamage = skillDamage;this.manaCost = manaCost;}public String getSkillName() {return skillName;}public Skill setSkillName(String skillName) {this.skillName = skillName;return this;}public int getSkillDamage() {return skillDamage;}public Skill setSkillDamage(int skillDamage) {this.skillDamage = skillDamage;return this;}public int getManaCost() {return manaCost;}public Skill setManaCost(int manaCost) {this.manaCost = manaCost;return this;}public int getGoldCost() {return goldCost;}public Skill setGoldCost(int goldCost) {this.goldCost = goldCost;return this;}
}
package com.dell.characters;import com.dell.Items.Item;
import com.dell.Items.Potion;
import com.dell.locations.Field;
import com.dell.locations.Nowhere;
import com.dell.locations.PrimiaryVilliage;
import com.dell.Professions.Magician;
import com.dell.Professions.Profession;
import com.dell.Professions.Skill;
import com.dell.Professions.Warrior;import java.util.Scanner;/*
*   该类是游戏玩家类
*     对象
*
* */
public class Player {//名字,     封装private String name="张三";//攻击力private int attack = 10;//当前血量private int health = 50;//最大血量private int maxHealth = 50;//当前蓝量private int mana = 100;//最大蓝量private int maxMana = 100;//当前经验值private int exp = 0;//最大经验值private int maxExp  = 10;//    最大经验值的增长private int maxExpGrowth = 10;//防御力private int defense = 10;//当前金钱private int gold = 100;//等级private int level = 1;//    物品栏private Item[] items = new Item[10];//    技能栏private Skill[] skills = new Skill[5];//    职业private Profession profession;
//    设计方法//    打怪public boolean attack(Enemy enemy,Scanner scanner){boolean flag = true;System.out.println(enemy.enemyName +" "+ enemy.health + " "+enemy.mana);while(enemy.health >0 && this.health > 0){System.out.println("请选择操作:");System.out.println("1、攻击");System.out.println("2、施法");
//            System.out.println("3、查看对方状态");int choice = scanner.nextInt();if(choice >0 && choice <3){if(choice == 1){if(this.defense < enemy.attack){this.health = this.health - enemy.attack + this.defense;}if(enemy.defense < this.attack){enemy.health = enemy.health - this.attack + enemy.defense;}}else if(choice == 2){System.out.println("请选择技能:");int i = 0;for(; i < this.skills.length;i++){if(this.skills[i] != null){System.out.println((i+1)+"、"+this.skills[i].getSkillName());}else {break;}}int skillChoice = scanner.nextInt();if(skillChoice >0 && skillChoice < i+2){int skillManaCost = this.skills[skillChoice-1].getManaCost();if(this.mana > skillManaCost){enemy.health = enemy.health - this.skills[skillChoice-1].getSkillDamage();this.mana = this.mana - skillManaCost;}else{System.out.println("魔法不足,进行普通攻击");if(enemy.defense < this.attack){enemy.health = enemy.health - this.attack + enemy.defense;}}if( enemy.mana > enemy.skills[0].getManaCost()){this.health = this.health - enemy.skills[0].getSkillDamage();enemy.mana = enemy.mana - enemy.skills[0].getManaCost();}else {if(this.defense < enemy.attack){this.health = this.health - enemy.attack + this.defense;}}}}}}//打印 自己的信息System.out.println(this.name + "剩余血量为" + this.health + "剩余蓝量为" + this.mana);System.out.println(enemy.enemyName +"剩余血量为" + enemy.health + "剩余蓝量为" + enemy.mana);
//        打印 怪物的信息if(this.health > 0){return flag;}else {return false;}}//    升级public void upgrade(){this.level++;this.maxHealth += this.profession.healthGrowth;this.maxMana += this.profession.manaGrowth;this.maxExp += this.level*this.maxExpGrowth;this.defense += this.profession.defenseGrowth;this.attack += this.profession.attackGrowth;this.health = this.maxHealth;this.mana = this.maxMana;System.out.println("恭喜升级");}//    买东西public void shop(PrimiaryVilliage primiaryVilliage, Scanner scanner){BusinessMan businessMan = primiaryVilliage.getBusinessman();int i =  businessMan.showItems();System.out.println("请选择购买的物品");int choice = scanner.nextInt();if(choice > 0 && choice < i ){//                    第一步,玩家的金币会减少this.setGold(this.getGold() - businessMan.getItemByIndex(choice).itemGold);
//                    第二步,玩家的物品会增加this.addItem(businessMan.getItemByIndex(choice));
//                    第三步,商人的物品会减少businessMan.removeItem(choice);}//显示物品for(int j = 0 ; j <this.items.length ;j++){if(items[j] != null){System.out.println(items[j].itemName);}}System.out.println("******************");for(int j = 0 ; j < businessMan.items.length; j++){if(businessMan.items[j] != null){System.out.println(businessMan.items[j].itemName);}}}public void addItem(Item item){int index = 0;boolean flag = false;for(int i = 0 ; i < this.items.length ; i++){if(items[i] == null){flag = true;index = i;break;}}if(flag) {this.items[index] = item;}else {System.out.println("物品栏已满");}}
//    使用物品public void use(){}//  学技能public void learnSkill(Scanner scanner){if(this.profession == null){System.out.println("请先选择职业");return;}else {//            展示可以学习哪些技能Skill[] skills = this.profession.skillSet;for(int i = 0 ; i < skills.length;i++){if(skills[i] != null) {System.out.println((i + 1) + "、" + skills[i].getSkillName() + " " + skills[i].getGoldCost());}else {break;}}System.out.println("请选择需要学习的技能");int choice = scanner.nextInt();if(choice >= 0 && choice<=skills.length&&skills[choice-1] != null ){//                判断选择的技能是否已经拥有boolean flag = true;for(int i = 0 ; i<this.skills.length;i++){if(skills[choice-1]!=null && this.skills[i] != null && skills[choice-1].getSkillName() == this.skills[i].getSkillName()){System.out.println("该技能已掌握");flag = false;break;}}if(flag){this.getNewSkill(skills[choice-1],scanner);}}}}public void getNewSkill(Skill skill,Scanner scanner){int index = 0;boolean flag = false;for(int i = 0 ; i< this.skills.length;i++){if(this.skills[i] == null){flag = true;index = i;break;}}if(flag) {System.out.println("确定要学习吗?价格是:" + skill.getGoldCost());String s = scanner.next();if(s.equalsIgnoreCase("y")) {int skillGold = skill.getGoldCost();if (this.getGold() > skillGold) {this.setGold(this.getGold() - skillGold);this.skills[index] = skill;} else {System.out.println("穷鬼,没钱学什么技能");}}}else{System.out.println("技能槽已满");}}public Player(){}
// 构造器public Player(String name){this.name = name;
//        给角色初始物品this.items[0] = new Potion("恢复药剂",10);
//        给角色初始技能this.skills[0] = new Skill("撞击",10,2,0);}public int getAttack() {return attack;}public Player setAttack(int attack) {this.attack = attack;return this;}public Item[] getItems() {return items;}public Player setItems(Item[] items) {this.items = items;return this;}public Skill[] getSkills() {return skills;}public Player setSkills(Skill[] skills) {this.skills = skills;return this;}public Profession getProfession() {return profession;}public Player setProfession(Profession profession) {this.profession = profession;return this;}public int getLevel() {return level;}public Player setLevel(int level) {this.level = level;return this;}public String getName() {return name;}//    public Player setName(String name) {//        this.name = name;
//        return this;
//    }public void setName(String name){this.name = name;}public int getHealth() {return health;}public Player setHealth(int health) {this.health = health;return this;}public int getMaxHealth() {return maxHealth;}public Player setMaxHealth(int maxHealth) {this.maxHealth = maxHealth;return this;}public int getMana() {return mana;}public Player setMana(int mana) {this.mana = mana;return this;}public int getMaxMana() {return maxMana;}public Player setMaxMana(int maxMana) {this.maxMana = maxMana;return this;}public int getExp() {return exp;}public Player setExp(int exp) {this.exp = exp;return this;}public int getMaxExp() {return maxExp;}public Player setMaxExp(int maxExp) {this.maxExp = maxExp;return this;}public int getDefense() {return defense;}public Player setDefense(int defense) {this.defense = defense;return this;}public int getGold() {return gold;}public Player setGold(int gold) {this.gold = gold;return this;}public void visit(Older older) {older.say();older.offerItems(this);}public void visit(Npc villiagerA) {villiagerA.say();}//    选择职业public void chooseProfession(int professionChoice) {if(professionChoice == 1){this.profession = new Warrior();}else if(professionChoice == 2){this.profession = new Magician();}}public void heal() {this.health = this.maxHealth;this.mana = this.maxMana;}
/*** 多态的运用,玩家可以在多个地图闲逛。* 此时,若传入的是子类的对象,就需要每个子类都写一遍方法。* 但若是声明的是父类的类型,传入的是子类的对象,那么就可以传入不同的子类对象。* 此时,虽然声明的是父类,但却可以传入父类下的所有子类的对象。*/public boolean wander(Field nowhere, Scanner scanner) {int i = (int)Math.floor(Math.random()*9);System.out.println("遇到怪物 " + nowhere.enemies[i].enemyName);boolean flag = this.attack(nowhere.enemies[i],scanner);if(flag){System.out.println("胜利");this.addExp(nowhere.enemies[i].exp);this.addGold(nowhere.enemies[i].gold);return true;}else {System.out.println("失败");return false;}}//    获得经验public void addExp(int exp){this.exp += exp;if(this.exp >= this.maxExp){this.exp = this.exp - this.maxExp;this.upgrade();}}//    获得金钱public void addGold(int gold){this.gold += gold;}
}

宝可梦小游戏_Java_控制端——总结相关推荐

  1. 5 年营收超 50 亿美元,「宝可梦」游戏是怎么做到的?

    本文转载自极客公园 仅用了一个 GPS 定位,就在游戏领域长出了一个新巨头 近日,时值<精灵宝可梦 Go>(Pokemon Go,以下简称<宝可梦 Go>)五周年之际,数据显示 ...

  2. 开源H5棋牌 cocos creator微信棋牌小游戏 点球科技服务端分析笔记

    新的项目需要做一个微信棋牌小游戏,网上搜了一圈相关的代码. 单就完整性来说,幼麟棋牌的开源代码比较完整(cocosCreator客户端.nodeJs服务端.数据库脚本) 实现了一款房卡麻将基本功能(热 ...

  3. Pygame小游戏:可控制的烟花~过年啦~

    自控烟花升空 实现效果描述 效果 代码地址 解析 main.py core.py fireworks.py 写在最后 实现效果描述 这大过年的不弄点有意思的怎么行呢?可以考虑用编程实现一个烟花升空-爆 ...

  4. 用cocos2d-x(初级)实现篮球投篮小游戏,控制篮球投篮,一共三关(第二第三关使用box2d物理引擎)

    实现的功能:(分关说明) 主界面: 1.点击三个不同的按钮实现界面跳转. 第一二三关: 1.用简单的物理公式在update控制小球的运动,实时刷新小球的坐标. 2.使用box2d物理引擎来制作游戏场景 ...

  5. 游戏开发:Html5版宝可梦 Pokémon 游戏制作与设计思路分享(二)地图编辑器

    经过不懈的努力,终于迎来了更新,还会继续更新后续内容. 可能会加一些魔改的功能和玩法--^ ^ 大家可以一起讨论有趣思路 更新已完成的功能: 1.地图编辑器 2.角色移动碰撞检测 . 新实现的功能和大 ...

  6. c语言精灵宝可梦对战游戏,精灵宝可梦究极日月模拟器金手指代码大全

    <精灵宝可梦究极日月>终于迎来了它的发售,相信许多玩家对于这款游戏的素质还是不用怀疑的吧.不过由于游戏的内容实在是太过丰富,许多玩家表示在游戏中许多要素都没法体验尽兴,以下就给大家分享具体 ...

  7. 自有APP上如何运行小游戏?

    近年来小程序游戏迎来了爆发式增长.微信.支付宝.抖音等各大平台小程序游戏愈加丰富,你是否也让自己的App也拥有运行丰富的小游戏的能力?今天就来带大家看看如何实现. 我们先来看看各互联网巨头关于小游戏生 ...

  8. 开发者该如何抓住微信小游戏的风口?听Cocos创始人王哲详解(上篇)

    在微信小游戏真正爆发之前,你该做好这些基础知识储备. 微信小游戏在2017年12月28日正式上线.相对于传统的H5游戏,小游戏的优势十分明显,拥有微信庞大的用户量以及更好的兼容性,在天生适合微信社交生 ...

  9. 微直播笔记|三十分钟微信小游戏开发入门

    微信小游戏在2017年12月28日正式上线.相对于传统的H5游戏,小游戏的优势十分明显,拥有微信庞大的用户量以及更好的兼容性,在天生适合微信社交生态的同时还不用担心被屏蔽.无疑,这或许是一个巨大的风口 ...

最新文章

  1. 用服务器安装nginx部署web页面
  2. 错误名称:EntityCommandExecutionException
  3. Linux学习 - 目录的权限操作
  4. Vue之通过连接数据库的接口获取列表实现添加删除功能
  5. equal、hashcode、==
  6. 成功解决lightgbm.basic.LightGBMError: Parameter max_depth should be of type int, got “0.02“
  7. madplay 操作步骤
  8. Python教程分享:Python Cookie HTTP获取cookie并处理
  9. JVM内存管理------GC算法精解(五分钟教你终极算法---分代搜集算法)
  10. 前端学习(2664):vue3.0的todolist控制完成和未完成
  11. 青、取之于蓝,而青于蓝。
  12. 马云欣赏你,你的创业就已成功了一半
  13. BACKPROPAGATION 手工求解
  14. Python生态工具
  15. 今日头条推广精品栏助力场景破壁
  16. 新态势感知系列(1):从态势感知到全方位态势感知
  17. 50个直击灵魂的问题_“天台上他问了自己3个问题,放弃了自杀” | 9个直击心灵的灵魂拷问...
  18. html折叠div,纯CSS折叠/展开div
  19. 广西大学oj1042(小西的数据结构作业)
  20. 列举3个短视频类的产品,并分析其目标用户、主打需求、竞争优势等

热门文章

  1. 家政服务小程序实战教程03-创建自定义应用
  2. 摸瓜APK反编译手册大全(多图)
  3. 第二证券|沪指弱势震荡跌1%,旅游板块逆势走强
  4. oracle 检查索引失效,oracle 索引失效原因_汇总
  5. 用Json配置飞行棋地图/各类型怪物数据
  6. Matlab实现简单K-means聚类算法
  7. HP ZBook G8 CPU温度高,风扇狂转解决办法
  8. 如何设计一个优雅健壮的Android WebView?(上)
  9. CVPR 2021 | 即插即用! CA:新注意力机制,助力分类/检测/分割涨点!
  10. kali 2020 安装最新版linuxQQ