Jump to content

Photo

Ghost Script Scrunching Sprites???

ghost autoghost enemy sprite

  • Please log in to reply
2 replies to this topic

#1 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 01 August 2013 - 04:50 AM

I've run into a problem, where a the sprite for a ghosted enemy is somewhat mangled,and that what should be a transparent BG is displayed as another colour.
 
Here is a screenshot of the action, note the upper-right corner of the head with a white patch.:
 
zelda223.png
 
Here is a tile sheet for the sprite:
 
medusahead.png
 
Here is the script:
 

ffc script Ra
{
   void run(int enemyID)
   {
      npc ghost = Ghost_InitAutoGhost(this, enemyID, GHF_IGNORE_ALL_TERRAIN);
      Ghost_MarkAsInUse(ghost);
      int amplitude = ghost->Attributes[0]; // 16 is a good number to use
      float period = ghost->Attributes[1]; // 64 is a good number to use
      int delay = ghost->Attributes[2];    // 1 is a good number to use. Higher = more jerky motion
      int direction = ghost->Attributes[3]; // 1 is left to right, 2 is right to left, 0 randomizes between them. I use 0.
      int min_restart = ghost->Attributes[4]; // minimum frames before respawning on the other side. I use 45.
      int max_restart = ghost->Attributes[5]; // maximum frames before respawning on the other side. I use 310.
      int y1;
      int step = ghost->Step/100;
      int hf = ghost->Homing;

      if (direction == 0) direction = Rand(1,2);

      while(true)
      {
        
         if (direction == 1) Ghost_X = -17;
         else if (direction == 2) Ghost_X = 256;
        

         y1 = Rand(Link->Y-(255-hf)/2, Link->Y+(255-hf)/2); // lower homing factor = less likely to spawn near Link

         Ghost_Y = y1;
         y1 = Max(48, Min(128, y1));

         if(direction == 1)
         {
            
            while(Ghost_X <= 256 && ghost->HP > 0)
            {
               Ghost_X += step;
               Ghost_Y = amplitude * Sin(360*Ghost_X/period) + y1;
               Ghost_ForceDir(DIR_RIGHT);
               Ghost_Waitframes(this, ghost, true, true, delay);
               if (Ghost_X >= 256)
               {
                  Ghost_X = -16;              
                  y1 = Rand(Link->Y-(255-hf)/2, Link->Y+(255-hf)/2);
                  y1 = Max(0, Min(128, y1));
                  Ghost_Waitframes(this, ghost, true, true, Rand(min_restart,max_restart));
               }
            }
         }
         else
         {
            
            while(Ghost_X >= -17 && ghost->HP > 0)
            {
               Ghost_X -= step;
               Ghost_Y = amplitude * Sin(360*Ghost_X/period) + y1;
               Ghost_ForceDir(DIR_LEFT);
               Ghost_Waitframes(this, ghost, true, true, delay);
               if (Ghost_X <= -17)
               {
                  Ghost_X = 256;
                  y1 = Rand(Link->Y-(255-hf)/2, Link->Y+(255-hf)/2);
                  y1 = Max(0, Min(128, y1));
                  Ghost_Waitframes(this, ghost, true, true, Rand(min_restart,max_restart));
               }
            }
         }
        
      }
   }
}

Could anyone explain this behaviour, or a way to fix it?

 

The enemy otherwise works perfectly.



#2 Jamian

Jamian

    ZC enthusiast

  • Members

Posted 01 August 2013 - 06:32 AM

Nice screenshot!

 

Did you make sure:
// Invisible combo with no properties set
const int GH_INVISIBLE_COMBO = (...)

 

is correctly set up in ghost.zh?

 



#3 Timelord

Timelord

    The Timelord

  • Banned
  • Location:Prydon Academy

Posted 01 August 2013 - 07:28 AM

Urk. That was it. It was back to the default, instead of combo 1. Thanks!

 

zelda225.png

 

This is Alucard's game (and level design). My part is in getting some scripts working and general playtesting & feedback, so the credit goes to him for the overall aesthetics.





Also tagged with one or more of these keywords: ghost, autoghost, enemy, sprite

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users