Glad you got it sorted out.
In regards to the trigonometry, the math used here is actually not too complicated. Check out the definition of a
Unit Circle (mathisfun.com). You see that sin() and cos() can be used to calculate the factors for the vertical and horizontal displacements of a point corresponding to a given angle on a unit circle. In your case, the angle is the angle of the car's movement. Multiplying the canvas' desired distance from the car (distFromCar) by the values given by sin() and cos() gives the amounts of vertical and horizontal displacement needed.
Jeisenga wrote:Can you explain why the variable distFromCar needs a real (double) and why a float doesn’t work?
The variable distFromCar could as well be a float, I just used the GE's built-in variable creation system for simplicity, as there was nothing else that needed to go to Global Code, which is the only place where one can define global float variables. It could actually as well be an integer, since the result of the calculation is going to be the actor's position on the screen and that is always measured in pixels (in GE). It just makes sense for me to use a floating-point variable for trigonometry.
Oh, and the variable has to be a global variable because I wanted to be able to set it's value just by moving the canvas in the editor view and that meant initializing its value in the Create Actor event of the actor. And only global variables can be used across multiple different scripts, those floats defined in the Draw Actor event only exist in that script. But you could just as well have it be a local variable initialized with the desired value in the Draw Actor script just like the other variables, that would just mean that to adjust the distance you'd have to adjust the value in the script.
Sorry, I didn't quite understand what you meant with the question about the float, so I tried to answer all the different ways you could have meant that question.
Jeisenga wrote:Also another thing I can’t figure out, I want the mouse pointer to send to a certain coordinate so it’s out of the way. But xmouse and ymouse are read only so that doesn’t work. I’m sure it’s possible but maybe not in GE. GE self uses it in Full Screen mode. If you press Game mode the mouse jumps to the middle of the screen and I want it to one of the edges.
If you'd like to hide the cursor all together, there's an option for that in the
Game Properties menu. Another solution is to hide the cursor and make your own cursor. It can be accomplished either with FollowMouse() or by using xmouse and ymouse to read the mouse position and move the custom cursor there. There's a couple more things to consider when making a custom cursor, and I'll tell more about those should you decide to go that way.
Jeisenga wrote:Also this is bugging me for a while: strcat(&Text_Result, “Why the &");
If I do a strcat it always puts a & in there and I have to delete it from the script for it to work. Is that a bug or can this & have a purpose?
It putting it there always automatically is a bug. The & in front of a variable like that is an
address of -operator - it gives a pointer to the memory address where the variable resides. The ampersand becomes a problem in your example case because strings in C are actually just pointers to the first element of a char array. Using the address of operator for a pointer gives a pointer to a pointer, but that is not what strcpy(), strcat() etc. expect, hence the error. It has it's uses in other cases.