Character Animation and Movement controller
CaMove.cpp
- Committer:
- rottenegg
- Date:
- 2019-04-17
- Revision:
- 0:8fa72895d335
File content as of revision 0:8fa72895d335:
#include "CaMove.h" AnalogIn ver(PTB10); AnalogIn hoz(PTB11); void CaMove::CMinit() { _h = 40; _v = 20; _itr = 0; mvp =0; }; int CaMove::get_x() { return _h; }; int CaMove::get_y() { return _v; }; short int CaMove::get_itr() { return _itr; }; short int CaMove::get_mvp() { return mvp; }; void CaMove::CMmove(N5110 &lcd) { if (hoz > 0.6f && lcd.getPixel((_h-1),(_v+7)) == 0) { _h = _h - 2; mvp = 0;//L } if (hoz < 0.4f && lcd.getPixel((_h+10),(_v+7)) == 0) { _h = _h + 2; mvp = 1;//R } if (ver > 0.6f && lcd.getPixel((_h+5),(_v-1)) == 0) { _v = _v - 2; mvp = 2;//F } if (ver < 0.4f && lcd.getPixel((_h+5),(_v+14)) == 0) { _v = _v + 2; mvp = 3;//B } if (_itr == 3) { _itr = -1; } _itr++; };