Weastøne Entertainment
Member
Hello there!,
Let me introduce this; the game has weapons such as bows, staffs... which can create projectiles.
I wanted walls, signs, furniture... to break those projectiles, as it wouldn't make sense that arrows went through walls.
All the objects able to destroy the projectiles are my "destroyer objects", that execute the same script;
It was meant to detect the corners of the sprites and then check whether any projectile was there (and destroy him).
For debugging reasons, I decided to draw the collision borders and this is what I found:
The collision boxes seem to have moved, and I don't know why... As well there are some little spaces where the collision system is not working. What's wrong?
Before detecting this BIG error, the collision was defined the same, but the "final y" of the rectangle was the same minus 5, so it made some space for if the player was touching the wall to fire the arrow, but it made this other screen:
So it seems I have 2 big problems here, that I didn't expect at all; one of them (the last one) I thought I solved it (https://forum.yoyogames.com/index.php?threads/setting-up-a-projectile-solution-found.12150) <-- Take a look at the images there, I think you will understand the projectile-creation in-wall problem (just the images, the mechanics have been changed!, now the arrows are 360º).
I am trying to figure out a way to kill those two problems once for all, doing research of sprites, but nothing. I tried even changing to the "default view system" (view[0] > object following: player) but it's not a view problem, it remains the same. I appreciate any suggestion, or even if you think this is an odd way to do that, please say it!
Thank you all!
EDIT: The "final y" - 5 is to create a gap between the player and the objects that destroy the projectiles, so if the player approaches to the walls too much, the projectile isn't destroyed. (in the link there are some pictures that illustrate this)
EDIT+: The collision mask of the projectiles is really small, in order to prevent what I told you before when approaching the destroying objects; look!,
Let me introduce this; the game has weapons such as bows, staffs... which can create projectiles.
I wanted walls, signs, furniture... to break those projectiles, as it wouldn't make sense that arrows went through walls.
All the objects able to destroy the projectiles are my "destroyer objects", that execute the same script;
Code:
var projectile_inst = collision_rectangle(x - sprite_xoffset, y - sprite_yoffset, x - sprite_xoffset + sprite_width, y - sprite_yoffset + sprite_height, obj_projectile, true, true);
if (projectile_inst != noone) {
with (projectile_inst) instance_destroy();
}
For debugging reasons, I decided to draw the collision borders and this is what I found:
The collision boxes seem to have moved, and I don't know why... As well there are some little spaces where the collision system is not working. What's wrong?
Before detecting this BIG error, the collision was defined the same, but the "final y" of the rectangle was the same minus 5, so it made some space for if the player was touching the wall to fire the arrow, but it made this other screen:
So it seems I have 2 big problems here, that I didn't expect at all; one of them (the last one) I thought I solved it (https://forum.yoyogames.com/index.php?threads/setting-up-a-projectile-solution-found.12150) <-- Take a look at the images there, I think you will understand the projectile-creation in-wall problem (just the images, the mechanics have been changed!, now the arrows are 360º).
I am trying to figure out a way to kill those two problems once for all, doing research of sprites, but nothing. I tried even changing to the "default view system" (view[0] > object following: player) but it's not a view problem, it remains the same. I appreciate any suggestion, or even if you think this is an odd way to do that, please say it!
Thank you all!
EDIT: The "final y" - 5 is to create a gap between the player and the objects that destroy the projectiles, so if the player approaches to the walls too much, the projectile isn't destroyed. (in the link there are some pictures that illustrate this)
EDIT+: The collision mask of the projectiles is really small, in order to prevent what I told you before when approaching the destroying objects; look!,
Last edited: