Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
adding action blockInput !
Browse files Browse the repository at this point in the history
  • Loading branch information
ericoporto committed Dec 4, 2016
1 parent cb89563 commit 9f0ac60
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ actions.moveChara = function(param, position, charatodel) {
engine.atomStack.push([engine.actions.moveChara, params, charatodel])
}

actions.blockInput = function(param, position) {
var params = param.split(';')
var shouldblock = false;
if(params[0] == true || params[0] == 'true' || params[0] == 'block' || params[0] == 'Block'){
var shouldblock = true;
}
engine.atomStack.push([engine.actions.blockInput, [shouldblock]])
}

actions.questionBox = function(param, position) {
var params = param.split(';')
engine.questionBoxAnswer = engine.questionBoxUndef
Expand Down
11 changes: 11 additions & 0 deletions src/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,14 @@ engine.actions.moveChara = function(param, charatodel) {
}
}

engine.actions.blockInput = function(param) {
if(param[0]){
player.blockInput = true;
} else {
player.blockInput = false;
}
}

engine.actions.questionBox = function(param) {
var answers = {}
engine.questionBoxAnswer = engine.questionBoxUndef
Expand Down Expand Up @@ -921,6 +929,7 @@ player.setup = function() {
// player['mapy'] = resources.init['Player']['initPosY'];
player['facing'] = resources.init['Player']['facing'];
player['party'] = resources.init['Player']['party']
player['blockInput'] = false;
player['steps'] = 0;
player['waits'] = 0;
player['movstack'] = [];
Expand Down Expand Up @@ -984,6 +993,8 @@ player.setup = function() {
player.steps = 32;
}
} else {
if(player.blockInput)
return;
var dirkey = engine.dirKeyActive()
if (dirkey) {
engine.mapEventBlocked = false;
Expand Down

0 comments on commit 9f0ac60

Please sign in to comment.