I'm trying to make a function that enables me to make a character follow the mouse cursor around. I also need to turn that function off and on in the game.
This works fine with a bool and a small funtion. In global script:
bool shovelfollowingcursor;
function repeatedly_execute()
{
if (shovelfollowingcursor == true)
{
cShovel.x = mouse.x;
cShovel.y = mouse.y;
}
}
function cShovel_PickUp()
{
shovelfollowingcursor = true;
}
Now I want to extend this to more characters to pick up and follow the cursor around. I figured something like an integer that keeps track of which character is the one I want to do this and then a function to make character[integer] follow the cursor, but I get the message that I cant convert character* to integer.
How do I make a function recognize a character by way of a global integer value?
If you want to store a character in the integer variable, you use followingCursor = cShovel.ID;
Or you use a character pointer:
Character *followingCursor;
followingCursor = cShovel;
if (followingCursor != null) {
followingCursor.x = mouse.x;
followingCursor.y = mouse.y;
}
That was just the word I was looking for. Thank you Khris ;)