Go Back  Xtreme Visual Basic Talk > Visual Basic .NET (2002/2003/2005/2008, including Express editions) > .NET Game Programming > Keyboard repeat rate/delay


Reply
 
Thread Tools Display Modes
  #1  
Old 05-12-2005, 11:37 PM
celinedrules celinedrules is offline
Newcomer
 
Join Date: Oct 2004
Posts: 1
Default Keyboard repeat rate/delay


I am working on writing my own RPG game but I have a problem with character movement.

Lets say I want to move my character to the right so I hold down the right arrow key. Well the problem is, the repeat rate of the keyboard is to fast so my characters movement isn't smooth (the movement loop repeats to fast so my character slows down). If I change the repeat rate manually on my computer to lower then it works great.

I know there are ways to change the repeat rate in VB5/6 but is there a way to change it in .net?
Reply With Quote
  #2  
Old 05-13-2005, 12:13 AM
JNewt's Avatar
JNewt JNewt is offline
Centurion
 
Join Date: Apr 2003
Location: KY (Home), ID (College)
Posts: 138
Default

I'd recommend creating an array of flags for the keys; when the KeyDown event fires, set that key's flag. When the KeyUp event fires, unset it. When you update your character's position, check the key flags to see which way to move him and keep track of ticks to move him by a consistent amount per tick. This will give you time-based movement, relatively independent from machine specs.
Reply With Quote
  #3  
Old 05-13-2005, 01:46 PM
elnerdo's Avatar
elnerdo elnerdo is offline
Contributor
 
Join Date: Jul 2004
Location: Northern New Jersey
Posts: 490
Default

__________________
nerds unite!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->