if Hit <= 0 and place_meeting(x,y,Hitbox)I've commented out the "place_meeting(x,y,Hitbox)" part before, and it doesn't crash, though it does stop doing what I want it to. So, for some reason, that's causing crashes. Any information or assistance would be great. Here's the relevant code:
(Oh, and yeah, I know it's sloppy, I'm going to tidy it up once this starts working.)
Player Attack Key Event:
if Damaged = false
{
Take_Action("PuddingAttack")
}
Take_Action function
if Attacking = false
{
Attacking = true
CurrentAction = instance_create(x,y,Hitbox)
if argument0 = "PuddingAttack"
{
Duration = 10
Cooldown = 10
CurrentActionTime = Cooldown
CurrentAction.Duration = 10
CurrentAction.Cooldown = 10
CurrentAction.AttackFrames = ds_grid_create(10,10)
CurrentAction.AttackFrames[0,0] = x+(Player.Facing*32) //X-Position
CurrentAction.AttackFrames[0,1] = y //Y-Position
CurrentAction.AttackFrames[0,2] = Rectangle //Shape
CurrentAction.AttackFrames[0,3] = 0 //Rotation
CurrentAction.AttackFrames[0,4] = 0 //Height
CurrentAction.AttackFrames[0,5] = 0 //Width
CurrentAction.AttackFrames[0,6] = 10 //Damage
CurrentAction.AttackFrames[0,10] = "" //Effects
CurrentAction.AttackFrames[1,0] = x+(Player.Facing*32) //X-Position
CurrentAction.AttackFrames[1,1] = y //Y-Position
CurrentAction.AttackFrames[1,2] = Rectangle //Shape
CurrentAction.AttackFrames[1,3] = 0 //Rotation
CurrentAction.AttackFrames[1,4] = 0 //Height
CurrentAction.AttackFrames[1,5] = 0 //Width
CurrentAction.AttackFrames[1,6] = 10 //Damage
CurrentAction.AttackFrames[1,10] = "" //Effects
CurrentAction.AttackFrames[2,0] = x+(Player.Facing*32) //X-Position
CurrentAction.AttackFrames[2,1] = y //Y-Position
CurrentAction.AttackFrames[2,2] = Rectangle //Shape
CurrentAction.AttackFrames[2,3] = 0 //Rotation
CurrentAction.AttackFrames[2,4] = 32 //Height
CurrentAction.AttackFrames[2,5] = 32 //Width
CurrentAction.AttackFrames[2,6] = 10 //Damage
CurrentAction.AttackFrames[2,10] = "" //Effects
CurrentAction.AttackFrames[3,0] = x+(Player.Facing*32) //X-Position
CurrentAction.AttackFrames[3,1] = y //Y-Position
CurrentAction.AttackFrames[3,2] = Rectangle //Shape
CurrentAction.AttackFrames[3,3] = 0 //Rotation
CurrentAction.AttackFrames[3,4] = 32 //Height
CurrentAction.AttackFrames[3,5] = 32 //Width
CurrentAction.AttackFrames[3,6] = 10 //Damage
CurrentAction.AttackFrames[3,10] = "" //Effects
CurrentAction.AttackFrames[4,0] = x+(Player.Facing*32) //X-Position
CurrentAction.AttackFrames[4,1] = y //Y-Position
CurrentAction.AttackFrames[4,2] = Rectangle //Shape
CurrentAction.AttackFrames[4,3] = 0 //Rotation
CurrentAction.AttackFrames[4,4] = 32 //Height
CurrentAction.AttackFrames[4,5] = 32 //Width
CurrentAction.AttackFrames[4,6] = 10 //Damage
CurrentAction.AttackFrames[4,10] = "" //Effects
CurrentAction.AttackFrames[5,0] = x+(Player.Facing*32) //X-Position
CurrentAction.AttackFrames[5,1] = y //Y-Position
CurrentAction.AttackFrames[5,2] = Rectangle //Shape
CurrentAction.AttackFrames[5,3] = 0 //Rotation
CurrentAction.AttackFrames[5,4] = 32 //Height
CurrentAction.AttackFrames[5,5] = 32 //Width
CurrentAction.AttackFrames[5,6] = 10 //Damage
CurrentAction.AttackFrames[5,10] = "" //Effects
CurrentAction.AttackFrames[6,0] = x+(Player.Facing*32) //X-Position
CurrentAction.AttackFrames[6,1] = y //Y-Position
CurrentAction.AttackFrames[6,2] = Rectangle //Shape
CurrentAction.AttackFrames[6,3] = 0 //Rotation
CurrentAction.AttackFrames[6,4] = 32 //Height
CurrentAction.AttackFrames[6,5] = 32 //Width
CurrentAction.AttackFrames[6,6] = 10 //Damage
CurrentAction.AttackFrames[6,10] = "" //Effects
CurrentAction.AttackFrames[7,0] = x+(Player.Facing*32) //X-Position
CurrentAction.AttackFrames[7,1] = y //Y-Position
CurrentAction.AttackFrames[7,2] = Rectangle //Shape
CurrentAction.AttackFrames[7,3] = 0 //Rotation
CurrentAction.AttackFrames[7,4] = 0 //Height
CurrentAction.AttackFrames[7,5] = 0 //Width
CurrentAction.AttackFrames[7,6] = 10 //Damage
CurrentAction.AttackFrames[7,10] = "" //Effects
CurrentAction.AttackFrames[8,0] = x+(Player.Facing*32) //X-Position
CurrentAction.AttackFrames[8,1] = y //Y-Position
CurrentAction.AttackFrames[8,2] = Rectangle //Shape
CurrentAction.AttackFrames[8,3] = 0 //Rotation
CurrentAction.AttackFrames[8,4] = 0 //Height
CurrentAction.AttackFrames[8,5] = 0 //Width
CurrentAction.AttackFrames[8,6] = 10 //Damage
CurrentAction.AttackFrames[8,10] = "" //Effects
CurrentAction.AttackFrames[9,0] = x+(Player.Facing*32) //X-Position
CurrentAction.AttackFrames[9,1] = y //Y-Position
CurrentAction.AttackFrames[9,2] = Rectangle //Shape
CurrentAction.AttackFrames[9,3] = 0 //Rotation
CurrentAction.AttackFrames[9,4] = 0 //Height
CurrentAction.AttackFrames[9,5] = 0 //Width
CurrentAction.AttackFrames[9,6] = 10 //Damage
CurrentAction.AttackFrames[9,10] = "" //Effects
}
Hitbox Create Event
Frame = 0
Hitbox Step Event:
x = AttackFrames[Frame,0]
y = AttackFrames[Frame,1]
sprite_index = AttackFrames[Frame,2]
image_angle = AttackFrames[Frame,3]
image_xscale = AttackFrames[Frame,4]
image_yscale = AttackFrames[Frame,5]
global.Damage = AttackFrames[Frame,6]
with(Enemy)
{
if Hit <= 0 and place_meeting(x,y,Hitbox)
{
HP -= global.Damage
Hit = 5
}
}
Frame+=1
if Frame = Duration
{
instance_destroy()
}
Not sure if either of these will matter, but just in case:
Player step event
SlidingRight = false
SlidingLeft = false
JustJump = false
if place_meeting(x,y+1,Block)
{
Grav = 0
Grav_Dir = 0
}
else
{
Grav = 0.5
Grav_Dir = 0
if Vspeed > 0 and place_meeting(x+SP,y,Block)
{
SlidingRight = true
Facing = -1
}
if Vspeed > 0 and place_meeting(x-SP,y,Block)
{
SlidingLeft = true
Facing = 1
}
}
if Vspeed > VS
{
Vspeed = VS
}
if Vspeed > VSW and (SlidingLeft = true or SlidingRight = true)
{
Vspeed = VSW
}
Player_Up()
if HP < 0
{
instance_destroy()
}
Hit -= 1
if Hit > 0
{
Damaged = true
}
if Hit < 0
{
Damaged = false
Hit = 0
}
if Damaged = false
{
Ouch -= 1
if Ouch < 0
{
Ouch = 0
}
}
if CurrentActionTime = 0
Attacking = false
if CurrentActionTime < -1
CurrentActionTime = -1
CurrentActionTime -= 1
Move()
Enemy Step Event
if HP < 0
{
instance_destroy()
}
Hit -= 1
if Hit < 0
{
Hit = 0
}
Move()
if place_meeting(x,y+1,Block)
{
Grav = 0
Grav_Dir = 0
}
else
{
Grav = 0.5
Grav_Dir = 0
}
if collision_rectangle(x,y,x+sprite_width,y+sprite_height,Player,true,true)
{
Target = collision_rectangle(x,y,x+sprite_width,y+sprite_height,Player,true,true)
if Target.Ouch <= 0
{
Target.HP -= 20
Target.Hit = 5
Target.Ouch = 50
}
}
Thanks in advance for any help.
Edited by lightning storm, 22 February 2012 - 03:52 AM.











