Hurt Box Gamemaker Studio 2 code
//player making hurt box code
//action (also to make sure I don't make a bunch of hit boxes)
if (thrustHit == false){
//note, kept putting code in hurt box instead of hit box for how it wasn't working XD
var hitbox1 = instance_create_layer(self.x + (10*image_xscale),self.y+50,"Instances",hitBox);
hitbox1.x1 = 100;
hitbox1.x2 = 100;
hitbox1.y1 = 100;
hitbox1.y2 = 100;
thrustHit = true;
}
//@description create event code
allyCheck = "n";
lifeTimer = 0; lifeTimerMax = (1 * room_speed);
x1 = 0;
x2 = 0;
y1 = 0;
y2 = 0;
/// @description step event
var instGrab = collision_rectangle(x-x1,y-y1,x+x2,y+y2,enemyParent,0,0);
if (instGrab != noone){
instance_destroy(instGrab);
}
//follow
x = x + oPlayer.x;
y = y + oPlayer.y;
lifeTimer++;
if (lifeTimer > lifeTimerMax){
instance_destroy(self);
}
// You can write your code in this editor
/// @description Draw event
draw_rectangle_color(x1,y1,x2,y2,c_red,c_red,c_red,c_red,true);
// You can write your code in this editor
Comments
Post a Comment