Jump to content

Disable point-and-click input on the fly when clicking objects


markus.n
 Share

Recommended Posts

Hi,

 

I'm doing a point-and-click adventure game, in which the movement works approximately as instructed here: http://www.html5gamedevs.com/topic/5083-point-and-click-movement/

 

How can i disable temporarily the following line, which makes movement possible? Even better would be to have some conditions to it, with the idea of "onDown except when clicking on these objects: [ ]"



this.game.input.onDown.add(this.moveSprite, this);


  

The problematic situations are e.g. when I click on the fullscreen button or a clickable object, which should trigger dialogue. In these cases, I don't want to move the hero at all. I have a clickToMove flag, and the whole moveSprite() function is inside of it. My update() function looks like this:



update: function () {
  
  if (!this.dialogueInProgress && !this.scannerOn) {
    this.clickToMove = true;
    this.heroUpdate();
  }
  else if (this.dialogueInProgress) {
    this.clickToMove = false;
    this.game.input.onDown.addOnce(this.dialogueHandler, this);
  }
  else if (this.scannerOn) {
    this.clickToMove = false;
  }
},


 

This actually works during dialogue and the scannerOn event, but the problem is the FIRST click: the hero always moves to the fullscreen button or clickable object and keeps still only on the following clicks. The animation i can get rid of (happens in heroUpdate()), but the tween from moveSprite() always happens.

 

Thanks in advance for any help!

Link to comment
Share on other sites

Anyone? :( Various input problems are seriously ruining every aspect of my point-and-click game. There are lots of things I want to do by clicking aside from moving, and I can't think of any other way to handle the movement.

Another very related problem is that i have dialogues both in simple text and multiple choice by clicking (basic adventure game stuff). Within dialogues, simple text can be continued by clicking wherever like this.game.input.onDown.addOnce(this.dialogueHandler, this); , but if there's a multiple choice, it works like this.textArray.events.onInputDown.add(this.dialogueHandler, this);

This means that with multiple choices, both of the clicks happen simultaneously... which leads to showstopper problems. I need to be able to disable the universal clicking temporarily somehow! I read that for sprites you can do this:

sprite.input.enabled = false;sprite.input.enabled = true;

But neither of these seem to do anything:

this.game.input.onDown.enabled = false;this.game.input.enabled = false;

Edit:
 

Found the option of doing

this.game.input.disabled = true;

But it apparently disables ALL input, so i can't click on the text either. :(

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...