L
im using the built in function, I'm using it in a while loop because its inside a script for bullet collision.Why use collision_line in a while loop?
are you using the built in collision line or your own varient?
yeah i had it on from the beginning :/Try enabling fast collision system in first Global Game Settings' tab, if the GMS version you use has it. Otherwise tell what you're trying to do and/or show the code.
with(enemy) {
if (other distance to this is < 1400) {
if (!collision line between this and other) {
could_be_near_miss = true;
alarm[0] = 12;
}
}
}
if (could_be_near_miss) {
is_near_miss = true;
//do whatever you want with the near miss;
show_debug_message("that was close!")
}
could_be_near_miss = false;
so toss out using while loop? would it be better to do bullets like that? im still figuring out the best way for my bullets to work..In the bullet step event you should:
1) check if distance to bullet is < than whatever you want!!
2) if 1) is true: check to see if there is no collision line between the bullet and the enemy
3) if 2) is true: do something
4) move the bullet!
if this code is placed into my while loop code for my bullet, it essential does the same thing and becomes slow. if my bullets were actual projectiles flying at 12 pixels per frame the code would work though..In the bullet step event you could:
in the alarm0 event of the enemyCode:with(enemy) { if (other distance to this is < 1400) { if (!collision line between this and other) { could_be_near_miss = true; alarm[0] = 12; } } }
in bullet collision with enemy eventCode:if (could_be_near_miss) { is_near_miss = true; }
Just read the all post and understood what you are trying to do,Code:could_be_near_miss = false;
here is a pseudo-code, try it out..
with(bullet) {
if (other distance to this is < 1400) {
if (!collision line between this and other) {
other.could_be_near_miss = true;
other.alarm[0] = 12;
}
}
}
if (could_be_near_miss) {
is_near_miss = true;
//do whatever you want with the near miss;
show_debug_message("that was close!")
}
could_be_near_miss = false;
your bullets are not projectiles?! or instances?!if this code is placed into my while loop code for my bullet, it essential does the same thing and becomes slow. if my bullets were actual projectiles flying at 12 pixels per frame the code would work though..
yeah my bullets are all just codes! forgot to explain.your bullets are not projectiles?! or instances?!
ahhhhh okay then, let me think!