Author Topic: Changing the entities' sprites make them acting differently  (Read 3285 times)

garsim

  • Newbie
  • *
  • Posts: 12
    • View Profile
Changing the entities' sprites make them acting differently
« on: September 11, 2013, 10:47:57 pm »
Hello, it's me again for another problem.  :-[

I wanted to change some sprites in the game, like the crystal switches and the solid ones.
So I modified the "miscellaneous.png" file like this (don't pay attention to the light blue switch I added, it will be used for a special purpose but I'm not using it yet) :




I didn't modify the .dat files related to this sheet.
And I put them on a test map (don't pay attention to the mess, it's just a test map  ;) ) :




But when I play and I use the sword on them, it's acting like I was using my sword on a wall (there is the sound "tick-tick") and do not activate them.


I had another problem of the same kind several days ago.
Like what I did with the switches, I recolored the example tileset from the tutorial videos, and I modified the entities, replacing bushes by flowers :




And when I play, bushes/flowers don't act as they should do, such as switches. When I use the sword, I'm just hurting a wall :





To put it in a nutshell, I just modified the .png files. And I can't see how that could modify tile properties like this...
I put this issue in the bugs section because it doesn't seem normal for me, but maybe I'm just using the sprites/tilesets not as I should do (we never know), and in that case this topic may go to the development section ?
« Last Edit: September 21, 2013, 11:40:47 am by garsim »

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1172
    • View Profile
Re: Changing the entities' sprites make them acting differently
« Reply #1 on: September 12, 2013, 11:13:35 am »
I can't see your images here at work because xooimage seems to be blocked.
Anyway, if you only modify PNG files, keeping the same dimensions of your sprites, this cannot affect the collisions.

Unless… the following three conditions are all met:
- You converted the image from 256 colors to RGB.
- The sprite uses pixel-precise collisions (yes, this is the case of crystals and bushes).
- You are using Solarus < 1.0.1. Before Solarus 1.0.1, pixel-precise collisions were only supported with images in 256 colors. This limitation no longer exists.

So make sure you have the latest release (1.0.4). If this is the case, try to convert the PNG image to 256 colors. If it fixes your problem, then there is a bug with pixel-precise collisions in RGB images.

garsim

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Changing the entities' sprites make them acting differently
« Reply #2 on: September 21, 2013, 11:25:13 am »
(sorry for that late answer, I couldn't connect to Internet since last thursday... and I probably won't able to connect again before some days :-[ )

I put the images on ImageBam, if you can't see Xooimage ones.

About what you said, I'd finally say that the matter comes from the pixel perfect collisions, at least for the crystal switches whose shape is different than the original ones ; for the bushes, it's just the "dark world flower from Alttp" version instead of the "light world bushes from Alttp".
Concerning the images, I use PhotoFiltre to make the background color transparent (so it implies a 256 colors conversion before making the background trasparent). Maybe the background must not be transparent ?
I'm pretty sure that I have the latest version of Solarus (plus, I think I'll change it to the 1.1 in the future, since some features are really interesting).

Anyway, I'll check these options and come back with my replies in a few days.
« Last Edit: September 21, 2013, 11:42:03 am by garsim »

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1172
    • View Profile
Re: Changing the entities' sprites make them acting differently
« Reply #3 on: September 21, 2013, 05:26:58 pm »
Your problem might be fixed by https://github.com/christopho/solarus/commit/add115937e122624be97e8df872b23ae02f5a992.
Pixel-precise collisions are supposed to work for any image, 256 colors or RGB, with or without transparent pixels. But I did not test the RGB case myself yet (I'm not the one who implemented the feature).

Note that transparency exists in RGB PNG images, so maybe you are not in 256 color mode.

garsim

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Changing the entities' sprites make them acting differently
« Reply #4 on: September 28, 2013, 10:02:30 pm »
Finally, it's the color mode. I put off the transparency and the switches worked well.

But as a result, I have another problem (independent of Solarus)  :-[ :



Is there a way to make the image transparent without using PhotoFiltre ? I'm afraid this software is doing something I don't want before making the image transparent. For example, I noticed that the sprites included in Mystery of Solarus don't have a transparent background when I open them on PhotoFiltre. I suppose there is another way to make them transparent ?

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1172
    • View Profile
Re: Changing the entities' sprites make them acting differently
« Reply #5 on: September 29, 2013, 09:31:28 am »
I don't know PhotoFiltre, but with GIMP I can explain.
Click the Layer menu > Transparency > Add an alpha channel. Select the pixels to make transparent and delete them.
Then, if you still have problems, try to convert your image to a 256 color palette (Image menu > Mode > RGB) because Solarus might have bugs with transparent pixels in RGB images.

garsim

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Changing the entities' sprites make them acting differently
« Reply #6 on: September 29, 2013, 01:14:02 pm »
Argh, I was hoping you wouldn't say "Gimp" since this software is really complicated.  :P
But it worked. In fact, when I opened the picutre on Gimp, the alpha channel was already set ! I saved the picture again, tried to lanch the game, and the switches worked well and had a transparent background. I suppose I can do the same operation with bushes.
Thanks for your explanations and your patience with my little problems.  ;)