팀 작업
사고방식 묘사
이번 임무는 두 가지 부분을 맡는다. 하나는 기능류이고 일부 인물 수치와 영웅 수치를 평가한다. 다른 하나는 정령류이다. 각 정령의 스티커를 모아 그린다.
설계 실현 과정 및 코드 설명
엘프 클래스 헤더 파일
sprite.h
#pragma once
#include
#include
#include
#include
#include
#include
#include
class sprite
{
public:
sprite(int num, int be)//
{
pic_num = num;
begin = be;
}
sprite() {
}
~sprite() {
}
int pic_num;//
int begin;
void show(int x, int y, int index, HDC hdc, CImage pic[])//index 0
{
pic[(index%pic_num) + begin].Draw(hdc, x, y);
}
void show(int x, int y, int index, HDC hdc, CImage pic[], int w, int h)//
{
pic[(index%pic_num) + begin].Draw(hdc, x, y, w, h);
}
void show(int x, int y, int index, HDC hdc, CImage pic[], int w, int h, int Px, int Py, int Pw, int Ph)//
{
pic[(index%pic_num) + begin].Draw(hdc, x, y, w, h, Px, Py, Pw, Ph);
}
};
처음에 디자인된 정령류는 각 정령의 그림만 저장하는 데 사용되었다. 개선된 후에 모든 정령 그림을 번호에 따라 전문적인 수조에 저장하고 지침으로 접근한다.picnum는 이 정령의 그림이 얼마나 많은지, begin은 그 시작 위치를 표시하며, 이렇게 하면 이 정령의 모든 그림집을 방문할 수 있다.세 개의 show 함수를 다시 불러와서 그림을 그리는데 어떤 도형은 변화가 발생한다. 예를 들어 핏줄의 길이는 다시 그려야 한다. 첫 번째는 일반적인 그림이고, 두 번째는 특정한 방향만 변화하는 도형을 그린다. 예를 들어 각 물체의 핏줄 등, 세 번째는 여러 방향이 변화하는 도형을 그린다. 예를 들어 큰 글자폭(어떤 기술)은 이동에 따라 점점 커진다.
엘프 클래스 cpp 파일
sprite.cpp
#include "sprite.h"
#include
#include
#include
#include
#include
#include
모든 묘사는 헤더 파일에 있는데, 이 부분은 아무런 실제적인 내용이 없다.
기술 클래스 헤더 파일
skill.h
#pragma once
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include"skill.h"
#define red 0
#define blue 1
#define so_big 99999
class hero;
class Army;
class hurt;
class tower;
using namespace std;
class skill
{
public:
skill() {}
skill(int who_, sprite SPR_atk_[]);
~skill() {}
int CD, cost;// CD
int who;//
sprite *Spr_ani;//
void skill_use(hero *, list&, long long&);//
bool can_use_skill(int cd_, int mp_);//
};
이 부분include의 많은 관련 파일을 설명하고 필요한 설명을 했습니다.
기술 클래스 cpp 파일
skill.cpp
#include "sprite.h"
#include"skill.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include"hero.h"
#include"hurt.h"
#include"Army.h"
#include "tower.h"
using namespace std;
#pragma once
#define red 0
#define blue 1
skill::skill(int who_, sprite SPR_atk_[])
{
who = who_;
Spr_ani = SPR_atk_;
if (who_ == 1)
{
CD = 10;
cost = 10;
}
if (who_ == 2)
{
CD = 10;
cost = 10;
}
if (who_ == 3)
{
CD = 10;
cost = 10;
}
if (who_ == 4)
{
CD = 10;
cost = 10;
}
if (who_ == 5)
{
CD = 10;
cost = 10;
}
if (who_ == 6)
{
CD = 10;
cost = 10;
}
if (who_ == 7)
{
CD = 10;
cost = 10;
}
if (who_ == 8)
{
CD = 10;
cost = 10;
}
if (who_ == 9)
{
CD = 10;
cost = 10;
}
if (who_ == 10)
{
CD = 10;
cost = 10;
}
if (who_ == 11)
{
CD = 10;
cost = 10;
}
if (who_ == 12)
{
CD = 10;
cost = 10;
}
}
void skill::skill_use(hero *user, list &Magic, long long &object_ID)
{
if (who == 1)//
{
user->fast = 1;
user->fast_time = 100;
}
else if (who == 2)//
{
user->angry = 1;
user->angry_time = 100;
}
else if (who == 3)//
{
int tx, ty;
tx = user->x + 24 - 16;
ty = user->y + 24 - 16;
Magic.push_back(hurt(tx, ty, user->color, object_ID++, 8, *(Spr_ani + 2), user->atk, user, user->fx));
user->sleep = 1;
user->weak_time = 5;//
}
else if (who == 4)//
{
int tx, ty;
int ax, ay;
ax = user->x + user->wide;
ay = user->y + user->hight;
if (user->fx == 0)
{
tx = ax + 24;
ty = ay - 24 - 16;
}
if (user->fx == 90)
{
tx = ax - 16;
ty = ay - 24 - 64;
}
if (user->fx == 180)
{
tx = ax - 24 - 32;
ty = ay - 24 - 16;
}
if (user->fx == 270)
{
tx = ax - 16;
ty = ay + 24;
}
Magic.push_back(hurt(tx, ty, user->color, object_ID++, 3, *(Spr_ani + 4), user->atk, user, user->fx));
user->sleep = 1;
user->weak_time = 5;//
}
else if (who == 5)//
{
int tx, ty;
tx = user->x + 24 - 32;
ty = user->y + 24 - 32;
Magic.push_back(hurt(tx, ty, user->color, object_ID++, 2, *(Spr_ani + 5), 0, user, user->fx));
user->sleep = 1;
user->weak_time = 5;//
}
else if (who == 6)//
{
int tx, ty;
tx = user->x + 24;
ty = user->y + 24;
Magic.push_back(hurt(tx, ty, user->color, object_ID++, 5, *(Spr_ani + 7), user->atk, user, user->fx));
user->sleep = 1;
user->weak_time = 5;//
}
else if (who == 7)//
{
int tx, ty;
tx = user->x;
ty = user->y;
for (int i = 0; i<360; i += 45)
Magic.push_back(hurt(tx, ty, user->color, object_ID++, 6, *(Spr_ani + 9), user->atk, user, i));
user->sleep = 1;
user->weak_time = 5;//
}
else if (who == 8)//
{
int tx, ty;
tx = user->x + 24 - 16;
ty = user->y + 24 - 16;
Magic.push_back(hurt(tx, ty, user->color, object_ID++, 9, *(Spr_ani + 3), user->atk, user, user->fx));
user->sleep = 1;
user->weak_time = 5;//
}
else if (who == 9)//
{
int tx, ty;
tx = user->x + 24 - 80;
ty = user->y + 24 - 80;
Magic.push_back(hurt(tx, ty, user->color, object_ID++, 4, *(Spr_ani + 8), user->atk, user, user->fx));
user->sleep = 1;
user->weak_time = 20;//
}
else if (who == 10)//
{
user->wudi = 1;
user->wudi_time = 50;
}
else if (who == 11)//
{
int tx, ty;
tx = user->x + 24 - 16;
ty = user->y + 24 - 16;
Magic.push_back(hurt(tx, ty, user->color, object_ID++, 1, *(Spr_ani), user->atk, -1, user));
user->sleep = 1;
user->weak_time = 5;//
}
else//
{
int tx, ty, fx_;
tx = user->x + 24 - 16;
ty = user->y + 24 - 16;
fx_ = user->fx;
Magic.push_back(hurt(tx, ty, user->color, object_ID++, 7, *(Spr_ani), user->atk, user, fx_));
Magic.push_back(hurt(tx, ty, user->color, object_ID++, 7, *(Spr_ani), user->atk, user, (fx_ + 45) % 360));
Magic.push_back(hurt(tx, ty, user->color, object_ID++, 7, *(Spr_ani), user->atk, user, (fx_ - 45 + 360) % 360));
user->sleep = 1;
user->weak_time = 5;//
}
}
bool skill::can_use_skill(int cd_, int mp_) {
if (cd_ >= CD && mp_ >= cost)
return true;
return false;
}
4
4
4
시간을 소비하다
정령류는 구상부터 결합 자료 조회를 실현하는 데 한 시간 남짓 걸린다. 기능류는 값을 부여하고 각 파라미터에 대한 균형과 약화 개선, 그리고 각 기능에 대한 효과 개선을 해야 하기 때문에 비교적 번거롭다. 3시간 정도 걸린다.
당면한 문제
그림 그리는 문제는 줄곧 매우 곤란했다. 많은 자료를 찾아보았지만 잘 이해하지 못했다. 결국은 가장 난폭한 방법으로 해결할 수 밖에 없었다. 먼저 배경을 그리고 배경에 각 물체를 그렸다. 다시 배경으로 모든 내용을 덮어버리고 다시 새로운 물체를 그렸다. 이렇게 반복했다.
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.