Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Slasher on Wed 04/04/2018 19:41:22

Title: SOLVED: Keyboard dilemma
Post by: Slasher on Wed 04/04/2018 19:41:22
Hi

I have an object moving eNoBlock and I need to disable any key being pressed because it halts the object moving.

Is there a workaround?

cheers

Edit: This seems to do the trick

Code (ags) Select

//Top of Room Script

function on_key_press(eKeyCode k) {
  ClaimEvent();
}


Title: Re: Keyboard dilemma
Post by: Snarky on Wed 04/04/2018 20:00:28
AFAIK there's nothing in AGS that would cause a moving object to stop just because you press a key. If it does, it must be because you have some code in some script that tells it to do so. So, probably change that piece of code?
Title: Re: Keyboard dilemma
Post by: wynni2 on Wed 04/04/2018 20:07:56
If the object doesn't move continuously, you could place its movement inside of a cutscene (or just switch it to eBlock). 

Or you could override keyboard entries in the room with the object:
Code (ags) Select

//room script
function on_key_press(eKeyCode keycode) {
    if (oMoving.Moving) ClaimEvent();
}


That should prevent the game from processing any keyboard entries while "oMoving" is moving.  Though it is a little odd that key entries are causing that issue. 
Title: Re: Keyboard dilemma
Post by: Slasher on Wed 04/04/2018 20:12:22
Hi,

it's more complicated than that. It is controlling a hot air balloon with bags of sand and heated air...There are no movement keys...It's done automatically via gui buttons and slider.

It seems to be working at the moment....
Title: Re: Keyboard dilemma
Post by: Cassiebsg on Wed 04/04/2018 20:28:05
If you using the default sierra template, it comes with keyboard script. Just remove it if you don't want to use it...
Title: SOLVED: Keyboard dilemma
Post by: Slasher on Wed 04/04/2018 21:23:00
That's good to know (nod)