Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Programming help
#1
I am building an rpg, and was wondering how I could slow down the movement of my character. If you hold the arrow key down he goes flying across the screen. and you can bearly see the walk cycle.
Reply
#2
the most common way is to wait for the screen to refresh:

wait &h3da, 8

this put a 60-framepersecond cap on all computers (where it runs too fast), which is a good thing. beyond that, i recommend getting a hi-res timer (eg., the qbtm one at the code post or hptimer or cosmox) and pause until x time per frame has passed. (if you go with this i'll help you out a bit more).
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#3
first of all, use the vsync code:
WAIT &H3DA, 8

For your second question, if you want to disable this kind of movement altogether:

store your last key in a var. If the current key = your last key, don't move.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#4
The Vsync cycle given is not complete and can desync, specially under windoze.

Use the complete Vsync cycle:

Code:
WAIT &H3DA,8
WAIT &H3DA,8,8

As I explained somewhere in the past (before all got deleted) this waits for the CRT to repos at the top and the waits for the vsync.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#5
You could buy Rel's old computer... Big Grin
Antoni
Reply
#6
rolmao@antoni!!

ive never noticed a difference. but the second wait to pause for the screen refresh is probably a better way to go.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#7
Oh hoh hoh hooo... that was low, Antoni. [Image: biglaugh.gif]
img]http://usuarios.vtr.net/~disaster/sigs/annoyizer.php[/img]
Reply
#8
Quote:You could buy Rel's old computer... Big Grin

OLD 486 66DX for 99 USD for sale.

Specs:
Fried MotherBoard
No Hard Disk

Antoni: I'll give ya a discount.. ;*)
y smiley is 24 bit.
[Image: anya2.jpg]

Genso's Junkyard:
http://rel.betterwebber.com/
Reply
#9
wooooooooow! Hardcore system specifications! Muah Smile LoL.

I guess that computer is more Hamburger now than a pc :-D
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)