Frog The Door Games


  • Home
  • Vintage Hero
  • Alawishus Pixel
  • Space Racer
  • Cryptogram
  • Other Stuff
  • Contact

Fixed Position Virtual Thumbsticks

8/3/2010

1 Comment

 
Looking at the new samples on the creators.xna.com I see they have an example for using virtual thumb sticks in a Windows Phone 7 game. I like it, but I decided I wanted a version with the thumbs sticks fixed in place, much like you'd see in an iPhone shooter like Call of Duty: World at War: Zombies. Here's a screen of the result.
Picture

The first thing I decided was to not make the Virtual Thumbstick class static, but instead a DrawableGameComponet. While not consistent with other XNA input implementations, it allows you to add one or more thumbsticks to the list of components and let them load, draw and update without calling any methods. You can simply look at the thumbstick position, see if it's greater than zero, and determine what to do with it when it is.

I also added support for Independent Axis and Circular dead zones, where the position will always be zero when falling in the dead zone. They're needed on real gamepads since analog controls never truly return to zero at rest, but I felt not having these may make the virtual sticks feel too sensitive. I don't have a device to test on so it's up in the air if this will prove useful or not. The zone percentage can be set to zero if you don't want this feature. For more on dead zones check out Shawn Hargreaves blog post about it here.

Instead of me stepping through the code, download the zip and take a look. The original sample was commented well and I tried to do the same. Since it's based on the XNA sample and that is released with the Microsoft Permissive License, this is also released under that license. You'll find a copy with the source. Basically, use it for what ever you want, provided as-is, don't sue please, yada, yada. Let me know if you find it useful or have any improvements, ideas, etc...
fixedvirtualthumbstick.zip
File Size: 142 kb
File Type: zip
Download File

1 Comment
Jorge
12/4/2012 04:37:20 am

Thanks so much!!,

Reply

Your comment will be posted after it is approved.


Leave a Reply.

    RSS Youtube Twitter Facebook

    Games

    Vintage Hero
    Alawishus Pixel
    Space Racer
    Crytpogram


    Tweets by @frogthedoor



    Archive

    August 2017
    July 2017
    February 2017
    October 2014
    September 2014
    July 2013
    June 2012
    May 2012
    March 2012
    January 2012
    December 2011
    October 2011
    September 2011
    August 2011
    July 2011
    May 2011
    March 2011
    February 2011
    January 2011
    November 2010
    September 2010
    August 2010
    July 2010
    June 2010
    May 2010
    April 2010


    Categories

    All
    Alawishus Pixel
    Cryptogram
    Development
    Press
    Programming
    Screen Shots
    Setlist
    Space Racer
    Tutorial
    Video
    Vintage Hero
    Windows Phone
    Windows Phone 7
    Xna

    RSS Feed



Powered by Create your own unique website with customizable templates.