Okay. Second question. I have looked through the forum posts for an answer, but can't really find one. I initially wanted to make the main actor follow the mouse, but I didn't want it to "teleport" or to stop once it got to the place where the mouse was first clicked (i.e., I didn't want the actor to just "walk" to the one place, but rather to continue to follow the movement of the mouse so long as it remained down).
Piecing together some of the great advice on the forums, I cobbled together a way to get the desired movement. Here's what I did:
(1) Created a filled region actor (called "Sensor") and added the following in the script editor for Sensor->Mouse Button Down (Left):
MoveTo("Ship", xmouse - (view.width/2), ymouse - (view.height/2), 10, "Mouse Position");
This accomplished getting the main actor to go to the place where the mouse first touched down.
(2) Added the same thing in the script editor for MainActor->Mouse Button Down (Left).
(3) Added the following in the script editor for MainActor->Draw Actor:
if (frame > 200)
{
MoveTo("Ship", xmouse - (view.width/2), ymouse - (view.height/2), 10, "Mouse Position");
}
This accomplishes the aim of getting the MainActor to go in the direction of the current position of the mouse rather than where the mouse first touched down (The reason for waiting until at least the 200th frame to execute is that the MainActor is created at startup but I still need to get through a splash screen and main menu. So as long as the code isn't executed at the moment MainActor is first drawn, I'm okay).
Anyways...my question (finally!): The movement accomplished by the steps discussed above is exactly what I need, but I can't get it to ever stop even after I've released the mouse button! Isn't there some way to do it like this (pseudocode):
while(MouseButton is down)
{
Move ship towards current position of mouse;
}
xvelocity = 0;
yvelocity = 0; //Leave the MainActor in the position it was in when the mouse is released
Thanks for your help in advance...I'll try not to clog the forum with silly questions too frequently =)
Plinydogg