[RESOLVIDO]como se usa a função sprite_collision_mask()?
Enviado: Dom Nov 26, 2017 12:22 pm
a gente pode alterar a mascara de colisão usando a função sprite_collision_mask().
mas eu não entendo como se usa.
"Description
With this function you can set the type of collision mask that a sprite should have. If you select either automatic, or precise, then the bounding box values can be set to 0, however for a user defined mask you will have to set these values.
The bounding box is always a relative value, based on the (0,0) position being the top left corner of the sprite (irrespective of the x and y origin).
The kind of mask sets the general shape for the mask itself, although if you have a user defined bounding box, you may end up with a "cut off" mask that is not complete.
Finally, tolerance is used to define how precise the precise mask is, with a tolerance of 0 meaning that the mask will follow every single pixel that has a transparency over 0, while other values will shift the collision mask perimeter depending on the transparency of the pixels.
NOTE: This function is only useful for bitmap sprites and will not work with SWF or JSON (Spine) sprites.
NOTE: This function will only work on duplicated sprites and not directly on pre-made resources. you can duplicate sprites using the function sprite_duplicate."
mas não entendo como usar esta função. os argumentos bbleft e bbtop(por esta ordem), podem ser obtidos pelas variavéis da instancia: bbox_left e bbox_top.
como calcular o bbox_right e bbox_bottom?
posso meter bbox_left - distance? preciso converter distance antes de usar?
- "distance" é 1 variavel que uso para distancia entre jogador e 1 parede(por exemplo).
alguem me pode explicar, o Manual é confuso.
mas eu não entendo como se usa.
"Description
With this function you can set the type of collision mask that a sprite should have. If you select either automatic, or precise, then the bounding box values can be set to 0, however for a user defined mask you will have to set these values.
The bounding box is always a relative value, based on the (0,0) position being the top left corner of the sprite (irrespective of the x and y origin).
The kind of mask sets the general shape for the mask itself, although if you have a user defined bounding box, you may end up with a "cut off" mask that is not complete.
Finally, tolerance is used to define how precise the precise mask is, with a tolerance of 0 meaning that the mask will follow every single pixel that has a transparency over 0, while other values will shift the collision mask perimeter depending on the transparency of the pixels.
NOTE: This function is only useful for bitmap sprites and will not work with SWF or JSON (Spine) sprites.
NOTE: This function will only work on duplicated sprites and not directly on pre-made resources. you can duplicate sprites using the function sprite_duplicate."
mas não entendo como usar esta função. os argumentos bbleft e bbtop(por esta ordem), podem ser obtidos pelas variavéis da instancia: bbox_left e bbox_top.
como calcular o bbox_right e bbox_bottom?
posso meter bbox_left - distance? preciso converter distance antes de usar?
- "distance" é 1 variavel que uso para distancia entre jogador e 1 parede(por exemplo).
alguem me pode explicar, o Manual é confuso.