⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 baseobj.cpp

📁 一个三维打斗游戏
💻 CPP
字号:
// (C) Copyright 1996 by Anthony J. Carin.  All Rights Reserved.
#include <stdafx.h>
#include <baseobj.h>
#include "levels.h"
#include "higharea.h"

baseobject::baseobject(CString& filename) : qentry()
{
   if (!filename.IsEmpty())
        m_body = new image(filename);
   else
        m_body = 0;
   m_type = BASEOBJECT;
}

baseobject::~baseobject()
{
   delete m_body;
}

void baseobject::draw()
{
   view c;
   c = m_view;
   c.setzdir(c.zdirection()+zposition);
   c.setxdir(c.xdirection()+xposition);
   c.setydir(c.ydirection()+yposition);
   if (m_body)
   {
      m_body->setto(c);
      m_body->draw();
   }
}

const float EXTRAHIGHT = .25f;

void baseobject::settledown(float y)
{
    float newy = 0.0f;
    coordinate tmp = m_view;
    higharea *tmpptr = Game->HighAreas()->First();
    while (tmpptr != NULL)
    {
        if (tmpptr->iswithin(location()) &&
            newy < tmpptr->hight())
            newy = tmpptr->hight();
        tmpptr = Game->HighAreas()->Next();
    }
    if (newy)
        y += (newy + EXTRAHIGHT);
    if (tmp.y() > y)
    {
        tmp.sety(tmp.y()-0.4f);
        m_view.stepto(tmp, 1.0f);
    }
    else if (tmp.y() < y)
    {
        m_view.sety(y);
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -