lag on keypress

Started by jamesreg, Mon 14/12/2009 22:45:49

Previous topic - Next topic

jamesreg

I have a scene where I am using a scrolling background
I have created a sprite 800*600 to take up the whole screen and set that sprite view to my characters current view
which is the view as if though binoculars.

doing this allows me to scroll the screen back and forth

I am using the mouse as a cross hairs for firing at hot spots on the screen.

so you have to use the arrow keys to go back and forth while at the same time using the mouse to positions the cross hairs on the objects you want to fire at.

this is working well and have full level scripted out and everything works beyond what i wanted it too.

There is only one problem when pressing the left or right arrow to move after I have shoot at the correct location on the screen and preparing to goto the next location i have lag or delays it just doesnt want to get started sometimes and i have to press the key more then once

this is causing havoc cause i have the whole scene on a timer and have just enough time to go and shoot all the locations without this lag counting in.

anyone know why it is hanging up like that or what could be some of the causes?

I seriously doubt its room size room is 4200*600   I have read on here people having larger rooms

anyway any ideas would help as to why the keys seem sticky.





Gilbert

What did you use to check the key presses? If you're using the on_key_press() event try polling the key presses in rep. exec. by using IsKeyPressed() instead.

jamesreg

#2
I did not put anything anywhere aboout keypress as soon as a put the 800*600 sprite view on the character and loaded the screen it automaticaly scrolled the screen when i hit the arrow keys

I didnt have to script anything for that.

so if im wanting the player to be able to press the left or right arrow keys and not worry if they hold it down or not but allow it to move that direction rather they just tap it or rather they hold it down and then quickly revert the opposite direction when they hold down or tap the opposite direction without any hang up or lag

i would need to use this if  IsKeyPressed fuction in repeatidly execute

and I would need to take out the default on_key thing in global script

is this what your saying?

Would you mind giving me a little more help on exactly what i need to do

thanks alot im grasping what the problem is but not sure the scripting for it

SMF spam blocked by CleanTalk