Okay, so there's a projectile that doesn't want to coorperate. However, since that's merely a single projectile, I'll post my problem here instead of making a seperate thread. So I want my projectile to split in two. I have that. Now I also want to change the split depending on whenever the projectile has hit the wall or the ground. While the wall detection is fine, the ground detection isn't. Sometimes, the projectile will hit the ground far away from any wall and still think that it has hit a wall, and I'm trying to fix that. Here's the collision detection (inside the Step Event): Code: if hspeed > 0 and collision_rectangle(bbox_right+hspeed,bbox_top,bbox_right+hspeed,bbox_bottom-1,obj_solid,0,0) //I have hit the right wall { fire1 = (instance_create(self.x+8,self.y+8,obj_autobomb_firevert)) fire1.vspeed = 3 fire2 = (instance_create(self.x+8,self.y+8,obj_autobomb_firevert)) fire2.vspeed = -3 sound_play(snd_flames) instance_destroy() } else if hspeed < 0 and collision_rectangle(bbox_left+hspeed,bbox_top,bbox_left+hspeed,bbox_bottom-1,obj_solid,0,0) //I have hit the left wall { fire1 = (instance_create(self.x,self.y+8,obj_autobomb_firevert)) fire1.vspeed = 3 fire2 = (instance_create(self.x,self.y+8,obj_autobomb_firevert)) fire2.vspeed = -3 sound_play(snd_flames) instance_destroy() } else if collision_rectangle(bbox_left,bbox_bottom+1,bbox_right,bbox_bottom+1,obj_solidtop,0,0) //I have hit the ground { fire1 = (instance_create(self.x,self.y+8,obj_autobomb_fire)) fire1.hspeed = 3 fire2 = (instance_create(self.x,self.y+8,obj_autobomb_fire)) fire2.hspeed = -3 sound_play(snd_flames) instance_destroy() }
Would be glad if someone could help me there, because that's the last tidbit that needs to be corrected before another boss in my fangame is finally finished. Thanks in advance!
Okay, so there's a projectile that doesn't want to coorperate. However, since that's merely a single projectile, I'll post my problem here instead of making a seperate thread.
So I want my projectile to split in two. I have that.
Now I also want to change the split depending on whenever the projectile has hit the wall or the ground.
While the wall detection is fine, the ground detection isn't.
Sometimes, the projectile will hit the ground far away from any wall and still think that it has hit a wall, and I'm trying to fix that.
Here's the collision detection (inside the Step Event):
[code]
if hspeed > 0
and collision_rectangle(bbox_right+hspeed,bbox_top,bbox_right+hspeed,bbox_bottom-1,obj_solid,0,0) //I have hit the right wall
{
fire1 = (instance_create(self.x+8,self.y+8,obj_autobomb_firevert))
fire1.vspeed = 3
fire2 = (instance_create(self.x+8,self.y+8,obj_autobomb_firevert))
fire2.vspeed = -3
sound_play(snd_flames)
instance_destroy()
}
else if hspeed < 0
and collision_rectangle(bbox_left+hspeed,bbox_top,bbox_left+hspeed,bbox_bottom-1,obj_solid,0,0) //I have hit the left wall
{
fire1 = (instance_create(self.x,self.y+8,obj_autobomb_firevert))
fire1.vspeed = 3
fire2 = (instance_create(self.x,self.y+8,obj_autobomb_firevert))
fire2.vspeed = -3
sound_play(snd_flames)
instance_destroy()
}
else if collision_rectangle(bbox_left,bbox_bottom+1,bbox_right,bbox_bottom+1,obj_solidtop,0,0) //I have hit the ground
{
fire1 = (instance_create(self.x,self.y+8,obj_autobomb_fire))
fire1.hspeed = 3
fire2 = (instance_create(self.x,self.y+8,obj_autobomb_fire))
fire2.hspeed = -3
sound_play(snd_flames)
instance_destroy()
}
[/code]
Would be glad if someone could help me there, because that's the last tidbit that needs to be corrected before another boss in my fangame is finally finished.
Thanks in advance!
_________________
My games: Spoiler:
What I also support: Spoiler:
|
|