S
Shawn
Guest
My issue is that when particles spawn from projectiles hitting a wall, they end up where that bullet should've been if it wasn't removed before allowing it to "skip" the wall/pass through the wall, using a collision line. So, if a bullet gets removed because its next location would've been 10 pixels behind the wall, the particles will spawn at the point that's 10 pixels behind the wall, but other times the particles will spawn some distance before the wall, if the bullet gets destroyed before reaching the wall. The particles are set to spawn from the wall, not at a distance away from it, nor are they meant to spawn at the location the bullet's were supposed to be. I've been looking around, and can't find ANY information on this, for some odd reason. You'd think this would be a more common problem that you can find answers to...
I've almost got this solved, but whenever the bullet actually impacts the wall, the bullet will spawn its particles in the step before its collision with the wall. I'm using a collision_line and while loop to ensure the bullets that pass through the wall still enact their collision event, and those bullets that do pass through the wall will spawn their particles in the proper location, due to the loop. So, I need to figure out a way to adjust the location of the particles from the bullet's step before collision, since they're set back.
The code I'm using to guarantee particles and ensure they're spawning in the proper location when bullets pass through the walls is as follows:
If you use code, please explain the lines; I'm still really new to GameMaker and I prefer to understand the code I use.
~~
The following is from a previous edit to this post, and it's stuff that's already been resolved, so it can be ignored.
~~
Originally, I had a different reason for this post, but I've mostly found a way around the issue, but still have a couple that I need to get resolved, though they should be easier.
The following doesn't work as well as I'd like:
object1.x = object2.x
object1.y = object2.y
(THE SOLUTION TO THIS: I had to throw the object1.x = object2.x and object1.y = object2.y into the end_step, rather than a regular step)
This would be necessary for binding a gun or a shield to the player, but using it causes it to jump ahead of the player when the gun/shield is given the same movement controls while binding it to the player, and it causes it to lag behind the player when it's bound to the player and with no movement controls. Is there a way to do this?
The other issue is mostly related to delta timing: how do you make projectiles NOT jump over objects as their speed increases? Examples alongside explanations would be helpful.
(THE SOLUTION TO THIS: I'm using
in the bullet's step event)
I've almost got this solved, but whenever the bullet actually impacts the wall, the bullet will spawn its particles in the step before its collision with the wall. I'm using a collision_line and while loop to ensure the bullets that pass through the wall still enact their collision event, and those bullets that do pass through the wall will spawn their particles in the proper location, due to the loop. So, I need to figure out a way to adjust the location of the particles from the bullet's step before collision, since they're set back.
The code I'm using to guarantee particles and ensure they're spawning in the proper location when bullets pass through the walls is as follows:
Code:
//For Tmp_Wall_Right
Collision_Location = collision_line(xprevious, yprevious, x, y, Tmp_Wall_Right, false, false);
if Collision_Location
{
Former_X = xprevious;
if Former_X < Collision_Location.x
{
while Former_X < Collision_Location.x
{
Former_X = Former_X + 1
}
}
else if Former_X > Collision_Location.x
{
while Former_X > Collision_Location.x
{
Former_X = Former_X - 1
}
}
event_perform(ev_collision, Tmp_Wall_Right);
}
~~
The following is from a previous edit to this post, and it's stuff that's already been resolved, so it can be ignored.
~~
Originally, I had a different reason for this post, but I've mostly found a way around the issue, but still have a couple that I need to get resolved, though they should be easier.
The following doesn't work as well as I'd like:
object1.x = object2.x
object1.y = object2.y
(THE SOLUTION TO THIS: I had to throw the object1.x = object2.x and object1.y = object2.y into the end_step, rather than a regular step)
This would be necessary for binding a gun or a shield to the player, but using it causes it to jump ahead of the player when the gun/shield is given the same movement controls while binding it to the player, and it causes it to lag behind the player when it's bound to the player and with no movement controls. Is there a way to do this?
The other issue is mostly related to delta timing: how do you make projectiles NOT jump over objects as their speed increases? Examples alongside explanations would be helpful.
(THE SOLUTION TO THIS: I'm using
Code:
if collision_line(xprevious, yprevious, x, y, Wall_Object's_Name_Here, true, false)
{
event_perform(ev_collision, Wall_Object's_Name_Here_To_Destroy_Bullet_On_Collision);
}
Last edited by a moderator: