changing the cursor in a scene
I need to know how to do the following:
When the player clicks on a button that jumps from one frame to another, I need the need the cursor to change to a reel to reel tape in the new frame. Then when the player clicks the reel to reel tape on an area in the frame the cursor needs to change to a cd, and finally when the cd is clicked on another area, it needs to turn into a sheet of paper, and when that is clicked on an area, the cursor reverts back to the default arrow. How can I do this?
And how can I make it until the cursor reverts back to the default cursor, the played cannot get out of the frame.
Re: changing the cursor in a scene
Okay well that's a lot of cursor icon switching.
There are a lot of ways you can do this, and that's the great thing about Multimedia Fusion. No one way is the right way, especially for things like this. There are, however, more EFFICIENT ways of going about this, both in terms of code and RAM usage, something many developers forget about.
Create an Active Object, and name it Cursor under its About tab. Double click on it to enter the animation editor.
Here is where it gets fun.
Drag the direction slider all the way up to the fourth notch, giving you 32 directions to work with.
Starting with the right, and going clockwise (or counter-clockwise, up to you) paste the images of the different cursors you want to use in your game, one for each direction. Make the right direction your default cursor (go ahead and just flat out copy Windows' default cursor if you so desire, but it sounds like you'll want to make a custom one anyway). Then, for the next several directions, paste in your Tape, CD, Sheet of Paper, Puppy Dog Face, Targeting Reticle, Magnifying Glass, Stopwatch, whatever the hell you want. Make sure to also set your Hotspot and Action Points to where you want them (my recommendation is to set the Hotspot to the center and the Action Point to where you want clicks to be effective, so possibly also centered, but not necessarily). Click OK to save changes to your Cursor object.
Head into the Event Editor.
Create an Always event and Hide the Windows Mouse Cursor. Then, under that same always event, set the Cursor's X Position to XMouse, and the Cursor's Y Position to YMouse. Should look like this:
Always:
- Hide Windows mouse pointer (under "The Mouse Pointer and Keyboard")
- Set X Position of "Cursor" to XMouse
- Set Y Position of "Cursor" to YMouse
Run the application.
You'll notice that instead of a standard windows mouse pointer, you have a custom one. Huzzah!
Now I am going to treat the rest of this post as if the user just needs to click in order to change the cursor. However, if you need them to click specific areas, just have a check in the conditionals that the Animation Direction is set properly to correspond to the specific pointer icon needed.
Create an alterable variable on your cursor object named "Clicked" in the Values tab of its properties. Then head back into the Event Editor and click "New condition."
User clicks with Left Button
+ Alterable Value A/"Clicked" of "Cursor" is >= 0
+ Only One Action When Event Loops
- Animation > Change Direction of Animation > Calculate a Direction
- Type in Dir("Cursor") + 1 (or -1 depending on which direction, clockwise or counter-clockwise, you chose to paste in your icons in the active object).
This, IN THEORY, should set it so that every time the player clicks, the cursor icon changes. Then make sure you set the final direction you want in the active object to a copy of the intial cursor. You can then set up a final event that says when the player leaves the frame/hits escape/whatever, and the "Clicked" variable of the cursor = 4, jump to the next frame/end the application/whatever.
Welcome to coding. =)
Re: changing the cursor in a scene
Man, i was having the same doubt, thanks for such a good explanation!! ;) i'm going to try out!