WhatPumpkin / Sburb-Legacy

An HTML5 engine for developing Homestuck walkabout sequences.
44 stars 21 forks source link

disableControl and enableControl command #146

Closed Gankra closed 12 years ago

Gankra commented 12 years ago

disableControl: Prevents user from providing input to the character syntax: none (possibly optionally give it an event to listen for?)

enableControl: undoes disableControl syntax: none

Disabling control should not prevent the action queue from progressing.

threonin commented 12 years ago

Would it be enough to just set a flag to ignore all key commands?

Gankra commented 12 years ago

More or less, yeah, that should be sufficient.

FugiTech commented 12 years ago

You don't want to stop registering key presses, just to stop them from having any effect. Perhaps just an if block around handleInputs()?

Gankra commented 12 years ago

Yeah. That is more so what I meant. Specifically something like:

        if(hasControl() && !inputDisabled){
        Sburb.char.handleInputs(Sburb.pressed, Sburb.pressedOrder);
    }else{
        Sburb.char.moveNone();
    }

Or something.

hasControl() has some serious code smell around it these days. It might be worth refactoring to just kill it once and for all.

threonin commented 12 years ago

This isn't enough, the chooser still opens when standing before an object with actions and pressing space. When I additionally use this line in _onkeydown it works fine:

if(Sburb.updateLoop && !Sburb.inputDisabled) {