A
Andrew R. C. Beck
Guest
Just as the title says, I'd managed to sort out the collisions of the ball from fine folks here with a place_meeting code in the ball's Step Event:
[code]
//Collision Checks//
//----------//
//Horizontal//
//-----//
if place_meeting( x - 1, y, all)
||
place_meeting( x + 1, y, all)
{
audio_play_sound(bump, 2, false);
move_bounce_all(true);
}
//-----//
//Vertical//
//-----//
if place_meeting(x, y + 1, all)
||
place_meeting(x, y - 1, all)
{
audio_play_sound(bump, 2, false);
move_bounce_all(true);
}
//-----//
//V + H//
//-----//
if place_meeting(x, y + 1, all) && place_meeting(x + 1, y, all)
||
place_meeting(x, y + 1, all) && place_meeting(x - 1, y, all)
||
place_meeting(x, y - 1, all) && place_meeting(x + 1, y, all)
||
place_meeting(x, y - 1, all) && place_meeting(x - 1, y, all)
{
audio_play_sound(bump, 2, false);
move_bounce_all(true);
}
//-----//
[/code]
this has helped the ball to collide and bounce off of the enemies, but now it is stopping them from receiving damage. Here is code from a Collision Event with the ball in an enemy object:
I would appreciate any observations or help with this and if possible, I would like to use a Step Event in the enemy objects instead to avoid event clutter
[code]
//Collision Checks//
//----------//
//Horizontal//
//-----//
if place_meeting( x - 1, y, all)
||
place_meeting( x + 1, y, all)
{
audio_play_sound(bump, 2, false);
move_bounce_all(true);
}
//-----//
//Vertical//
//-----//
if place_meeting(x, y + 1, all)
||
place_meeting(x, y - 1, all)
{
audio_play_sound(bump, 2, false);
move_bounce_all(true);
}
//-----//
//V + H//
//-----//
if place_meeting(x, y + 1, all) && place_meeting(x + 1, y, all)
||
place_meeting(x, y + 1, all) && place_meeting(x - 1, y, all)
||
place_meeting(x, y - 1, all) && place_meeting(x + 1, y, all)
||
place_meeting(x, y - 1, all) && place_meeting(x - 1, y, all)
{
audio_play_sound(bump, 2, false);
move_bounce_all(true);
}
//-----//
[/code]
this has helped the ball to collide and bounce off of the enemies, but now it is stopping them from receiving damage. Here is code from a Collision Event with the ball in an enemy object:
Code:
//Hit//
//-----//
if (hit = 0)
{
if (block_dur >= 1)
{
block_dur -= 1;
audio_play_sound(sky_shape_hit, 2, false);
image_index = 1;
image_speed = 30;
hit = 15;
}
else
{
audio_play_sound(sky_shape_hit2, 2, false);
instance_destroy();
}
}
//-----//
Last edited by a moderator: