Jump to content

Photo

Trouble with 2x2 enemies


  • Please log in to reply
34 replies to this topic

#1 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 25 June 2012 - 01:44 PM

I added this code to my copy of ghost.zh:
CODE
//Extend-only mod: negative script number sets extend
        if(enemy->Attributes[11] < 0 ){
            enemy->Extend = enemy->Attributes[11]*-1;
            enemy->Misc[__GHI_IN_USE] = 1;
            continue;
        }


I made a new enemy with the appropriate attribute set to -2 (extend=2). However, its animation is messed up. The first sprite looks perfectly fine, but the second sprite shifts only one tile over so it includes part of the first as well.

The tiles are set up like this (and I selected the highlighted tile): IPB Image
But while the first frame looks right, the second frame looks like this:IPB Image

The animation is set to 2-frame (walking enemy). What is going wrong?

#2 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 25 June 2012 - 05:13 PM

I would also like to make 2x2 enemies.
But there'd have to be a way to set their hitbox in case their sprite is less than 32x32 pixels.

#3 tox_von

tox_von

    Zelda Addict

  • Members
  • Real Name:Redgor
  • Location:Toxicville , Simcity

Posted 26 June 2012 - 07:59 AM

i couldnt get extend to work either thats why i use ffcs for my enemies you can do it that way if you need to.

#4 Orithan

Orithan

    Studying Scientist - Commission from Silvixen

  • Members
  • Location:Australia

Posted 26 June 2012 - 08:18 AM

From what I've read in the documentation, Extend needs to be set to at least 3 in order for it to work properly.

#5 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 26 June 2012 - 09:28 AM

Then I have to set the height and width manually?

#6 Mero

Mero

    Touch Fluffy Tail

  • Banned
  • Real Name:Tamamo No Mae
  • Location:Rainbow Factory

Posted 26 June 2012 - 10:35 AM

Unfortunately, your best bet is to extend it to 3 with a ffc script, and then set the tileblock size and position as well as the hitbox size and position. icon_frown.gif

#7 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 26 June 2012 - 10:51 AM

Well, that's fine. I can just edit my ghost.zh addon. Thanks for letting me know!

CODE
// Already in use?
        if(enemy->Misc[__GHI_IN_USE]!=0)
            continue;
//PLACE BELOW THIS SECTION OF THE AUTOGHOST() FUNCTION

//Extend-only mod: negative script number sets extend
        if(enemy->Attributes[11] < 0 ){
            enemy->Extend = 3;
            enemy->TileWidth = enemy->Attributes[10]*-1; //Attribute 11 = -width
            enemy->TileHeight = enemy->Attributes[11]*-1; //Attribute 12 = -height
            enemy->HitWidth = enemy->Attributes[10]*-16;
            enemy->HitHeight = enemy->Attributes[11]*-16;
            enemy->Misc[__GHI_IN_USE] = 1;
            continue;
        }

Edited by MoscowModder, 26 June 2012 - 10:58 AM.


#8 Saffith

Saffith

    IPv7 user

  • Members

Posted 26 June 2012 - 02:44 PM

Pretty sure it ought to work. What enemy type is that?

#9 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 26 June 2012 - 03:17 PM

It's a walking enemy and I can confirm that it works.

#10 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 26 June 2012 - 04:29 PM

Can you please teach me to use that? I already have the ghost.zh file, but I haven't done anything with it.

#11 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 26 June 2012 - 06:48 PM

Teach you to do what exactly?

#12 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 26 June 2012 - 08:28 PM

to be able to make 2x2 enemies and set their hitbox

#13 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 26 June 2012 - 08:37 PM

If you want to use my ghost.zh mod, just put the new section under the section copy/pasted above, then set its width in negative tiles in Misc. Attrib. 11 and its height, also in negative tiles, in Attrib 12. Unlike big Link tiles, you choose the top-left of a block of tiles for the sprite.

#14 Cukeman

Cukeman

    "Tra la la, look for Sahasrahla. ... ... ..."

  • Banned
  • Location:Hyrule/USA

Posted 26 June 2012 - 09:15 PM

What if I have a second enemy with a different sized hitbox?

Also, is this script loaded into a slot in the enemy editor, or...?

Edited by Cukeman, 26 June 2012 - 09:16 PM.


#15 MoscowModder

MoscowModder

    Sometimes lurking. Rarely posting.

  • Members
  • Location:Wisconsin

Posted 26 June 2012 - 09:23 PM

This script is global. You can have different sizes for each enemy

QUOTE
set its (the enemy's) width in negative tiles in Misc. Attrib. 11 and its height, also in negative tiles, in Attrib 12. Unlike big Link tiles, you choose the top-left of a block of tiles for the sprite.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users