📄 character.cpp
字号:
//
// Character--角色
//
// Copyright (c) 2000-2001 Chihiro.SAKAMOTO (HyperWorks)
//
#include "StdAfx.h"
#include "Image.h"
#include "Sprite.h"
#include "Character.h"
using namespace std;
bool CCharacter::MoveAnime(int dir, int count)
{
direction = dir;
CPoint map_pos = map_point;
switch (dir) {
case UP:
draw_pos.x -= MAPGRID_WIDTH / 8;
draw_pos.y -= MAPGRID_HEIGHT / 8;
map_pos.y--;
break;
case DOWN:
draw_pos.x += MAPGRID_WIDTH / 8;
draw_pos.y += MAPGRID_HEIGHT / 8;
map_pos.y++;
break;
case LEFT:
draw_pos.x -= MAPGRID_WIDTH / 8;
draw_pos.y += MAPGRID_HEIGHT / 8;
map_pos.x--;
break;
case RIGHT:
draw_pos.x += MAPGRID_WIDTH / 8;
draw_pos.y -= MAPGRID_HEIGHT / 8;
map_pos.x++;
break;
}
static int index_table[] = {
1, 0, 2, 0,
} ;
src_pos.x = (MOVE_OFS + index_table[count]) * size.cx;
src_pos.y = dir * size.cy;
if (count == 3) {
SetMapPoint(map_pos);
return true;
}
return false;
}
bool CCharacter::AttackAnime(int count)
{
src_pos.x = (ATTACK_OFS + count) * size.cx;
src_pos.y = direction * size.cy;
return count == ATTACK_STEP - 1;
}
bool CCharacter::HitAnime(int count)
{
src_pos.x = (HIT_OFS + count) * size.cx;
src_pos.y = direction * size.cy;
return count == HIT_STEP - 1;
}
bool CCharacter::MagicAnime(int count)
{
src_pos.x = (MAGIC_OFS + count) * size.cx;
src_pos.y = direction * size.cy;
return count == MAGIC_STEP - 1;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -