Writing a textbook is a lot of work and there are a lot of people involved - editors, copy editors, proof readers, reviewers, and of course an author. Even with all of those people reading and re-reading everything, typos, errors, and omissions happen. On this page you'll find a list of all of the issues that have been reported so far. If you find a problem that isn't listed on this page, please reach out to me at welcomebraveadventurer@gmail.com to let me know about it!
Before we move on to exploring mouse buttons, if you left the keyboard statements intact and wrote the mouse statements below, you'll probably find that you can't use the keyboard (WASD) any more. It's not that the program isn't checking for the key presses, it's that the _heroX and _heroY are being set to the mouse coordinates and the WASD input is being overridden during each Update(). To get your WASD keyboard movement back, simply comment out the two last lines like this:
//_heroX = currentMouseState.X;
//_heroY = currentMouseState.Y;
We'll look at mouse button clicking and drag-and-drop - both of which are more effective than simply following the mouse position - in the next two sections.
We use cookies to analyze website traffic and optimize your website experience. By accepting our use of cookies, your data will be aggregated with all other user data.