Author Topic: hard to activate a walkable switch  (Read 451 times)

Realguigui

  • Newbie
  • *
  • Posts: 17
  • Eastmost penninsula is the secret
    • View Profile
hard to activate a walkable switch
« on: January 28, 2017, 06:34:05 pm »
Hello.

I think the activation of walkable switch needs too much accurency. Also, the activation zone seems to be offset toward down.
Is there a simple solution to resolve this ?

Switch NOT ACTIVATED


Switch ACTIVATED

Diarandor

  • Hero Member
  • *****
  • Posts: 719
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: hard to activate a walkable switch
« Reply #1 on: January 28, 2017, 07:35:11 pm »
I think some of your sprites, probably the switch (or the hero otherwise) may have the wrong origin coordinates.

Realguigui

  • Newbie
  • *
  • Posts: 17
  • Eastmost penninsula is the secret
    • View Profile
Re: hard to activate a walkable switch
« Reply #2 on: January 28, 2017, 09:25:08 pm »
I use the two sprites of Solarus DX.
The switch sprite origin point : 0,0.
the hero (tunic2) origin point : 12,21.

Christopho

  • Administrator
  • Hero Member
  • *****
  • Posts: 1014
    • View Profile
Re: hard to activate a walkable switch
« Reply #3 on: January 28, 2017, 09:28:01 pm »
Try to set the origin point of the switch sprite to 8,13.

Realguigui

  • Newbie
  • *
  • Posts: 17
  • Eastmost penninsula is the secret
    • View Profile
Re: hard to activate a walkable switch
« Reply #4 on: January 28, 2017, 10:06:43 pm »
I 'm adding a switch on a map of solarus dx and the result is the same.


Try to set the origin point of the switch sprite to 8,13.
it's worst, the bounding box is completly offset:

Diarandor

  • Hero Member
  • *****
  • Posts: 719
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: hard to activate a walkable switch
« Reply #5 on: January 28, 2017, 11:33:06 pm »
It seems that the correct origin for zsdx is (0, 0), so that was not the problem, I think. I don't know yet what the problem is. Are you using both the last version of the game zsdx and the last version of the engine?

Another remark: after you modify the origin of the sprite, the refreshing button of the open map will not show the changes; you can either close/reopen the map, or double click in the switch entity and click "ok", that will show the updated origin for the switch sprite. Make sure you refresh the map to see how the changes are for that origin point.

Another question: is the size of your switch sprite 16x16?
« Last Edit: January 28, 2017, 11:35:40 pm by Diarandor »

MetalZelda

  • Sr. Member
  • ****
  • Posts: 489
    • View Profile
Re: hard to activate a walkable switch
« Reply #6 on: January 28, 2017, 11:52:15 pm »
Wait wait wait, 12, 21 as origin point for the hero ?

Realguigui

  • Newbie
  • *
  • Posts: 17
  • Eastmost penninsula is the secret
    • View Profile
Re: hard to activate a walkable switch
« Reply #7 on: January 29, 2017, 12:15:04 am »
It seems that the correct origin for zsdx is (0, 0), so that was not the problem, I think. I don't know yet what the problem is. Are you using both the last version of the game zsdx and the last version of the engine?

Another remark: after you modify the origin of the sprite, the refreshing button of the open map will not show the changes; you can either close/reopen the map, or double click in the switch entity and click "ok", that will show the updated origin for the switch sprite. Make sure you refresh the map to see how the changes are for that origin point.

Another question: is the size of your switch sprite 16x16?

I answer yes to all your questions.

I think there is no bug, but I realized that there was a "problem" when I made a room with a switch that launches a moving platform and the hero has to hurry To join it. To succeed, it is best to activate the switch from the side and this is difficult, much more than from the top.
I really invite you to test by yourself.

Diarandor

  • Hero Member
  • *****
  • Posts: 719
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: hard to activate a walkable switch
« Reply #8 on: January 29, 2017, 12:36:39 am »
I answer yes to all your questions.

I think there is no bug, but I realized that there was a "problem" when I made a room with a switch that launches a moving platform and the hero has to hurry To join it. To succeed, it is best to activate the switch from the side and this is difficult, much more than from the top.
I really invite you to test by yourself.

Yes, I believe you are completely right. I had a similar problem (or even worse) because with the sprite I made for Eldran (a custom hero), the pixels of the feet are in a lower position than for Link's sprite, which makes this much more noticeable. Actually I modified his origin to (12, 23) to decrease this effect. With my custom switches (custom entities) I decreased this effect even more, maybe because I use a different sprite.

I could be wrong but, in my opinion, the problem is not with the engine, since it checks the distances between the center of both bounding boxes, and that is done correctly. The problem is actually the switch image, which is drawn with a bad "angle of perspective" (at least, for the way the engine handles the bounding boxes); when the hero and the switch bounding boxes are centered/aligned one above the other the hero "does not seem" to the player to be centered over it. An "easy" solution would be to redraw the switch sprite, to make its angle perspective better when both bounding boxes are aligned, i.e., draw the small circular part of the switch lower (and smaller if necessary).

Diarandor

  • Hero Member
  • *****
  • Posts: 719
  • Cats are cool! (ΦωΦ)
    • View Profile
Re: hard to activate a walkable switch
« Reply #9 on: March 14, 2017, 11:15:26 pm »
I drew some switches which are a bit different to the one in ALTTP, and these look nice when the hero activates them (the hero does not seem "shifted" when he activates them). I will share them in some time, but not yet since I am still testing and making changes.