premier jeu, Last Defenders (nom provisoire) : aides en tout genre

General

Steph

NEW 5 years ago

JFT JFT

Sorry... the online editor is buggy!
I couldn't update my message with the spritesheet image....
So here it is:

EDIT: Well, that's it!..... I did it! I had to do it all over again, 10 times!.....

JFT

NEW 5 years ago

Thank you a lot for the help you gave me.

The code I already did for my game, before questionning you a lot (sorry), is a frame by frame animation (separated images) and it saves the coordinates and other parameters in a table. It is working well but it's long, so that's why I wanted to simplify it :)
Below is the animation of a monster (4 steps, 4 frames per step but it will be perhaps different frame numbers for each step) :

case 1: // Ground Monster

if (tab_en[3][i] == 5) { tab_en[1][i] -= 1; }
if (tab_en[3][i] == 9) { tab_en[1][i] -= 1; tab_en[2][i] -= 1; }
if (tab_en[3][i] == 13) { tab_en[1][i] -= 1; }
if (tab_en[3][i] == 17) { tab_en[1][i] -= 1; tab_en[2][i] += 1; tab_en[3][i] = 1;}

en_hit = {tab_en[1][i], tab_en[2][i]+1, 5, 3};

  if (tab_en[3][i] < 5) { // 4 frames
  gb.display.drawImage(tab_en[1][i],tab_en[2][i], gen1);
  en_collision();
  tab_en[3][i] ++; break;}
 
    else {
    if (tab_en[3][i] >= 5 and tab_en[3][i] < 9) { // 4 frames
    gb.display.drawImage(tab_en[1][i],tab_en[2][i], gen2); // je souhaite avoir une variable IMAGE pour afficher dans enemy_output ge+IMAGE exemple ge1 avec IMAGE=1
    en_collision();
    tab_en[3][i] ++; break;}
   
    else {
    if (tab_en[3][i] >= 9 and tab_en[3][i] < 13) { // 4 frames
    gb.display.drawImage(tab_en[1][i],tab_en[2][i], gen3);
    en_collision();
    tab_en[3][i] ++; break;}
     
    else {
    if (tab_en[3][i] >= 13 and tab_en[3][i] < 17) { // 4 frames
    gb.display.drawImage(tab_en[1][i],tab_en[2][i], gen4);
    en_collision();
    tab_en[3][i] ++; break; }
       
    }}}

Steph

5 years ago

That's what I told you a few days ago in this same discussion... don't worry about re-inventing the wheel... clumsily. The Image class is made for that! So use it and you'll save time ;-)

Steph

NEW 5 years ago

JFT JFT

That's what I told you a few days ago in this same discussion... don't worry about re-inventing the wheel... clumsily. The Image class is made for that! So use it and you'll save time ;-)

JFT

NEW 5 years ago

Thank you for you patience :) and have a nice week-end