Symetrical image transformation

Codnpix

il y a 5 mois

Hi, 

I wonder if there is something in the Gamebuino_META library that allow us to make a symetrical transformation on an image. For example if a sprite goes left or right, to be able to use the same image or animation in one direction or another.

I am nearly sure I saw something about that on the forum but I can't find it back ...

Thank you !

Steph

NEW il y a 5 mois

I have already explained this case here for JFT (and I think you were part of that discussion, right?).

void drawMario() {
    mario.sheet.setFrame(mario.frame);
    gb.display.drawImage(
        mario.x,
        mario.y,
        mario.sheet,
        mario.w * (mario.orientation == MARIO_ORIENTATION_LEFT ? 1 : -1), // here is the trick!
        mario.h
    ); 
}

Codnpix

il y a 5 mois

YES that was it ! And indeed I was a part of it ! I couldn't remember what discussion it was... thanks !

Codnpix

NEW il y a 5 mois

Steph Steph

YES that was it ! And indeed I was a part of it ! I couldn't remember what discussion it was... thanks !

Codnpix

NEW il y a 5 mois

In the drawImage reference the w2 and h2 optional parameters are presented with the basic functionnality to scale the image to the new specified size, but I think it would be a great idea to add this tip directly in the reference ! 

I don't think I could think myself that simply invert the value could reverse the image orientation. It sounds obvious when it's told but... Anyway, it would be great to talk about that example in the reference.

Steph

il y a 5 mois

You're absolutely right!

That's good... I think it's moving at the Academy level and the reference documentation is part of the changes ;-)

Steph

NEW il y a 5 mois

Codnpix Codnpix

You're absolutely right!

That's good... I think it's moving at the Academy level and the reference documentation is part of the changes ;-)