Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

本地农场开发教程

[复制链接]
恋之Q宠家族 发表于 2009-11-3 01:07:06 | 显示全部楼层 |阅读模式
编程源码


#include <stdio.h>
#include <string.h>
#include <Windows.h>
#include <conio.h>
#include <time.h>
#include <stdlib.h>


#define bailuobo 0
#define huluobo 1
#define yumi     2
#define tudou 3
#define qiezi 4
#define wandou 5
#define lajiao 6
#define nangua 7
#define pingguo 8
#define caomei 9
#define xigua 10
#define xiangjiao 11
#define taozi 12
#define chengzi 13
#define putao 14
#define shiliu 15
#define youzi 16
#define aixin 17

//化肥
#define putong 0
#define qiangxiao   1
#define chaoji 2

//状态
#define queshui     0
#define chonghai 1
#define zacao     2

//作物阶段
#define zhongzi     0
#define faya 1
#define kaihua 2
#define chengshu 3
#define kuwei     4

#define MY_FARM 1
#define FRIEND_FARM 0



//种子
struct Seed
{
char name[10];
int  number;
int  price;
int id;
}stSeed[18];

//果实
struct Gains
{
char name[10];
int number;
int price;
}stGains[18];

//化肥
struct Fertilizer
{
char name[10];
int number;
int reduceTime;
int price;
}stFertilizer[3];

//作物
struct Crop
{
char name[10];
int state[3];
int changeTime;
int stage;
bool isUsedFertilizer;
int numberOfFruit;
bool isPicked;
int Exp;
long  plantedTime;
int id;
} stCrop[18];

//土地
struct Land
{
bool isPlanted;
bool isReclamated;
Crop crop;
};

//仓库
struct Storehouse
{
Gains gains[18];
int totalValue;
};

//背包
struct Bag
{
Seed seed[18];
Fertilizer fertilizer[3];
};

//账户
struct  Account
{
char name[16];
char password[16];
};

//用户
struct User
{
Account account;
Land land[9];
Storehouse  storehouse;
Bag bag;
long experience;
long money;
};

//升级所需经验
int experience[15] = {200,800,2000,4000,7000,11200,16800,24000,33000,44000,57200,72800,91000,112000,136000};

//开地所需金钱和等级
int LandMoney[10] = {0,0,0,0,10000,20000,30000,50000,70000,90000};
int LandLevel[10] = {0,0,0,0,5,7,9,11,13,15};
回复

使用道具 举报

 楼主| 恋之Q宠家族 发表于 2009-11-3 01:07:28 | 显示全部楼层
void InitSeed(Seed seed[])
{
strcpy(seed[0].name,"白萝卜");
seed[0].number = 0;
seed[0].price = 147;
seed[0].id = 0;

strcpy(seed[1].name,"胡萝卜");
seed[1].number = 0;
seed[1].price = 163;
seed[1].id = 1;

strcpy(seed[2].name,"玉米");
seed[2].number = 0;
seed[2].price = 216;
seed[2].id = 2;

strcpy(seed[3].name,"土豆");
seed[3].number = 0;
seed[3].price = 244;
seed[3].id = 3;

strcpy(seed[4].name,"茄子");
seed[4].number = 0;
seed[4].price = 295;
seed[4].id = 4;

strcpy(seed[5].name,"豌豆");
seed[5].number = 0;
seed[5].price = 328;
seed[5].id = 5;

strcpy(seed[6].name,"辣椒");
seed[6].number = 0;
seed[6].price = 376;
seed[6].id = 6;

strcpy(seed[7].name,"南瓜");
seed[7].number = 0;
seed[7].price = 425;
seed[7].id = 7;

strcpy(seed[8].name,"苹果");
seed[8].number = 0;
seed[8].price = 526;
seed[8].id = 8;

strcpy(seed[9].name,"草莓");
seed[9].number = 0;
seed[9].price = 691;
seed[9].id = 9;

strcpy(seed[10].name,"西瓜");
seed[10].number = 0;
seed[10].price = 858;
seed[10].id = 10;

strcpy(seed[11].name,"香蕉");
seed[11].number = 0;
seed[11].price = 959;
seed[11].id = 11;

strcpy(seed[12].name,"桃子");
seed[12].number = 0;
seed[12].price = 1360;
seed[12].id = 12;

strcpy(seed[13].name,"橙子");
seed[13].number = 0;
seed[13].price = 1611;
seed[13].id = 13;

strcpy(seed[14].name,"葡萄");
seed[14].number = 0;
seed[14].price = 2111;
seed[14].id = 14;

strcpy(seed[15].name,"石榴");
seed[15].number = 0;
seed[15].price = 2435;
seed[15].id = 15;

strcpy(seed[16].name,"柚子");
seed[16].number = 0;
seed[16].price = 2887;
seed[16].id = 16;

strcpy(seed[17].name,"爱心");
seed[17].number = 0;
seed[17].price = 3030;
seed[17].id = 17;

}

void InitGains(Gains gains[])
{
strcpy(gains[0].name,"白萝卜");
gains[0].number = 0;
gains[0].price = 17;

strcpy(gains[1].name,"胡萝卜");
gains[1].number = 0;
gains[1].price = 21;

strcpy(gains[2].name,"玉米");
gains[2].number = 0;
回复

使用道具 举报

 楼主| 恋之Q宠家族 发表于 2009-11-3 01:07:45 | 显示全部楼层
大家可以参考下 有能力的继续编写
回复

使用道具 举报

loverp 发表于 2009-11-3 01:08:28 | 显示全部楼层
谢谢提供!
回复

使用道具 举报

yawei74 发表于 2009-11-3 01:09:19 | 显示全部楼层
C language?
回复

使用道具 举报

qtxxgyq 发表于 2009-11-3 01:21:15 | 显示全部楼层
{:4_103:}还装?!.........
回复

使用道具 举报

凡军 发表于 2009-11-3 01:25:10 | 显示全部楼层
((em:08))((em:08))
回复

使用道具 举报

dbangel 发表于 2009-11-3 01:39:41 | 显示全部楼层
好樣....真有你的.....((em:01))
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-15 06:17 , Processed in 0.153607 second(s), 14 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表