- [x] Optimisation/Correction des collisions (hit + move)

- [x] Erreur de hit() (gravity)
- [x] Optimisation de la correction apres saut
- [x] Correction du move qui fait friser parfois
This commit is contained in:
xdrm-brackets 2016-03-16 11:49:11 +01:00
parent e23608b1a7
commit 6f9d7dc40f
4 changed files with 10 additions and 10 deletions

BIN
SDL#4/exe

Binary file not shown.

View File

@ -126,17 +126,17 @@ int main(int argc, char* argv[]) {
mario->moveFromVelocity();
// if( mgr->hit("mystery-bloc", 0, 1) ) mb.jump();
// else mb.unjump();
if( mgr->hit("mystery-bloc", 0, 1) ) mb.jump();
else mb.unjump();
// if( mgr->hit("mystery-bloc2", 0, 1) ) mb1.jump();
// else mb1.unjump();
if( mgr->hit("mystery-bloc2", 0, 1) ) mb1.jump();
else mb1.unjump();
// if( mgr->hit("mystery-bloc3", 0, 1) ) mb2.jump();
// else mb2.unjump();
if( mgr->hit("mystery-bloc3", 0, 1) ) mb2.jump();
else mb2.unjump();
// if( mgr->hit("mystery-bloc4", 0, 1) ) mb3.jump();
// else mb3.unjump();
if( mgr->hit("mystery-bloc4", 0, 1) ) mb3.jump();
else mb3.unjump();
mgr->manageFps(); // Gestion des FPS (speed)
mgr->update(); // Mise a jour du rendu

Binary file not shown.

View File

@ -22,7 +22,7 @@ xMarioMario::xMarioMario(xManager *m, int x, int y)
// Position frame par defaut
_pos = "NR"; // bottom-center
_gravity = 19;
_gravity = 8;
// Constantes de mouvement sur X
_velocity[0] = 0.0;
@ -92,7 +92,7 @@ void xMarioMario::moveFromVelocity(){
// TROUBLE
// TROUBLE
if( !this->onFloor() )
this->move(0, _gravity);
_velocity[1] += _gravity;
// TROUBLE
// TROUBLE
// TROUBLE