Working on web, change python to lua
This commit is contained in:
1 parent
90e2a369f4
commit
178f69967b
14 files changed
+327
-162
No files matched your search
@@ -1,5 +1,6 @@
|
||||
#include "Character.h"
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
|
||||
namespace ZL {
|
||||
|
||||
@@ -29,6 +30,7 @@ AnimationState Character::resolveActiveState() const {
|
||||
}
|
||||
|
||||
void Character::update(int64_t deltaMs) {
|
||||
//std::cout << "update called with deltaMs: " << deltaMs << std::endl;
|
||||
// Move toward walk target on the XZ plane
|
||||
Eigen::Vector3f toTarget = walkTarget - position;
|
||||
toTarget.y() = 0.f;
|
||||
@@ -72,6 +74,7 @@ void Character::update(int64_t deltaMs) {
|
||||
|
||||
auto& anim = it->second;
|
||||
anim.currentFrame += static_cast<float>(deltaMs) / 24.f;
|
||||
//std::cout << "Current animation frame: " << anim.currentFrame << " / " << anim.totalFrames << " -- " << anim.lastFrame << std::endl;
|
||||
if (static_cast<int>(anim.currentFrame) >= anim.totalFrames-1) {
|
||||
anim.currentFrame = anim.model.startingFrame;
|
||||
}
|
||||
@@ -82,6 +85,7 @@ void Character::update(int64_t deltaMs) {
|
||||
}
|
||||
|
||||
void Character::draw(Renderer& renderer) {
|
||||
//std::cout << "draw called for Character at position: " << position.transpose() << std::endl;
|
||||
AnimationState drawState = resolveActiveState();
|
||||
auto it = animations.find(drawState);
|
||||
if (it == animations.end() || !texture) return;
|
||||
|
||||
Reference in new issue
Block a user