Gaming
  Home arrow Gaming arrow Page 8 - Controlling Games with the Keyboard an...
Dev Hardware Forums 
Computer Cases  
Computer Processors  
Computer Systems  
Digital Cameras  
Flat Panels  
Gaming  
Hardware Guides  
Hardware News  
Input Devices  
Memory  
Mobile Devices  
Motherboards  
Networking Hardware  
Opinions  
PC Cooling  
PC Speakers  
Peripherals  
Power Supply Units  
Software  
Sound Cards  
Storage Devices  
Tech Interviews  
User Experiences  
Video Cards  
Mobile Linux 
APP Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
GAMING

Controlling Games with the Keyboard and Mouse
By: Sams Publishing
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 32
    2004-10-11

    Table of Contents:
  • Controlling Games with the Keyboard and Mouse
  • Taking a Look at User Input Devices
  • Mouse and Joystick
  • Tracking the Mouse
  • Revamping the Game Engine for Input
  • Sprucing Up the Bitmap Class
  • Building the UFO Example
  • Testing the Finished Product

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Controlling Games with the Keyboard and Mouse - Testing the Finished Product


    (Page 8 of 8 )

    The UFO example is the closest thing you've seen to a game thus far and is quite interesting in terms of allowing you to fly around an animated graphical object. Hopefully, you'll be pleasantly surprised by the responsiveness of the program's keyboard controls. Figure 5.2 shows the UFO program in action as the flying saucer does a flyby of some desert cacti.

    morrison

    Figure 5.2 -- The UFO example demonstrates how to control an animated graphical object with the keyboard and mouse.

    If you guide the flying saucer to the edge of the game screen, it will stop, which is to be expected given the program code you just worked through. There are a variety of different ways to tweak this program and make it more intriguing, such as wrapping the flying saucer from one side of the screen to the other, which is why I hope you spend some time tinkering with the code.

    Summary

    The ability to effectively communicate with the people who play your games is a critical factor of game design and development. In one direction, a game communicates by displaying graphics and playing sounds and music, but in the other direction, the user responds by interacting with a physical input device of some sort. It's very important for game developers to master the fine art of responding to user input through a variety of different user input devices. The keyboard and mouse are the two fundamental user input devices that you can count on all people having. This chapter showed you how to handle and respond to keyboard and mouse input in an efficient manner specifically suited to games.

    Beyond the keyboard and mouse, it's up to your resources and the specific needs of each game to determine whether you should support additional input devices. Chapter 7 tackles the subject of joystick input, which is the next most important input device for games. However, before you get to that, it's time to get down to business and create a real game; the next chapter guides you through the design and development of your first game.

    Field Trip

    Quick! Forget everything you just learned in this chapter! If you haven't already played it, beg, borrow, or maybe even consider purchasing the game LifeLine by Konami, which is billed as the world's first "voice action adventure." Although LifeLine might be old news to some gamers, it has charted new territory in the way of game user interfaces. LifeLine is very unique in that it relies solely on voice commands to play the game, which means that you don't really use any input device other than a microphone. Although this might sound strange at first, in the context of the game, it works very well because the storyline involves you being stuck in a room communicating with a robot via a microphone. If you already have the game, consider this field trip a day off. Otherwise, I encourage you to check out LifeLine and analyze how it turns traditional game input on its ear. Incidentally, I have no connection to Konami or the game LifeLine, so this isn't a deviously clever plug.

    SamsThis chapter is from Beginning Game Programming, by Michael Morrison (Sams, ISBN: 0672326590). Check it out at your favorite bookstore today.

    Buy this book now.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    GAMING ARTICLES

    - Sony PSP Go
    - The Beatles: Rock Band for Xbox 360
    - Sony PS3 Slim
    - Wolfenstein for the Xbox 360
    - Madden NFL 10 for PS3
    - NCAA Football 10
    - Wii Sports Resort
    - Transformers: Revenge of the Fallen
    - Best Free MMORPG
    - Wii Battery-Saving Tips
    - The Next Generation of Gaming
    - Fallout 3 Review
    - Resistance Fall of Man 2 - Resistance II
    - Second Life: Online Game or Social Replaceme...
    - WoW-ing Online Gamers: What to Expect From t...






    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek