Alright well, in a game i'm making I need to know if these 2 gui controls hit so, i tryed many methods i'm wondering why this one doesn't work, and or how I can make it work
PHP Code:
// ron_dot & ron_plr are the gui control names
for( i = 0; i < 2; i = i + .01 ) {
if( ron_dot.x - ron_plr.x = i ) {
for( j = 0; j < 2; j = j + .01 ){
if( ron_plr.y - ron_dot.y = j ) {
player.chat = "Hit";
}
}
}
}
then I also tried which semi works but not always.
PHP Code:
//Using a bunch of cords and just checking if it matches?
this.xcords = { ron_dot.x,ron_dot.x + .25, ron_dot.x + .5,ron_dot.x + .75,ron_dot.x+1, ron_dot.x+ 1.5, ron_dot.x+2,ron_dot.x - .25,ron_dot.x - .5,ron_dot.x - .75,ron_dot.x - 1, ron_dot.x - 1.5, ron_dot.x - 2 };
this.ycords = { ron_dot.y,ron_dot.y - .25, ron_dot.y + .5,ron_dot.y - .75,ron_dot.y+1, ron_dot.y+ 1.5, ron_dot.y+2,ron_dot.y - .25,ron_dot.y - .5,ron_dot.x - .75,ron_dot.y - 1, ron_dot.y - 1.5, ron_dot.y - 2 };
if ( ron_plr.x in this.xcords ) {
if ( ron_plr.y in this.ycords ) {
player.chat = "Hit";
}
}
thanks in advance!.