Fusion-C - Multicolour 16x16 sprites screen 5

Door Wolverine_nl

Paragon (1097)

afbeelding van Wolverine_nl

24-11-2019, 14:28

Hi all,
I am trying to get multicoloured 16x16 sprite to display on screen 5 using Fusion-C 1.2.
It is not working out, I am using Tinysprite editor to give me data for the patterns and colours, but that doesn't really seem to work as easy as in ASCII MSX-C.
Here it looks like it needs to be stitched together somehow. Patternnumber seems to have effect on position, which seems odd.

#include "fusion-c/header/msx_fusion.h"
#include "fusion-c/header/vdp_sprites.h"
#include "spritedatafromTinySprite.spr" // which is in static const unsigned char arrays like in Breaker

 void Put_PL_Sprite(int px, int py)
 {
   PutSprite(1,10,px,py,0);
   PutSprite(2,20,px,py,0);
  }
 
 void PL_Sprite_Set(void)
{
  SetSpritePattern(10,player_pattern1,32);
  SetSpritePattern(20,player_pattern2,32);

  SC5SpriteColors(1,player_colors1);
  SC5SpriteColors(2,player_colors2); 
}

void main(void) 
{
  Screen(5);
  SetColors(15,1,1);
  Cls();
  SpriteReset();
  PL_Sprite_Set();
  SpriteOn();
  Sprite16();
  SpriteSmall();

  Put_PL_Sprite(119,145);
  
    // End

  WaitForKey();
  Screen(0);
  Exit(0);
  Print("Thank you for testing...");
}
Aangemeld of registreer om reacties te plaatsen

Van Wolverine_nl

Paragon (1097)

afbeelding van Wolverine_nl

24-11-2019, 14:43

or is it because the patterns need to be chopped up in blocks of 8?

Van akumajo

Resident (43)

afbeelding van akumajo

24-11-2019, 21:14

Hi Wolverine !
I suggest you to modify your sprite patterns id as follows, as you use 16x16 pixels sprites it's necessary that ids of sprite patterns are multiple of 4.

#include "fusion-c/header/msx_fusion.h"
#include "fusion-c/header/vdp_sprites.h"
#include "spritedatafromTinySprite.spr" // which is in static const unsigned char arrays like in Breaker

 void Put_PL_Sprite(int px, int py)
 {
   PutSprite(0,0,px,py,0); /* <= here */
   PutSprite(1,4,px,py,0); /* <= here */
  }

 void PL_Sprite_Set(void)
{
  SetSpritePattern(0,player_pattern1,32); /* <= here */
  SetSpritePattern(4,player_pattern2,32); /* <= here */

  SC5SpriteColors(0,player_colors1); /* !!! but here, */
  SC5SpriteColors(1,player_colors2); /* IDs are not x 4 !!! */
}

void main(void)
{
  Screen(5);
  SetColors(15,4,4);
  Cls();
  SpriteReset();
  PL_Sprite_Set();
  SpriteOn();
  Sprite16();
  SpriteSmall();

  Put_PL_Sprite(119,145);

    // End

  WaitForKey();
  Screen(0);
  Exit(0);
  Print("Thank you for testing...");
}

Van Wolverine_nl

Paragon (1097)

afbeelding van Wolverine_nl

24-11-2019, 23:35

Thanks for your answer Akumajo! Smile

Van ericb59

Paladin (939)

afbeelding van ericb59

25-11-2019, 15:41

Hi

Did it solve the problem ?

Van Wolverine_nl

Paragon (1097)

afbeelding van Wolverine_nl

26-11-2019, 12:48

Hi Eric,
I will check it later tonight and let it know in this thread. Smile

Van Wolverine_nl

Paragon (1097)

afbeelding van Wolverine_nl

28-11-2019, 11:49

Hi Eric,
It works perfectly now, sorry for the late answer, got ill and today I am fit enough to look at a monitor Wink

Van ericb59

Paladin (939)

afbeelding van ericb59

29-11-2019, 10:22

I hope you well get well soon.
Keep the faith... in Fusion-c LOL! Wink

Van Wolverine_nl

Paragon (1097)

afbeelding van Wolverine_nl

29-11-2019, 12:57

I will, got the sprite correct now, also added controls, it is starting to get shape Wink
Keep on the good work Eric! Smile