/*step event*/ self.cline=collision_line(self.x+8,self.y+8,obj_player.x+8,obj_player.y+ 8,obj_solid,false,false)
to find if there is a wall (obj_solid) between it and the player. If it's clear, the enemy goes through with a set of charging actions, as seen below:
/*alarm 0 event*/
if self.x=obj_player.x && self.cline=false
{
if self.y>obj_player.y
{
self.step=15
dir=2
self.atkdir[1]=false
self.atkdir[2]=true
self.atkdir[3]=false
self.atkdir[4]=false
}
if self.y<obj_player.y
{
self.step=15
dir=4
self.atkdir[1]=false
self.atkdir[2]=false
self.atkdir[3]=false
self.atkdir[4]=true
}
}
if self.y=obj_player.y && self.cline=false
{
if self.x>obj_player.x
{
self.step=15
dir=1
self.atkdir[1]=true
self.atkdir[2]=false
self.atkdir[3]=false
self.atkdir[4]=false
}
if self.x<obj_player.x
{
self.step=15
dir=3
self.atkdir[1]=false
self.atkdir[2]=false
self.atkdir[3]=true
self.atkdir[4]=false
}
}Now the code works perfect without collision_line in the mix (other than the enemy charging into walls and stopping because the player's on the other side), but when I try and use collision_line, the charge sequence isn't triggered.
Please note that I did not post all of the alarm 0 event's code, but rather just the part that's directly affected by collision_line.
Anyone have any advice on the proper use of collision_line? I'm all ears
Oh, and I'm working with GM6.
Thanks for your time.
Edited by Old School Gaming, 08 July 2009 - 03:14 AM.











