Ethan | Hi. I was wondering, how can I make a wandering view do something when it comes in contact with the player? I've got it wandering around... but I can't really think of how to make it react to touching the player. Thanks for helping the poor little newbie. :) |
Sami_Tervo |
let's assume that your wandering view is named as object 1 (o1). here's few ways to do it, prolly not the best but they should work. 1) Easy, but not quite accurate one. Flag 40 is optional, just to prevent multiple prints. if (f5){ ..... v40 = 0; reset(f40) } distance(o0,o1,v40); if(!f40){ if(v40 < 20){ print("Hi I'm object 1, wazzup"); }set(f40); } return(); ------------------------------------------------------------------- 2) Hard?! =), but accurate if (f5){ ..... v40 = 0; v41 = 0; v42 = 0; v43 = 0; } get.posn(o0,v40,v41); get.posn(o1,v42,v43); /* Damn, im running out of time so I let you figure out exact commands. I'm back at monday so I can then tell the exact code. Check which variable is bigger than other to do this: */ Variable_with_bigger_value -= Variable_with_smaller_value /* If you don't check which one is bigger than other AGI won't approve it because value can't be smaller than 0 do it twice, for x and y-coords */ if(!f40){ if (Result_variable_x < 20 && Result_variable_y < 34){print("Hi I'm object 1, wazzup");} set(f40); } return(); Easy eh =)? |