Grid Offset in npc config isn't working

Description: It's archive, posting new is here http://wohlsoft.ru/forum/viewforum.php?f=11

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #1by Sambo » 2 Sep 2014, 0:17

I tried to change the grid offset of an NPC, but it doesn't do anything. And I made sure to save the config file, reload configurations, and reload the level. Still nothing.
Image
Current Project:
Image

Wohlstand M
Lead Developer
Lead Developer
Avatar
Wohlstand M
Lead Developer
Lead Developer
Age: 30
Reputation: 493
Posts: 1747
Joined: 15 Feb 2014
English Pronouns: he/him
Location: Moscow, Russia
Website Youtube channel URL Skype Tencent QQ

Post #2by Wohlstand » 2 Sep 2014, 0:33

Sambo wrote:I tried to change the grid offset of an NPC, but it doesn't do anything. And I made sure to save the config file, reload configurations, and reload the level. Still nothing.
Grid offset - is an offset of position snapping while you move or place item. It is NOT offset of position X/Y, it is only helps to correctly snap your NPC by "snap to grid" feature.
Global grid offset is not working on the custom NPC's. I.e. grid offset will be overwritten by recalculation of customized NPC. If you wanna change the NPC's real position relative to GFX, use the GFX-Offset and NPC's fixture width/height. Grid offset need only for correctly snap item into grid.

For example, items which have height 24px need for grid offset-y with value "8" while grid size of this item is 32px.

Sambo M
Topic author, Count
Count
Avatar
Sambo M
Topic author, Count
Count
Age: 25
Reputation: 15
Posts: 264
Joined: 27 Jun 2014

Post #3by Sambo » 2 Sep 2014, 2:58

OK. I tried all that you said. I used a SMB3 styled blue coin replacing the SMW blue coin (npc-258). I changed all the properties of the coin to match the regular SMB3 yellow coin (npc-10), and they are still not lined up when placed:
Image
Here are the codes in the config file:
Spoiler

Code: Select all

[npc-10]
name="Coin (Gold)"
group="Super Mario Bros. 3"
category="Bonus"
image="npc-10.gif"
algorithm="0"
default-effect=10
shell-effect=10
gfx-offset-x=0
gfx-offset-y=0
gfx-height=32
gfx-width=28
grid=16
grid-offset-x=2
grid-offset-y=0
fixture-height=32
fixture-width=28
frame-style=0
frames=4
frame-speed=128
foreground=1
custom-animation=0
speed=0
container=0
have-special=0
score=1
moving=0
scenery=0
immortal=0
yoshicaneat=0
allow-bubble=1
allow-egg=1
allow-lakitu=1
allow-buried=1
takable=1
grab-side=0
grab-top=0
grab-any=0
default-health=1
hurtplayer=0
hurtnpc=0
block-npc=0
block-npc-top=0
block-player=0
block-player-top=0
collision-blocks=1
gravity=0
adhesion=0
deactivate=1
kill-slside=0
kill-onjump=0
kill-bynpc=0
kill-fireball=0
kill-iceball=0
kill-hammer=0
kill-tail=0
kill-spin=0
kill-statue=0
kill-with-mounted=0
kill-on-eat=0
cliffturn=0
lava-protection=0

[npc-258]
name="Coin (Blue)"
group="Super Mario World"
category="Bonus"
image="npc-258.gif"
algorithm="0"
default-effect=10
shell-effect=10
gfx-offset-x=0
gfx-offset-y=0
gfx-height=32
gfx-width=28
grid=16
grid-offset-x=2
grid-offset-y=0
fixture-height=32
fixture-width=28
frame-style=0
frames=4
frame-speed=128
foreground=1
custom-animation=0
speed=0
container=0
have-special=0
score=1
moving=0
scenery=0
immortal=0
yoshicaneat=0
allow-bubble=1
allow-egg=1
allow-lakitu=1
allow-buried=1
takable=1
grab-side=0
grab-top=0
grab-any=0
default-health=1
hurtplayer=0
hurtnpc=0
block-npc=0
block-npc-top=0
block-player=0
block-player-top=0
collision-blocks=1
gravity=0
adhesion=0
deactivate=1
kill-slside=0
kill-onjump=0
kill-bynpc=0
kill-fireball=0
kill-iceball=0
kill-hammer=0
kill-tail=0
kill-spin=0
kill-statue=0
kill-with-mounted=0
kill-on-eat=0
cliffturn=0
lava-protection=0

Edit: I changed the config codes back to normal, and it works like it should, but if I change "grid" from 32 to 16, it gets a weird offset so it's not lined up right.
Image
Current Project:
Image


Return to “Troubleshooting”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest