Skip to content

Commit

Permalink
Add level 2 door behaviors
Browse files Browse the repository at this point in the history
  • Loading branch information
damien.fayol committed Jul 19, 2023
1 parent c212452 commit 319648d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
30 changes: 24 additions & 6 deletions src/lib/dialogs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,17 @@ const lockedDoor: GraphDialog = {
successStep: {
content: 'The door opened',
doAction: () => {
console.log('success');
store.update((store) => {
const door = store.levels[store.currentLevelNumber].getScript(2) as Doodad;
door.z = 1.01;
door.collision = false;
store.levels[store.currentLevelNumber].replaceScript(door);
return store;
});
}
},
failureStep: {
content: 'The door stays put',
doAction: () => {
console.log('failure');
}
content: 'The door stays put'
}
}
]
Expand All @@ -121,7 +124,22 @@ const greta : GraphDialog = {
};

const bob : GraphDialog = {
content: 'Welcome to my shop !',
content: 'Hello ! We have gobelin, deep in the mine. Could you look into them ?',
dialogChoices: [{
content: 'Yes',
nextStep: {
content: 'Thanks ! I\'ve open the door for you',
doAction: () => {
store.update((store) => {
const door = store.levels[store.currentLevelNumber].getScript(4) as Doodad;
door.z = 1.01;
door.collision = false;
store.levels[store.currentLevelNumber].replaceScript(door);
return store;
});
}
},
}]
};

const makeDialogs = (graph: GraphDialog, ref = ''): Record<string, NpcDialog | PlayerDialog> => {
Expand Down
2 changes: 1 addition & 1 deletion src/maps/level-0.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"pDefense": 0,
"pAttack": 1
},
"xp": 30,
"xp": 2,
"loot": "key"
},
{
Expand Down

0 comments on commit 319648d

Please sign in to comment.