Code:
Download
Problem description:
When I press and hold arrow key:
1. First step is smooth
2. Second step is much faster, nearly instant
3. All further steps are fine
Is this a problem with my code, or that's how movement is handled? Is there any way to make second step smoother, to make it look continuous?
ID:138974
![]() Aug 21 2011, 10:45 pm (Edited on Aug 21 2011, 11:05 pm)
|
|
Yes, that's probably best. The only problem is that when moving diagonally, it'll get choppyn since in terms of pixels, you are moving further. I've tried it out myself and unless you use 0, either diagonal or straight movements will look choppy, though, diagonals aren't used very often so it may as well not even matter.
|
Well, there is a standard delay that is built into byond. The first step is at normal speed and then the second step and onward are repeated.
You should probably look into a library that moves based on whether the key is up or down, rather than if the key is repeating. What do I mean by that? You know that small delay that you get when you hold down a key when typing. it types the letter once, then it waits about half a second and then types the letter super fast over and over again? Same thing. There are some movement systems that use the default byond movement but instead of calling procs like North() they call step(src,north) instead with some switches involved in it. It basically makes your movement respond instantly instead of taking the keyboards repeat delay into account. |
I find that 16 gives me a fairly consistent movement speed, but it depends on how you have your movement set up. (multiples of 2 work best)