First off, your code should be combined into one script editor, I mean, it's kind of a drag to be checking different script editors in draw actor for checking a simple line of code. And anyway, a semicolon (;) should not be used after a } in an if statement. Make your Ball's draw actor script just this:
- Code: Select all
if(pick1=1){
MoveTo("Event Actor", 0.000000, 0.000000, 5.000000, "player1", "");
}
if(pick2=1){
MoveTo("Event Actor", 0.000000, 0.000000, 5.000000, "player1", "");
}
if(pick3=1){
MoveTo("Event Actor", 0.000000, 0.000000, 5.000000, "player1", "");
}
Now, what have you done wrong? Why does the ball keep moving?
Checking a variable in if should be done with "==" instead of just "=". = changes the variables into that designed value. So in the above code, pick1, pick2 and pick3 will be made into 1, and so the ball actor will always move to player1. So to change that, just make the = into ==.
- Code: Select all
if(pick1==1){
MoveTo("Event Actor", 0.000000, 0.000000, 5.000000, "player1", "");
}
if(pick2==1){
MoveTo("Event Actor", 0.000000, 0.000000, 5.000000, "player1", "");
}
if(pick3==1){
MoveTo("Event Actor", 0.000000, 0.000000, 5.000000, "player1", "");
}
Now, this code will now check whether pick1, pick2, or pick3 is 1. If any of them are 1, it'll move to player1.
Hope I helped.
Currently: Semi-Active.
Working on: Maybe putting my test games in gamejolt, polishing them a bit, but I still don't know when.